mlops-with-vertex-ai
mlops-with-vertex-ai copied to clipboard
Unit test for pipeline in Vertex AI
After reading the notebook: https://github.com/GoogleCloudPlatform/mlops-with-vertex-ai/blob/main/04-pipeline-deployment.ipynb
the unit test is testing the functions which is not used to launch the pipeline. It seems that there are two sets of functions, one for unit test and one for createing pipeline. Is that possible to test the functions defined under @component decorators?
Many thanks,
To access the function defined under the @component you need to get its python_func
attribute.
So if you have a function:
@component
def foo():
return 'foo'
Then you can test it like this:
def test_foo():
assert foo.python_func() == 'foo'