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

Use a custom Task Router to route tasks dynamically #6849

merged 11 commits into from Apr 16, 2020


Copy link

@humitos humitos commented Apr 2, 2020

This PR is an example using a Celery Task Router (under a Feature flag for now) to route tasks based on some project properties and queue's length. I think this could help us to get the most of the build:default queue without loosing performance on projects that don't really fit there and "auto-scale" projects to a bigger server when building time is getting closer to the limit.

The logic behind this, is that it will route the task to build:large in any of these cases:

  1. the project is using conda
  2. new project with less than N successful builds
  3. last N successful builds have a high time average

(it ignores projects that have already set build_queue attribute)

These are just three examples that I thought could be useful, but we can discuss them and add others.

I tested it with our current Docker Compose setup and I does the routing properly.

@humitos humitos requested a review from Apr 2, 2020
readthedocs/builds/ Show resolved Hide resolved
readthedocs/builds/ Outdated Show resolved Hide resolved
@humitos humitos requested a review from stsewd Apr 2, 2020
Copy link

@ericholscher ericholscher left a comment

We should standardize on one way to return the deafult queue. I prefer returning None, and letting Celery handle it, since it reduces our logic.

readthedocs/builds/ Outdated Show resolved Hide resolved
readthedocs/builds/ Outdated Show resolved Hide resolved
Copy link

ericholscher commented Apr 16, 2020

I'm 👍 on merging & shipping this once tests are fixed.

@ericholscher ericholscher merged commit 8ec4071 into master Apr 16, 2020
2 checks passed
@ericholscher ericholscher deleted the humitos/task-routing branch Apr 16, 2020
@humitos humitos mentioned this pull request Apr 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

3 participants