-
Notifications
You must be signed in to change notification settings - Fork 349
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 well-defined ComponentDefinition return values for catalog connectors #2492
Conversation
Thanks for making a pull request to Elyra! To try out this branch on binder, follow this link: |
I think We should also note the |
I've confirmed that this is working for the airflow package connector. #2488 contains test details.
Could we make it optional? Seems more natural ... |
We can make the return value optional. However, it does introduce some ambiguity for backward-compatibility handling since we'll need to call the old method if the new method returns |
d5a3419
to
eae9c53
Compare
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.
Sorry - got a few comments mostly around naming but I'm hoping we can make things easier for connector authors as well. I'd be happy to meet via Webex to go over things if that is easier.
Resolving several review comments above after offline design discussion. Will update PR description to reflect new design once changes are pushed |
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 is really great @kiersten-stokes - thank you.
The connectors in elyra-ai/examples#94 work as expected with this PR. |
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
Fixes #2460
Supports #2488
What changes were proposed in this pull request?
Defines a new
EntryData
object class that includes the definition string as well as any runtime-specific attributes (e.g.package_name
forAirflowEntryData
). A new function,get_entry_data
is defined, which takes the place ofread_catalog_entry
, and returns anEntryData
object. If noget_entry_data
function is present for a given CCC, the return value ofread_catalog_entry
is manually coerced into aEntryData
object.A new
CatalogEntry
object is also defined, which holds in its bag of properties theEntryData
object above, a unique id, information on the source of the component, and some catalog information (such as the relevant categories). This object is constructed after theEntryData
object is returned by the CCC author and is passed directly to the parse methods, eliminating the need to define aSimpleNamespace
object as a middleman.There have also been some minor changes to the
Component
object, namely the inclusion of an optionalpackage_name
attribute and changing the same of thesource_identifier
attribute tocomponent_reference
.During processing of Airflow components, the
package_name
for that component is now accessed directly (using theimport_statement
property) if it is available. This eliminates the need to manually change theavailable_airflow_operators
configurable trait to include import statements for all custom components.Changes are backwards compatible, so any implementations of CCC's using the previous version that doesn't return the well-defined object will still work properly (e.g. the url catalog). Built-in CCC's will have to be updated (in a separate PR) to use the
get_entry_data
.For now, here is what you will need to do (@ptitzler) to implement the new metadata return values:
read_catalog_entry
function toget_entry_data
(parameters are the same)EntryData
object, and more specifically for the Airflow package connector use-case, anAirflowEntryData
object, so:from elyra.pipeline.catalog_connector import AirflowEntryData
andfrom elyra.pipeline.catalog_connector import EntryData
Optional[EntryData]
AirflowEntryData
and return that instead:get_hash_keys
to aclassmethod
by adding the decorator and changing the parameter fromself
tocls
Initial manual tests following the above structure are working.
How was this pull request tested?
Tests have been updated.
Successful and error scenarios have been manually tested.
Developer's Certificate of Origin 1.1