Sanitize KFP input/output params in kwargs #2533
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This PR prevents Elyra from throwing an error when it tries to pass invalid
kwargs
to a KFP component-factory function.A Kubeflow component can name its inputs/outputs things that are not valid python
kwargs
names, in these cases, KFP silently renames these inputs by replacing the invalid characters with_
.my-input
-->my_input
It is also possible to have a case where multiple different parameters map to the same "sanitized value". In these cases, KFP appends a number to the end of the ones which were transformed (starting at
2
). But because elyra stores parameters in an unordered dictionary, we can't possibly know which one maps to which index. (But it's probably not a huge issue if we don't support this extreme edge case)my-input
andmy_input
-->my_input_2
andmy_input
How was this pull request tested?
I have tested this in a Kubeflow cluster with a component that has parameters named things like
my-parameter-name
, and they were correctly compiled and run.Developer's Certificate of Origin 1.1