-
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
WithItems Support #1868
WithItems Support #1868
Conversation
/retest |
@@ -677,6 +800,9 @@ def compile(self, pipeline_func, package_path, type_check=True): | |||
yaml.Dumper.ignore_aliases = lambda *args : True | |||
yaml_text = yaml.dump(workflow, default_flow_style=False) | |||
|
|||
if package_path is None: |
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 are the use cases where the YAML text is need?
The Compiler()._compile
method returns the workflow dict which seems more useful.
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 was using it for visual debugging while i was developing. i figured why not leave the option for anyone else who ends up working on the compiler. what do you guys think?
@@ -591,6 +591,12 @@ def some_pipeline(): | |||
if container: | |||
self.assertEqual(template['retryStrategy']['limit'], 5) | |||
|
|||
def test_withitem_basic(self): |
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.
Is it possible to test the actual behavior of the feature instead of just comparing the YAML text?
It would be great if the tests are not starting to fail when some unrelated part (e.g. pipeline name or metadata) changes.
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 agree, it'd be nice to have an e2e test as well, but either way, we'll want to include some unit tests too and this is the pattern the repo uses.
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.
Unit tests are important and we should have them. However we can usually do better than just comparing YAML output of the whole pipeline (although, checking for the loop compilation behavior might be non-trivial).
As and example of unit tests that test the feature behavior, see
test_init_container
test_op_transformers
test_set_display_name
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 agree, less brittle tests would be nice, though the full YAML comparison is more thorough and that is most of how we currently test the compiler.
|
||
|
||
# @dsl.pipeline(name='my-pipeline') | ||
# def pipeline(my_pipe_param=10): |
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.
Is this test failing?
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.
shouldn't be
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.
Should there be commented out code here?
sdk/python/kfp/compiler/compiler.py
Outdated
return op_name_to_op | ||
|
||
def _fill_loop_args(self, new_root): | ||
"""Traverses through graph, plucking up loop_args vars from ops groups and depositing pointers to them on the |
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.
Can you elaborate on this a bit more?
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.
you're right, this is a bit vague.
Thank you for this great work! |
/retest |
/ping |
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.
Could you add a basic example for this feature? It doesn't have to be in the same PR.
) | ||
|
||
|
||
# @dsl.pipeline(name='my-pipeline') |
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.
remove?
/lgtm |
/assign @IronPan |
/lgtm |
|
/assign @neuromage |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Ark-kun, neuromage 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 |
closes #1481 |
This is great. BTW, have you tested the withitem support with the recursion. For example, create a ParallelFor loop inside a recursive function? AFAIK, this is a common case where the outer recursion controls when to stop a HP running and the inner ParallelFor will run some parameters in parallel. |
This PR adds for loop support to the KFP DSL.
Users instantiate loops like so:
They currently support multiple operations within the loop and nested operations. They don't currently support using the output of another operation as the input to loop.
This change is