-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
SDK/Compiler - Added the ability to apply a function to all ops in a pipeline #1209
SDK/Compiler - Added the ability to apply a function to all ops in a pipeline #1209
Conversation
They can be used to apply some functions (e.g. to add secrets) to all pipeline ops.
Would you mind explaining why we need to add the transformers? |
"They can be used to apply some functions (e.g. to add secrets) to all pipeline ops." So, it's basically |
I think the exposed interface should be in the DSL instead of the compiler. In other words, this interface should be exposed in the DSL at best. WDYT? |
That's a bit problematic, because the ops are only created during the compilation. Generally, my goal here is to move the non-portable and repeating things like attaching secrets out of the pipeline function so that it can be portable across clouds. P.S. I'll remove the template modifiers as it's exposing Argo. |
I've removed the |
An example PR that would have been trivial with this: #749 It could have just been a simple switch:
|
@gaoning777 Can you please take a look again? |
Gentle ping |
@Ark-kun This is great PR. Just want to confirm, not sure if we need to consider the case that user uses the And consult one quick question here, you used the |
How about passing the transformers to PipelineConf( pipelines/sdk/python/kfp/dsl/_pipeline.py Line 54 in 2da723c
I'm more inclined to exposing this as DSL interface instead of compiler options.
|
Hmm. I guess it will solve some of the problems. Thanks for the suggestion. |
You're right. This is an important use case. (I keep forgetting about it since I just start the pipeline files directly instead of using the compiler).
I was thinking about a either having a constant variable in the pipeline program code or read the value from an environment variable. |
@Ark-kun one more question, do you planed to handle the case that if we want to apply the function to all steps except first one? For example, the first step is to create the pvc but following steps need to apply the pvc (function). Thanks a lot! |
For more customized scenarios, why not write a python for loop to do it. For example, |
The function can inspect the op and decide whether to modify it or not. For example it can skip the nodes with particular name or all resource nodes. |
Yes, in fact I've already done that in the PR #749 :-) |
…ler---Added-op-and-template-transformers
Done. |
Thanks for the change. |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Ark-kun The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
* Add explanation image * Update AIX mnist readme with example explanation * Add development image link * Update readme based on code review Co-authored-by: Tommy Li <Tommy.chaoping.li@ibm.com> Co-authored-by: Tommy Li <Tommy.chaoping.li@ibm.com>
They can be used to apply some functions (e.g. to add secrets) to all pipeline ops.
This change is