Skip to content

Commit

Permalink
fix: graph for non-pythonic container output's names
Browse files Browse the repository at this point in the history
Loading container component from component.yaml creates both
pythonic and original output names. Graph component iterated over
all outputs, using pythonic-to-output conversion on all. If some
of the names are not identical to their pythonic versions, they
rised KeyError on the lookup table.

This commit fixes this problem by using default value for the lookup.
  • Loading branch information
Udiknedormin committed Sep 18, 2020
1 parent 1bbd52a commit b343cdd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sdk/python/kfp/components/_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,12 @@ def resolve_argument(argument):

task_obj = task_factory(**pythonic_task_arguments)
task_outputs_with_pythonic_names = task_obj.outputs
task_outputs_with_original_names = {pythonic_output_name_to_original[pythonic_output_name]: output_value for pythonic_output_name, output_value in task_outputs_with_pythonic_names.items()}
task_outputs_with_original_names = {
# component_bridge generates outputs under both pythonic and original name,
# so half of them are absent from pythonic_output_name_to_original
pythonic_output_name_to_original.get(pythonic_output_name, pythonic_output_name): output_value
for pythonic_output_name, output_value in task_outputs_with_pythonic_names.items()
}
outputs_of_tasks[task_id] = task_outputs_with_original_names

resolved_graph_outputs = OrderedDict([(output_name, resolve_argument(argument)) for output_name, argument in graph.output_values.items()])
Expand Down

0 comments on commit b343cdd

Please sign in to comment.