in google_cloud_automlops/AutoMLOps.py [0:0]
def component(func: Optional[Callable] = None,
*,
packages_to_install: Optional[List[str]] = None):
"""Decorator for Python-function based components in AutoMLOps.
Example usage:
from google_cloud_automlops import AutoMLOps
@AutoMLOps.component
def my_function_one(input: str, output: Output[Model]):
...
Args:
func: The python function to create a component from. The function should have type
annotations for all its arguments, indicating how it is intended to be used (e.g. as an
input/output Artifact object, a plain parameter, or a path to a file).
packages_to_install: A list of optional packages to install before executing func. These
will always be installed at component runtime.
"""
if func is None:
return functools.partial(
component,
packages_to_install=packages_to_install)
else:
components_dict[func.__name__] = BaseComponent(
func=func,
packages_to_install=packages_to_install
)
return