Skip to content

Commit

Permalink
Dynamic workflow should not throw nested task warning (#1812)
Browse files Browse the repository at this point in the history
Signed-off-by: oliverhu <[email protected]>
  • Loading branch information
Keqiu Hu authored Aug 31, 2023
1 parent 25f9863 commit f6cfc9d
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 f6cfc9d

Please sign in to comment.