-
Notifications
You must be signed in to change notification settings - Fork 343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support key-value type list properties in a more generic way #2679
Conversation
Thanks for making a pull request to Elyra! To try out this branch on binder, follow this link: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good so far. I had some suggestions that might make things cleaner from a class perspective.
if property_name.startswith("elyra_"): | ||
property_name = property_name.replace("elyra_", "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand stripping off the elyra_
prefix in order to check if this property is a KV pairs property, but that's only because the elyra_
prefix is stripped when building the kv_pair_properties
list anyway. Since we don't appear to persist the non-prefixed values, can we forgo both of these "stripping" locations?
I'm not finding any place in the old code where these prefixes are removed so just wondering why we need to do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately I don't think we can. Here and in the function you linked, we're taking property names directly from the templates where the elyra_
prefix is present. The property name that we get during submit/export (and that we're checking for matches with the key-value pair property names), doesn't have the prefix - the frontend removes it at some point.
I wonder if we could forego the elyra_
prefix altogether at some point and just indicate this in the canvas JSON data stanza in some other way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Ok, no worries.
I wonder if we could forego the elyra_ prefix altogether at some point and just indicate this in the canvas JSON data stanza in some other way.
This sounds like something that might be a helpful update at some point.
cc: @ajbozarth
Moved this into WIP right now because I haven't been able to test the recent changes as thoroughly as I'd like to. I still have to add new test case(s) as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - thank you @kiersten-stokes!
Perhaps I am missing something, but should this processing be still required https://github.com/kiersten-stokes/elyra/blob/generic-kv-props/elyra/pipeline/processor.py#L596-L604 when volume mounts are exposed as kv properties? |
Fixes #2678
Supports #2675
What changes were proposed in this pull request?
First, key-value type properties are identified in the canvas JSON with the addition of a key
keyValueEntries
in thedata
stanza.The
list
built-in type is extended in this PR in a class calledKeyValueList
. Key-value pair properties will have values of this type. TheKeyValueList
type has various methods that perform conversion of a list of character-separated key-value pairs (e.g."key=value"
) to a dictionary and vice-versa. Node and pipeline key-value list properties identified with thekeyValueEntries
metadata mentioned above have their values converted ASAP, during the construction of thePipelineDefinition
object. A new functioncoerce_kv_pair_properties
is added that takes place before default property propagation that makes this conversion fromlist
toKeyValueList
so that later functions dealing with the processing of these values will succeed.This allows for the removal of some duplicate code and explicit references to env_vars.
How was this pull request tested?
A new test case (
test_convert_kv_properties
) was added to ensure all key-value props are converted toKeyValueList
types.Developer's Certificate of Origin 1.1