Skip to content
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

chore(sdk): add test for key error bug resolved in #10067 #10128

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions sdk/python/kfp/compiler/compiler_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5690,5 +5690,34 @@ def comp() -> List[Artifact]:
return dsl.ContainerSpec(image='alpine', command=['pwd'])


class TestPipelineSpecAttributeUniqueError(unittest.TestCase):

def test_compiles(self):
# in a previous version of the KFP SDK there was an error when:
# - a component has a dsl.OutputPath parameter
# - the pipeline has an existing component by a different name
# - the user calls component.pipeline_spec inside their pipeline definition
# this was resolved coincidentally in
# https://github.com/kubeflow/pipelines/pull/10067, so test that it
# doesn't come back

@dsl.container_component
def existing_comp():
return dsl.ContainerSpec(
image='alpine', command=['echo'], args=['foo'])

@dsl.container_component
def issue_comp(v: dsl.OutputPath(str)):
return dsl.ContainerSpec(image='alpine', command=['echo'], args=[v])

@dsl.pipeline
def my_pipeline():
existing_comp()
issue_comp.pipeline_spec

# should compile without error
self.assertTrue(my_pipeline.pipeline_spec)


if __name__ == '__main__':
unittest.main()