From 3b064dca90de2d0d2d691e931aaadca56beb3a7f Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Mon, 26 Jun 2023 13:57:47 -0700 Subject: [PATCH] Generate decks at local execution (#1699) * Output deck at local execution --- flytekit/core/base_task.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/flytekit/core/base_task.py b/flytekit/core/base_task.py index 6556ac1469..a5c9a23d9a 100644 --- a/flytekit/core/base_task.py +++ b/flytekit/core/base_task.py @@ -509,6 +509,7 @@ def dispatch_execute( # Invoked before the task is executed new_user_params = self.pre_execute(ctx.user_space_params) + from flytekit.deck.deck import _output_deck # Create another execution context with the new user params, but let's keep the same working dir with FlyteContextManager.with_context( @@ -601,6 +602,10 @@ def dispatch_execute( for k, v in native_outputs_as_map.items(): output_deck.append(TypeEngine.to_html(ctx, v, self.get_type_for_output_var(k, v))) + if ctx.execution_state and ctx.execution_state.mode == ExecutionState.Mode.LOCAL_WORKFLOW_EXECUTION: + # When we run the workflow remotely, flytekit outputs decks at the end of _dispatch_execute + _output_deck(self.name.split(".")[-1], new_user_params) + outputs_literal_map = _literal_models.LiteralMap(literals=literals) # After the execute has been successfully completed return outputs_literal_map