Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into third-party-container
Browse files Browse the repository at this point in the history
  • Loading branch information
wild-endeavor committed Apr 28, 2021
2 parents cdffa21 + 00724ee commit 371f386
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions flytekit/control_plane/tasks/executions.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from typing import Any, Dict, Optional

from flytekit.clients.helpers import iterate_node_executions as _iterate_node_executions
from flytekit.common import utils as _common_utils
from flytekit.common.exceptions import user as _user_exceptions
from flytekit.common.mixins import artifact as _artifact_mixin
from flytekit.core.context_manager import FlyteContext
from flytekit.core.type_engine import TypeEngine
from flytekit.engines.flyte import engine as _flyte_engine
from flytekit.models import literals as _literal_models
from flytekit.models.admin import task_execution as _task_execution_model
from flytekit.models.core import execution as _execution_models

Expand Down Expand Up @@ -36,7 +36,7 @@ def inputs(self) -> Dict[str, Any]:
execution_data = client.get_task_execution_data(self.id)

# Inputs are returned inline unless they are too big, in which case a url blob pointing to them is returned.
input_map: _literal_models.LiteralMap = _literal_models.LiteralMap({})
input_map = _literal_models.LiteralMap({})
if bool(execution_data.full_inputs.literals):
input_map = execution_data.full_inputs
elif execution_data.inputs.bytes > 0:
Expand All @@ -47,7 +47,9 @@ def inputs(self) -> Dict[str, Any]:
_common_utils.load_proto_from_file(_literals_pb2.LiteralMap, tmp_name)
)

self._inputs = TypeEngine.literal_map_to_kwargs(ctx=FlyteContext.current_context(), lm=input_map)
# TODO: need to convert flyte literals to python types. For now just use literals
# self._inputs = TypeEngine.literal_map_to_kwargs(ctx=FlyteContext.current_context(), lm=input_map)
self._inputs = input_map
return self._inputs

@property
Expand All @@ -70,19 +72,20 @@ def outputs(self) -> Dict[str, Any]:
execution_data = client.get_task_execution_data(self.id)

# Inputs are returned inline unless they are too big, in which case a url blob pointing to them is returned.
output_map = _literal_models.LiteralMap({})
if bool(execution_data.full_outputs.literals):
output_map = execution_data.full_outputs

elif execution_data.outputs.bytes > 0:
with _common_utils.AutoDeletingTempDir() as t:
tmp_name = _os.path.join(t.name, "outputs.pb")
_data_proxy.Data.get_data(execution_data.outputs.url, tmp_name)
output_map = _literal_models.LiteralMap.from_flyte_idl(
_common_utils.load_proto_from_file(_literals_pb2.LiteralMap, tmp_name)
)
output_map = _literal_models.LiteralMap({})

self._outputs = TypeEngine.literal_map_to_kwargs(ctx=FlyteContext.current_context(), lm=output_map)
# TODO: need to convert flyte literals to python types. For now just use literals
# self._outputs = TypeEngine.literal_map_to_kwargs(ctx=FlyteContext.current_context(), lm=output_map)
self._outputs = output_map
return self._outputs

@property
Expand Down

0 comments on commit 371f386

Please sign in to comment.