Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sdk): fix attribute error for Containerized Python Components #8887

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sdk/RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 8 additions & 2 deletions sdk/python/kfp/components/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down