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

Build: cancel old builds #9549

Merged
merged 7 commits into from
Aug 29, 2022
Merged

Build: cancel old builds #9549

merged 7 commits into from
Aug 29, 2022

Conversation

humitos
Copy link
Member

@humitos humitos commented Aug 25, 2022

NOTE: I split the work in different commits to make it easier to review.

This PR implements a simple logic to cancel old running builds when a new
build for the same project/version arrives:

  1. look for running builds for the same project/version
  2. if there are any, it cancels them all one by one via Celery's revoke method
  3. trigger a new build for the current commit received

Note that this new feature is behind a feature flag (CANCEL_OLD_BUILDS) for
now so we can start testing it on some projects that have shown their interest
on this feature.

The current behavior for DEDUPLICATE_BUILDS will be replaced by this new logic
in the future. However, it was not removed in this commit since it's still
useful for projects that won't be using the new feature flag yet.

Closes #8961


📚 Documentation previews 📚

Wrap the code that cancels a build and move it the module where `trigger_build`
and other related helpers are.
This commit implements a simple logic to cancel old running builds when a new
build for the same project/version arrives:

1. look for running builds for the same project/version
2. if there are any, it cancels them all one by one via Celery's revoke method
3. trigger a new build for the current commit received

Note that this new feature is behind a feature flag (`CANCEL_OLD_BUILDS`) for
now so we can start testing it on some projects that have shown their interest
on this feature.

The current behavior for `DEDUPLICATE_BUILDS` will be replaced by this new logic
in the future. However, it was not removed in this commit since it's still
useful for projects that won't be using the new feature flag yet.

Closes #8961
@humitos
Copy link
Member Author

humitos commented Aug 25, 2022

I've been experiencing with this locally and the experience as a user is great 💯 .

  • I trigger a build for latest
  • it starts running
  • I do some changes on my code
  • I trigger another build for latest
  • the previous build got cancelled
  • the new build with the new code starts building 🥳

I don't have to wait for the old build to finish and show me outdated documentation 💪🏼

readthedocs/core/utils/__init__.py Outdated Show resolved Hide resolved
readthedocs/core/utils/__init__.py Outdated Show resolved Hide resolved
readthedocs/core/utils/__init__.py Outdated Show resolved Hide resolved
Co-authored-by: Santos Gallegos <stsewd@protonmail.com>
@humitos humitos enabled auto-merge (squash) August 29, 2022 17:10
@humitos humitos merged commit 30545b7 into main Aug 29, 2022
@humitos humitos deleted the humitos/cancel-old-builds branch August 29, 2022 17:21
humitos added a commit that referenced this pull request Sep 8, 2022
With the introduction of `CANCEL_OLD_BUILDS` we are moving away from the
`DEDUPLICATE_BUILDS` feature since these scenario is managed in a better way by
the new feature.

Closes #7306
Related #9549
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Build: cancel a build when a new one for the same branch/PR is triggered
2 participants