kfp_toolbox.decorators module#
- kfp_toolbox.decorators.caching(enable_caching: bool)[source]#
Specify a caching option of the component.
- Parameters:
enable_caching (bool) – Whether the component uses the cache from a previous run.
- Returns:
A decorator function with specified a caching option.
- Return type:
Callable
- kfp_toolbox.decorators.container_spec(cpu: str | None = None, memory: str | None = None, gpu: str | None = None, accelerator: str | None = None)[source]#
Specify computing resources to be used by the component.
The computing resources that can be specified are CPU, memory, GPU, and accelerator type.
- Parameters:
cpu (Optional[str], optional) – CPU limit (maximum) for the component. Defaults to None.
memory (Optional[str], optional) – Memory limit (maximum) for the component. Defaults to None.
gpu (Optional[str], optional) – GPU limit (maximum) for the component. Defaults to None.
accelerator (Optional[str], optional) – Accelerator type requirement for the component. Defaults to None.
- Returns:
A decorator function with specified computing resources.
- Return type:
Callable
- kfp_toolbox.decorators.display_name(name: str)[source]#
Specify a display name of the component.
- Parameters:
name (str) – Display name.
- Returns:
A decorator function with specified a display name.
- Return type:
Callable
- kfp_toolbox.decorators.override_docstring(docs: str | None = None)[source]#
Override the docstring of the component.
- Parameters:
docs (Optional[str], optional) – The docstring to be overwritten. If None, the docstring of the original function is adopted. Defaults to None.
- Returns:
A decorator function with the specified docstring.
- Return type:
Callable
- kfp_toolbox.decorators.spec(name: str | None = None, cpu: str | None = None, memory: str | None = None, gpu: str | None = None, accelerator: str | None = None, caching: bool | None = None)[source]#
Specify computing resources to be used by the component.
This function is used as decorator. The computing resources that can be specified are CPU, memory, GPU, and accelerator type. In addition, the display name of the component and the use of cache can be specified.
- Parameters:
name (Optional[str], optional) – Display name for the component. Defaults to None.
cpu (Optional[str], optional) – CPU limit (maximum) for the component. Defaults to None.
memory (Optional[str], optional) – Memory limit (maximum) for the component. Defaults to None.
gpu (Optional[str], optional) – GPU limit (maximum) for the component. Defaults to None.
accelerator (Optional[str], optional) – Accelerator type requirement for the component. Defaults to None.
caching (Optional[bool], optional) – Caching options for this task. Defaults to None.
- Returns:
A decorator function with specified computing resources.
- Return type:
Callable
Deprecated since version 0.5.0: Use
container_spec()
,display_name()
andcaching()
decorators instead.