readthedocs.org icon indicating copy to clipboard operation
readthedocs.org copied to clipboard

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

Open humitos opened this issue 2 years ago • 5 comments

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

humitos avatar Feb 22 '22 15:02 humitos

that would be a really nice feature :)

aiwalter avatar Apr 10 '22 13:04 aiwalter

This would help us over at https://github.com/xgcm/xgcm quite a bit. +1 👍

jbusecke avatar Apr 20 '22 21:04 jbusecke

I think the SunPy and Astropy folks would love having this too :) @nabobalis @pllim

astrojuanlu avatar Jul 18 '22 14:07 astrojuanlu

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 !

pllim avatar Jul 18 '22 14:07 pllim

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.

nabobalis avatar Jul 18 '22 14:07 nabobalis

Also chiming in that this would be a welcome addition for our PRs at https://github.com/Ouranosinc/xclim

Zeitsperre avatar Aug 24 '22 22:08 Zeitsperre

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.

humitos avatar Aug 25 '22 10:08 humitos

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!

humitos avatar Aug 29 '22 17:08 humitos

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! 💪🏼

humitos avatar Aug 30 '22 16:08 humitos

It seems to be doing the job:

image

Thanks again for this!

Zeitsperre avatar Aug 30 '22 20:08 Zeitsperre

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 avatar Sep 16 '22 13:09 pllim

@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 😄

humitos avatar Sep 16 '22 13:09 humitos

Haven't noticed any problems. Thanks again! 🙇‍♀️

pllim avatar Oct 04 '22 13:10 pllim