Skip to content

Commit

Permalink
fix: add FlyteValueException handling and clean up exit_handler calls
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent <[email protected]>
  • Loading branch information
vincent0426 committed Jan 6, 2025
1 parent 0ad84f3 commit ea17a4d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
14 changes: 13 additions & 1 deletion flytekit/core/base_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@
FlyteNonRecoverableSystemException,
FlyteUploadDataException,
)
from flytekit.exceptions.user import FlyteUserRuntimeException
from flytekit.exceptions.user import (
FlyteUserRuntimeException,
FlyteValueException,
)
from flytekit.loggers import logger
from flytekit.models import dynamic_job as _dynamic_job
from flytekit.models import interface as _interface_models
Expand Down Expand Up @@ -770,6 +773,15 @@ def dispatch_execute(
):
return native_outputs

if isinstance(native_outputs, VoidPromise):
return _literal_models.LiteralMap(literals={})

if native_outputs is not None and len(list(self._outputs_interface.keys())) == 0:
raise FlyteValueException(
native_outputs,
f"Interface has {len(self.python_interface.outputs)} outputs.",
)

try:
with timeit("dispatch execute"):
literals_map, native_outputs_as_map = run_sync(
Expand Down
2 changes: 1 addition & 1 deletion flytekit/interactive/vscode_lib/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ def execute(self, *args, **kwargs):
# 5. Prepare the launch.json
prepare_launch_json()

return exit_handler(
exit_handler(
child_process=child_process,
task_function=self.task_function,
args=args,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def execute(self, *args, **kwargs):

write_example_notebook(task_function=self.task_function, notebook_dir=self.notebook_dir)

return exit_handler(
exit_handler(
child_process=child_process,
task_function=self.task_function,
args=args,
Expand Down

0 comments on commit ea17a4d

Please sign in to comment.