-
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
feat(sdk): support dsl.If, dsl.Elif, and dsl.Else #9894
feat(sdk): support dsl.If, dsl.Elif, and dsl.Else #9894
Conversation
Skipping CI for Draft Pull Request. |
d3e2612
to
572915d
Compare
/assign @chensun |
/hold do not merge before 9/1/23 |
/test all |
@@ -0,0 +1,42 @@ | |||
# Copyright 2023 The Kubeflow Authors |
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 exmaple seems completely covered by if_elif_else
. Can we merge and reduce duplication?
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'd slightly prefer to keep this test case to separately test that the compilation logic for dsl.Else
is correct both following a dsl.If
(single condition to negate) and following a dsl.If
+ dsl.Elif
(>1 condition to negate). This is indeed a subset of the other tests, but I find having a "base case" tests for each DSL feature helps during the development workflow.
task2 = my_component2(...) | ||
""" | ||
|
||
def __init__( | ||
self, | ||
condition: pipeline_channel.ConditionOperator, | ||
condition, |
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.
nit: type annotation?
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 intentionally removed this, since I personally find it a bit confusing and I suspect users do too. See the current reference docs which use this annotation.
While annotation is technically correct, it isn't informative to the user and exposes an implementation detail. We don't actually want the user to provide a ConditionOperator
(name changed in this PR)... we want them to provide a comparative expression involving one or more pipeline channels (i.e., to think of it as a "future" boolean).
WDYT?
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.
SG.
|
||
def __init__( | ||
self, | ||
condition, |
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.
nit: type annotation?
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.
See comment above
a205032
to
10bbe50
Compare
10bbe50
to
cdd8e11
Compare
/unhold |
e750768
to
6628877
Compare
6628877
to
3eebc74
Compare
@connor-mccarthy: The following test failed, say
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
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
/approve
Thanks!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: chensun 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 |
* support if/elif/else * deprecate dsl.Condition * alter rebase * update release notes * address review feedback * change BinaryOperation to ConditionOperation
Description of your changes:
Supports authoring pipelines that use
dsl.If
,dsl.Elif
, anddsl.Else
. For example:Note that
dsl.If
is merely an alias fordsl.Condition
.dsl.Elif
anddsl.Else
are new functionality.Checklist:
pull request title convention used in this repository.