Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Commit

Permalink
Dynamic workflow should not throw nested task warning (flyteorg#1812)
Browse files Browse the repository at this point in the history
Signed-off-by: oliverhu <khu@linkedin.com>
Signed-off-by: Future Outlier <eric901201@gmai.com>
  • Loading branch information
oliverhu authored and Future Outlier committed Oct 3, 2023
1 parent 3d400dc commit 297f1bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions flytekit/core/context_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,9 @@ class Mode(Enum):
# or propeller.
LOCAL_TASK_EXECUTION = 3

# This is the mode that is used to indicate a dynamic task
DYNAMIC_TASK_EXECUTION = 4

mode: Optional[ExecutionState.Mode]
working_dir: Union[os.PathLike, str]
engine_dir: Optional[Union[os.PathLike, str]]
Expand Down
7 changes: 6 additions & 1 deletion flytekit/core/python_function_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,12 @@ def compile_into_workflow(
else:
cs = ctx.compilation_state.with_params(prefix="d")

with FlyteContextManager.with_context(ctx.with_compilation_state(cs)):
updated_ctx = ctx.with_compilation_state(cs)
if self.execution_mode == self.ExecutionBehavior.DYNAMIC:
es = ctx.new_execution_state().with_params(mode=ExecutionState.Mode.DYNAMIC_TASK_EXECUTION)
updated_ctx = updated_ctx.with_execution_state(es)

with FlyteContextManager.with_context(updated_ctx):
# TODO: Resolve circular import
from flytekit.tools.translator import get_serializable

Expand Down

0 comments on commit 297f1bf

Please sign in to comment.