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

fix(sdk): make component names more unique when merging specs #9969

Conversation

stijntratsaertit
Copy link

@stijntratsaertit stijntratsaertit commented Sep 11, 2023

Description of your changes:
When having having multiple levels of nesting in pipelines (especially when using a similar pipeline), components have a greater chance to conflict in naming and resulting in wrong references in the YAML.

Using the following change, names of already renamed components are also taken into account when altering a component name.

Checklist:

@google-oss-prow
Copy link

Hi @stijntratsaertit. Thanks for your PR.

I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@stijntratsaertit stijntratsaertit marked this pull request as ready for review September 11, 2023 00:07
@stijntratsaertit stijntratsaertit changed the title fix(sdk): make component names in dag more unique fix(sdk): make component names more unique when merging specs Sep 11, 2023
@chensun chensun removed the request for review from zijianjoy September 14, 2023 22:37
@connor-mccarthy
Copy link
Member

@stijntratsaertit, can you describe what you mean by more unique? Have you encountered a key collision?

@google-oss-prow google-oss-prow bot added size/S and removed size/XS labels Sep 17, 2023
@stijntratsaertit
Copy link
Author

Hi, I indeed encountered a key collision, more specifically when dealing with multiple for loops. It seems to go wrong when it's merging the specs. In VertexAI Pipelines, the UI was rendering wrong components within a for loop and in YAML I was able to see that wrong reference because the componentRef of a for-loop was pointing to a different component.

The names will now be more unique in the sense that it will now generate a new name when the same name exists in the current subgroup components (this was my initial change).

I have now gone back to it and noticed an additional change would be needed. The renaming should be done starting from the last generated name mapping, in order to avoid a case where unintentional renames were being done as well.

@connor-mccarthy
Copy link
Member

/ok-to-test

Thanks for explaining, @stijntratsaertit. Could you please add one test cases for each key conflict case you discovered? It should probably go here.

@google-oss-prow google-oss-prow bot added size/M and removed size/S labels Sep 18, 2023
@stijntratsaertit stijntratsaertit force-pushed the make-component-names-in-dag-more-unique branch from 3d1a09d to c2c2f16 Compare September 19, 2023 07:30
@stijntratsaertit
Copy link
Author

/retest

@connor-mccarthy
Copy link
Member

@stijntratsaertit, feel free to ignore kfp-kubernetes-execution-tests. These are unrelated to your changes.


with dsl.Condition(run_pipeline_3 == run_pipeline_3):
with dsl.Condition(run_pipeline_3 == 1):
pipeline_3()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a minimal example? If not, could we reduce this to the minimal example required to reproduce the problematic behavior? This will help us ensure we don't regress and will reduce the likelihood that the test is removed as redundant or unclear in the future.

Also, consider renaming the test method to reflect the behavior under test and, if needed, adding a docstring to describe in more detail.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be much better now, thanks for the push

@stijntratsaertit
Copy link
Author

/retest

item for sublist in component_refs for item in sublist
]
counted_refs = collections.Counter(all_component_refs)
self.assertEqual(1, max(counted_refs.values()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my local testing, this passes both before and after the changes. I also observe that the YAML is not different. Is it possible there is something missing from this test case?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad - went to harsh on cutting components to a minimal version.

@stijntratsaertit stijntratsaertit force-pushed the make-component-names-in-dag-more-unique branch 2 times, most recently from 8ce988e to 8f6834f Compare February 16, 2024 09:13
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@google-oss-prow google-oss-prow bot added size/XXL and removed size/M labels Feb 16, 2024
@stijntratsaertit stijntratsaertit force-pushed the make-component-names-in-dag-more-unique branch from 8f6834f to 294403f Compare February 16, 2024 09:18
@google-oss-prow google-oss-prow bot added size/M and removed size/XXL labels Feb 16, 2024
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from connor-mccarthy. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@stijntratsaertit
Copy link
Author

As I pulled master in to update the staleness of the PR, issues will show when attempting to fix the DCO check. What would be the correct approach to resolve this in my case?

@stijntratsaertit
Copy link
Author

/retest

Copy link

@stijntratsaertit: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
kubeflow-pipeline-frontend-test 8f6834f link true /test kubeflow-pipeline-frontend-test
kubeflow-pipeline-backend-test 8f6834f link true /test kubeflow-pipeline-backend-test
kubeflow-pipeline-mkp-test 8f6834f link true /test kubeflow-pipeline-mkp-test
kubeflow-pipelines-samples-v2 8f6834f link false /test kubeflow-pipelines-samples-v2
kubeflow-pipelines-backend-visualization 8f6834f link true /test kubeflow-pipelines-backend-visualization
kubeflow-pipeline-e2e-test 8f6834f link true /test kubeflow-pipeline-e2e-test
kubeflow-pipelines-components-google-cloud-python38 8f6834f link true /test kubeflow-pipelines-components-google-cloud-python38
kubeflow-pipeline-upgrade-test 8f6834f link true /test kubeflow-pipeline-upgrade-test
kubeflow-pipelines-manifests 8f6834f link true /test kubeflow-pipelines-manifests
kubeflow-pipeline-mkp-snapshot-test 8f6834f link true /test kubeflow-pipeline-mkp-snapshot-test
kubeflow-pipelines-sdk-execution-tests 294403f link true /test kubeflow-pipelines-sdk-execution-tests
kfp-kubernetes-execution-tests 294403f link false /test kfp-kubernetes-execution-tests

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants