You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Previously, ContainerOp had strict requirements for the output names, so we had to# convert all the names before passing them to the ContainerOp constructor.# Outputs with non-pythonic names could not be accessed using their original names.# Now ContainerOp supports any output names, so we're now using the original output names.# However to support legacy pipelines, we're also adding output references with pythonic names.# TODO: Add warning when people use the legacy output names.output_names= [output_spec.nameforoutput_specincomponent_spec.outputsor []] # Stabilizing the orderingoutput_name_to_python=generate_unique_name_conversion_table(output_names, _sanitize_python_function_name)
foroutput_nameinoutput_names:
pythonic_output_name=output_name_to_python[output_name]
# Note: Some component outputs are currently missing from task.outputs (e.g. MLPipeline UI Metadata)ifpythonic_output_namenotintask.outputsandoutput_nameintask.outputs:
task.outputs[pythonic_output_name] =task.outputs[output_name]
Looks like the container component defines its outputs by both original and pythonic names.
In _components.py, however, iteration goes through all inputs and pythonic_output_name_to_original is used to map the names to their original versions:
Suggested solution:
Make pythonizing the value optional, by adding a default value (di.get(key, default_value) instead of di[key]) equal to the value got. In case of pythonized names, it will still result in the original name. In case of original names, it won't change them. The doubled key will get reduced due to being inside dictionary-constructor.
…ts. Fixes#4514. (#4515)
* add tests for pythonic and non-pythonic component outputs
* fix: graph for non-pythonic container output's names
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.
* remove depythonification of outputs - not needed anymore
Jeffwan
pushed a commit
to Jeffwan/pipelines
that referenced
this issue
Dec 9, 2020
…ts. Fixeskubeflow#4514. (kubeflow#4515)
* add tests for pythonic and non-pythonic component outputs
* fix: graph for non-pythonic container output's names
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.
* remove depythonification of outputs - not needed anymore
What steps did you take:
out-1
).Could be illustrated by the following test to component_bridge_tests.py:
What happened:
Compiler fails with
KeyError
on the non-pythonic output name.What did you expect to happen:
Should compile just fine, just like it does for pythonic names (e.g.
out1
orout_1
).Environment:
Environment-independent.
KFP SDK version: 1.0.0
Anything else you would like to add:
From _component_bridge.py (for current master's HEAD: d4e7398917):
Looks like the container component defines its outputs by both original and pythonic names.
In _components.py, however, iteration goes through all inputs and
pythonic_output_name_to_original
is used to map the names to their original versions:Combining the two: if the component bridge is used:
pythonic_output_name_to_original
gets a mapping pythonic-name --> original-name.KeyError
.Suggested solution:
Make pythonizing the value optional, by adding a default value (
di.get(key, default_value)
instead ofdi[key]
) equal to the value got. In case of pythonized names, it will still result in the original name. In case of original names, it won't change them. The doubled key will get reduced due to being inside dictionary-constructor./kind bug
The text was updated successfully, but these errors were encountered: