Skip to content

Commit

Permalink
fix(sdk): fix attribute error for Containerized Python Components
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-mccarthy committed Feb 28, 2023
1 parent 6101ff1 commit 2c4acf0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
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

0 comments on commit 2c4acf0

Please sign in to comment.