Skip to content

Commit

Permalink
add task_resolver arg to @task decorator (#765)
Browse files Browse the repository at this point in the history
Signed-off-by: Niels Bantilan <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
  • Loading branch information
cosmicBboy authored and eapolinario committed Jan 28, 2022
1 parent ea49272 commit 1c9f3e2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion flytekit/core/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import inspect
from typing import Any, Callable, Dict, List, Optional, Type, Union

from flytekit.core.base_task import TaskMetadata
from flytekit.core.base_task import TaskMetadata, TaskResolverMixin
from flytekit.core.interface import transform_signature_to_interface
from flytekit.core.python_function_task import PythonFunctionTask
from flytekit.core.reference_entity import ReferenceEntity, TaskReference
Expand Down Expand Up @@ -87,6 +87,7 @@ def task(
limits: Optional[Resources] = None,
secret_requests: Optional[List[Secret]] = None,
execution_mode: Optional[PythonFunctionTask.ExecutionBehavior] = PythonFunctionTask.ExecutionBehavior.DEFAULT,
task_resolver: Optional[TaskResolverMixin] = None,
) -> Union[Callable, PythonFunctionTask]:
"""
This is the core decorator to use for any task type in flytekit.
Expand Down Expand Up @@ -170,6 +171,7 @@ def foo2():
Refer to :py:class:`Secret` to understand how to specify the request for a secret. It
may change based on the backend provider.
:param execution_mode: This is mainly for internal use. Please ignore. It is filled in automatically.
:param task_resolver: Provide a custom task resolver.
"""

def wrapper(fn) -> PythonFunctionTask:
Expand All @@ -192,6 +194,7 @@ def wrapper(fn) -> PythonFunctionTask:
limits=limits,
secret_requests=secret_requests,
execution_mode=execution_mode,
task_resolver=task_resolver,
)

return task_instance
Expand Down

0 comments on commit 1c9f3e2

Please sign in to comment.