-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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(v2): iterator and sub-DAG basic support #6985
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4d209d7
chore(samples): add loop_output_v2 sample
Bobgy 29ae9a0
feat(v2): iterator support
Bobgy ab038e2
refactor v2 backend compiler tests to golden files
Bobgy aa5de89
fix unit tests
Bobgy 14882a5
test(v2): verify loop_output_test MLMD data
Bobgy af2fcf3
clean up
Bobgy a2aa571
fix
Bobgy 18d796b
fix2
Bobgy de783a0
fix
Bobgy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Copyright 2021 The Kubeflow Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import os | ||
from kfp.v2 import dsl | ||
|
||
# In tests, we install a KFP package from the PR under test. Users should not | ||
# normally need to specify `kfp_package_path` in their component definitions. | ||
_KFP_PACKAGE_PATH = os.getenv('KFP_PACKAGE_PATH') | ||
|
||
|
||
@dsl.component(kfp_package_path=_KFP_PACKAGE_PATH) | ||
def args_generator_op() -> str: | ||
return '[1.1, 1.2, 1.3]' | ||
|
||
|
||
# TODO(Bobgy): how can we make this component with type float? | ||
# got error: kfp.v2.components.types.type_utils.InconsistentTypeException: | ||
# Incompatible argument passed to the input "s" of component "Print op": Argument | ||
# type "STRING" is incompatible with the input type "NUMBER_DOUBLE" | ||
@dsl.component(kfp_package_path=_KFP_PACKAGE_PATH) | ||
def print_op(s: str): | ||
print(s) | ||
|
||
|
||
@dsl.pipeline(name='pipeline-with-loop-output-v2') | ||
def my_pipeline(): | ||
args_generator = args_generator_op() | ||
with dsl.ParallelFor(args_generator.output) as item: | ||
print_op(s=item) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from kfp.v2 import components, dsl | ||
from typing import List | ||
|
||
|
||
@dsl.component | ||
def print_op(text: str) -> str: | ||
print(text) | ||
return text | ||
|
||
|
||
@dsl.component | ||
def concat_op(a: str, b: str) -> str: | ||
print(a + b) | ||
return a + b | ||
|
||
|
||
_DEFAULT_LOOP_ARGUMENTS = [{'a': '1', 'b': '2'}, {'a': '10', 'b': '20'}] | ||
|
||
|
||
@dsl.pipeline(name='pipeline-with-loop-static') | ||
def my_pipeline( | ||
static_loop_arguments: List[dict] = _DEFAULT_LOOP_ARGUMENTS, | ||
greeting: str = 'this is a test for looping through parameters', | ||
): | ||
print_task = print_op(text=greeting) | ||
|
||
with dsl.ParallelFor(static_loop_arguments) as item: | ||
concat_task = concat_op(a=item.a, b=item.b) | ||
concat_task.after(print_task) | ||
print_task_2 = print_op(text=concat_task.output) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 removed all the empty structs for more concise comparison