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

de-dupe order and resource dependencies #5446

Merged
merged 1 commit into from
Sep 8, 2022

Conversation

pritidesai
Copy link
Member

@pritidesai pritidesai commented Sep 7, 2022

Changes

In case of a pipeline with a huge list of redundant dependencies, the list of dependencies is growing exponentially. This way of calculating the list of dependencies is causing extra delay in the validation cycle. This delay sometimes hit the webhook timeout during validation. This is one of the changes being proposed to make the validation cycle efficient and avoid unnecessary delay.

Introducing a test case which was running until a timeout was hit (without @rafalbigaj's changes in #5421). Thanks @rafalbigaj for the efficient implementation of building a graph. This test now runs to competition, on average taking 3 minutes. With the changes in this PR, this test runs under two seconds.

/kind bug

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs included if any changes are user facing
  • Has Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including
    functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings)
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

De-dupe task dependencies - order and resource dependencies all together. It's very common to have a task with multiple when expressions referring to the same task but different results. Maintain a set of dependencies and add only a new parent.

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. labels Sep 7, 2022
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 7, 2022
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1beta1/pipeline_types.go 97.0% 96.2% -0.7

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1beta1/pipeline_types.go 97.0% 96.8% -0.2

Copy link
Contributor

@rafalbigaj rafalbigaj left a comment

Choose a reason for hiding this comment

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

I like this simplification very much! Thanks for catching the next bottleneck 🙏

@abayer
Copy link
Contributor

abayer commented Sep 7, 2022

/retest
/approve

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abayer, rafalbigaj

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 7, 2022
@afrittoli
Copy link
Member

Thanks @pritidesai - could you apply the change to the v1 API as well?

In case of a pipeline with a huge list of redundant dependencies, the list is
growing exponentially. This way of calculating the list of dependencies is
causing extra delay in the validation cycle. This delay sometimes hit the
webhook timeout during validation. This is one of the changes being proposed to
make the validation cycle efficient and avoid unneccesary delay.
@pritidesai
Copy link
Member Author

thank you @afrittoli for pointing that out 👍 I have applied these changes to v1. Thanks!

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/pipeline_types.go 96.0% 95.7% -0.3
pkg/apis/pipeline/v1beta1/pipeline_types.go 97.0% 96.8% -0.2

@vdemeester
Copy link
Member

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 8, 2022
@tekton-robot tekton-robot merged commit 74aa8fe into tektoncd:main Sep 8, 2022
@afrittoli
Copy link
Member

Do we need to cherry-pick this one too? @pritidesai

@afrittoli afrittoli added the needs-cherry-pick Indicates a PR needs to be cherry-pick to a release branch label Sep 12, 2022
@pritidesai
Copy link
Member Author

/cherrypick release-v0.37.x

@pritidesai
Copy link
Member Author

/cherrypick release-v0.38.x

@pritidesai
Copy link
Member Author

/cherrypick release-v0.39.x

@tekton-robot
Copy link
Collaborator

@pritidesai: #5446 failed to apply on top of branch "release-v0.37.x":

Applying: de-dup order and resource dependencies
Using index info to reconstruct a base tree...
A	pkg/apis/pipeline/v1/pipeline_types.go
A	pkg/apis/pipeline/v1/pipeline_types_test.go
M	pkg/apis/pipeline/v1beta1/pipeline_types.go
M	pkg/apis/pipeline/v1beta1/pipeline_types_test.go
M	pkg/reconciler/pipelinerun/resources/pipelinerunstate_test.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/reconciler/pipelinerun/resources/pipelinerunstate_test.go
CONFLICT (content): Merge conflict in pkg/reconciler/pipelinerun/resources/pipelinerunstate_test.go
Auto-merging pkg/apis/pipeline/v1beta1/pipeline_types_test.go
CONFLICT (content): Merge conflict in pkg/apis/pipeline/v1beta1/pipeline_types_test.go
Auto-merging pkg/apis/pipeline/v1beta1/pipeline_types.go
CONFLICT (modify/delete): pkg/apis/pipeline/v1/pipeline_types_test.go deleted in HEAD and modified in de-dup order and resource dependencies. Version de-dup order and resource dependencies of pkg/apis/pipeline/v1/pipeline_types_test.go left in tree.
CONFLICT (modify/delete): pkg/apis/pipeline/v1/pipeline_types.go deleted in HEAD and modified in de-dup order and resource dependencies. Version de-dup order and resource dependencies of pkg/apis/pipeline/v1/pipeline_types.go left in tree.
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 de-dup order and resource dependencies
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherrypick release-v0.37.x

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.

@tekton-robot
Copy link
Collaborator

@pritidesai: #5446 failed to apply on top of branch "release-v0.38.x":

Applying: de-dup order and resource dependencies
Using index info to reconstruct a base tree...
A	pkg/apis/pipeline/v1/pipeline_types.go
A	pkg/apis/pipeline/v1/pipeline_types_test.go
M	pkg/apis/pipeline/v1beta1/pipeline_types.go
M	pkg/apis/pipeline/v1beta1/pipeline_types_test.go
M	pkg/reconciler/pipelinerun/resources/pipelinerunstate_test.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/reconciler/pipelinerun/resources/pipelinerunstate_test.go
CONFLICT (content): Merge conflict in pkg/reconciler/pipelinerun/resources/pipelinerunstate_test.go
Auto-merging pkg/apis/pipeline/v1beta1/pipeline_types_test.go
Auto-merging pkg/apis/pipeline/v1beta1/pipeline_types.go
CONFLICT (modify/delete): pkg/apis/pipeline/v1/pipeline_types_test.go deleted in HEAD and modified in de-dup order and resource dependencies. Version de-dup order and resource dependencies of pkg/apis/pipeline/v1/pipeline_types_test.go left in tree.
CONFLICT (modify/delete): pkg/apis/pipeline/v1/pipeline_types.go deleted in HEAD and modified in de-dup order and resource dependencies. Version de-dup order and resource dependencies of pkg/apis/pipeline/v1/pipeline_types.go left in tree.
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 de-dup order and resource dependencies
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherrypick release-v0.38.x

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.

@tekton-robot
Copy link
Collaborator

@pritidesai: #5446 failed to apply on top of branch "release-v0.39.x":

Applying: de-dup order and resource dependencies
Using index info to reconstruct a base tree...
M	pkg/apis/pipeline/v1/pipeline_types.go
M	pkg/apis/pipeline/v1/pipeline_types_test.go
M	pkg/apis/pipeline/v1beta1/pipeline_types.go
M	pkg/apis/pipeline/v1beta1/pipeline_types_test.go
M	pkg/reconciler/pipelinerun/resources/pipelinerunstate_test.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/reconciler/pipelinerun/resources/pipelinerunstate_test.go
CONFLICT (content): Merge conflict in pkg/reconciler/pipelinerun/resources/pipelinerunstate_test.go
Auto-merging pkg/apis/pipeline/v1beta1/pipeline_types_test.go
Auto-merging pkg/apis/pipeline/v1beta1/pipeline_types.go
Auto-merging pkg/apis/pipeline/v1/pipeline_types_test.go
CONFLICT (content): Merge conflict in pkg/apis/pipeline/v1/pipeline_types_test.go
Auto-merging pkg/apis/pipeline/v1/pipeline_types.go
CONFLICT (content): Merge conflict in pkg/apis/pipeline/v1/pipeline_types.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 de-dup order and resource dependencies
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherrypick release-v0.39.x

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. needs-cherry-pick Indicates a PR needs to be cherry-pick to a release branch release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants