|
14 | 14 | from flytekit.image_spec.image_spec import ImageSpec |
15 | 15 | from flytekit.loggers import logger |
16 | 16 | from flytekit.models import task as _task_model |
17 | | -from flytekit.models.literals import LiteralMap |
18 | 17 | from flytekit.models.security import Secret, SecurityContext |
19 | 18 |
|
20 | 19 | _PRIMARY_CONTAINER_NAME_FIELD = "primary_container_name" |
@@ -254,14 +253,12 @@ def _get_output_dict(self, output_directory: str) -> Dict[str, Any]: |
254 | 253 | output_dict[k] = self._convert_output_val_to_correct_type(output_val, output_type) |
255 | 254 | return output_dict |
256 | 255 |
|
257 | | - def execute(self, **kwargs) -> LiteralMap: |
| 256 | + def execute(self, **kwargs) -> Any: |
258 | 257 | try: |
259 | 258 | import docker |
260 | 259 | except ImportError: |
261 | 260 | raise ImportError(DOCKER_IMPORT_ERROR_MESSAGE) |
262 | 261 |
|
263 | | - from flytekit.core.type_engine import TypeEngine |
264 | | - |
265 | 262 | ctx = FlyteContext.current_context() |
266 | 263 |
|
267 | 264 | # Normalize the input and output directories |
@@ -289,8 +286,12 @@ def execute(self, **kwargs) -> LiteralMap: |
289 | 286 | container.wait() |
290 | 287 |
|
291 | 288 | output_dict = self._get_output_dict(output_directory) |
292 | | - outputs_literal_map = TypeEngine.dict_to_literal_map(ctx, output_dict) |
293 | | - return outputs_literal_map |
| 289 | + if len(output_dict) == 0: |
| 290 | + return None |
| 291 | + elif len(output_dict) == 1: |
| 292 | + return list(output_dict.values())[0] |
| 293 | + elif len(output_dict) > 1: |
| 294 | + return tuple(output_dict.values()) |
294 | 295 |
|
295 | 296 | def get_container(self, settings: SerializationSettings) -> _task_model.Container: |
296 | 297 | # if pod_template is specified, return None here but in get_k8s_pod, return pod_template merged with container |
|
0 commit comments