readthedocs.org
readthedocs.org copied to clipboard
Build: cancel a build when a new one for the same branch/PR is triggered
Now that we implemented a way to revoke Celery tasks we are able to cancel a running build. This is useful for people to manually cancel a build they are not interested in finishing for different reasons and free up the concurrency limit they have.
There are some scenarios where we can handle this automatically because we already know that the running build is useless and can be canceled:
- a new commit was pushed to a branch
- a build for the same branch was triggered (do not confuse with "Duplicated Build")
- ...
Related #8850
that would be a really nice feature :)
This would help us over at https://github.com/xgcm/xgcm quite a bit. +1 👍
I think the SunPy and Astropy folks would love having this too :) @nabobalis @pllim
Astropy folks
I cannot speak for all of Astropy but personally I would love auto-cancel. Otherwise, sometimes when we get commit spam, RTD gives us a long queue.
Thanks for the ping, @astrojuanlu !
Yeah from the SunPy side, we waste so much of your CI time (with how we commit) and implementing this would help.
I try to cancel builds manually but I don't keep on top of this.
Also chiming in that this would be a welcome addition for our PRs at https://github.com/Ouranosinc/xclim
I went ahead and opened https://github.com/readthedocs/readthedocs.org/pull/9549 as a starting point. Let's see if we can have it reviewed and merged soon to start testing this new feature.
I'm targeting this feature to go out tomorrow. Once deployed, I will enable this feature on the following projects:
- xclim
- sunpy
- astropy
- xgcm
- poliastro
Let me know if there are other people subscribed to this issue that want to try this feature at this beta phase and I will enable it for their projects as well. Hopefully, after some feedback from you 🙏🏼 , we can enable it by default 👍🏼 . Thank you all!
This is currently deployed and all the projects listed in my previous comment have the feature enabled already. I quickly QAed this on production and it did work fine. Please, open an issue if you find something that's not working as you expected or contact support if you want to provide feedback to us! 💪🏼
It seems to be doing the job:

Thanks again for this!
Hello. I think it works but I keep forgetting to check. Can you please enable it for this also? This one has less contributors to keep track of and I think we push subsequent commits pretty frequently there, so it is easier for me to confirm. Thanks! 🙏
- https://github.com/spacetelescope/jdaviz
@pllim Thanks for your feedback. I enabled it on https://jdaviz.readthedocs.io/en/latest/ which I think is the Read the Docs project linked to that GH repository.
My main concern here is to not cancel valid builds. I mean, if we are not always cancelling a build that should be cancelled it's not a big problem. However, if we are cancelling a build that shouldn't be cancelled that's a problem.
In theory, this has been working fine since we enabled it. We haven't received any complain yet and the tests I've personally done did work. However, I suppose that projects doing many small pushes with one commit and multiple collaborators may have better feedback than myself.
Let me know if you think it works as you expected. Thanks again for your feedback.
BTW, we plan to enable it for all the projects in the following weeks if we don't receive any complain 😄
Haven't noticed any problems. Thanks again! 🙇♀️