diff --git a/sdk/RELEASE.md b/sdk/RELEASE.md index 5816e3b358d..8df41513c46 100644 --- a/sdk/RELEASE.md +++ b/sdk/RELEASE.md @@ -13,6 +13,7 @@ * Enables output definitions when compiling components as pipelines. [\#8848](https://github.com/kubeflow/pipelines/pull/8848) * Fix bug when passing data between tasks using f-strings [\#8879](https://github.com/kubeflow/pipelines/pull/8879) * Fix environment variable set in component yaml lost during compilation [\#8885](https://github.com/kubeflow/pipelines/pull/8885) +* Fix attribute error when running Containerized Python Components [\#8887](https://github.com/kubeflow/pipelines/pull/8887) ## Documentation updates diff --git a/sdk/python/kfp/components/executor.py b/sdk/python/kfp/components/executor.py index 3ff9a6bd962..240c573b57a 100644 --- a/sdk/python/kfp/components/executor.py +++ b/sdk/python/kfp/components/executor.py @@ -16,6 +16,7 @@ import os from typing import Any, Callable, Dict, List, Optional, Union +from kfp.components import python_component from kfp.components import task_final_status from kfp.components.types import artifact_types from kfp.components.types import type_annotations @@ -24,8 +25,13 @@ class Executor(): """Executor executes v2-based Python function components.""" - def __init__(self, executor_input: Dict, function_to_execute: Callable): - self._func = function_to_execute + def __init__(self, executor_input: Dict, + function_to_execute: Union[Callable, + python_component.PythonComponent]): + if hasattr(function_to_execute, 'python_func'): + self._func = function_to_execute.python_func + else: + self._func = function_to_execute self._input = executor_input self._input_artifacts: Dict[str,