-
Notifications
You must be signed in to change notification settings - Fork 360
Support volumes for custom components #2785
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 volumes for custom components #2785
Conversation
|
Thanks for making a pull request to Elyra! To try out this branch on binder, follow this link: |
| from elyra.pipeline.pipeline_constants import KUBERNETES_SECRETS | ||
| from elyra.pipeline.pipeline_constants import MOUNTED_VOLUMES | ||
| from elyra.pipeline.pipeline_constants import RUNTIME_IMAGE | ||
| from elyra.pipeline.pipeline_definition import Node |
Check failure
Code scanning / CodeQL
Module-level cyclic import
| # below, the pipeline module must be imported in its entirety in order to | ||
| # avoid a circular reference issue | ||
| try: | ||
| from elyra.pipeline import pipeline |
Check notice
Code scanning / CodeQL
Cyclic import
| super().__init__(node, super_node) | ||
|
|
||
| if not component_params.get("filename"): | ||
| if not self.filename: |
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.
The approach in this GenericOperation is different than the approach in the Operation constructor where we use _-prefixed member variables to hold the values and use those variables in the validation. Then their "property" counterparts just reference the _-prefixed members.
It would be more maintainable to be consistent with approaches and would either recommend the Operation approach or forgo the use of properties altogether and use direct member names - validating each in their respective constructors.
|
|
||
| @property | ||
| def mounted_volumes(self) -> List[VolumeMount]: | ||
| return self._component_params.get(MOUNTED_VOLUMES) |
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.
What is preventing GenericOperations from using the same location for mounted_volumes and kubernetes_secrets as Operations (i.e., in app_data rather than app_data.component_parameters) or vice versa? This difference is referenced in the opening description and it seems like it would be worth a possible migration to place these pieces of information in the same location.
Using a property to handle this difference is nice, but it would be good if we could have as few differences within the file structure as we can.
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.
Hmm yeah not sure why I hadn't thought of that as an option. Thinking through this, it looks like the main thing that would have to be worked through is that this would necessitate different logic among those properties that need to be propagated. For example, we need to propagate both env_vars and mounted_volumes (and presumably env_vars should stay in the app_data.component_parameters stanza). That being said, once we got past that part, this approach would probably result in fewer differences between Operations and GenericOperations. I'm going to give it a try and hope that nothing weird comes up 🙂
|
While working through this PR, an issue was encountered that complicated things to a degree that made this approach a lot more complicated than it was worth. Long story short, the |
#2760
Will also require documentation updates, either here or in a follow-up PR.
What changes were proposed in this pull request?
I'll flush this description out further after making a few changes.
The
mounted_volumesproperty is added to the canvas properties for custom components. It will exist as a sibling-stanza to thecomponent_parametersstanza of the pipeline JSON, which is different from how this property is handled for generic components (where it appears within thecomponent_parametersstanza). As a result of this difference, some of the property propagation has been updated inpipeline_definition.py. Two functions --get_property()andset_property()-- are added that deal with this difference. The logic forget_property()is below (set_propertyis similar). I'm not sure I like how this is handled so I may fix that later (suggestions welcome).A new
mounted_volumesproperty is also added to bothGenericOperationandOperation(also accessed differently depending on the type). In adding this property, I found that simplifying theOperationobject construction made things more straightforward, so some of the logic previously done inparser.pyhas been moved topipeline.pyin theOperationconstructors and some utility classes (KeyValueListand the dataclasses) have been moved to a new file,pipeline_utilities.pyto prevent circular reference issues.Finally, logic was added to both
processor_kfp.pyandprocessor_airflow.pyto handle the addition of volumes for custom components. I also refactored how the Airflow processor handles volumes and secrets in order to simplify the DAG template. Now, all volumes and secrets for the whole pipeline are collected before being template to render.How was this pull request tested?
Tests will have to be updated and added
Developer's Certificate of Origin 1.1