Skip to content

Commit

Permalink
Declare babysit tasks celery queue in a different way (#2365)
Browse files Browse the repository at this point in the history
Declare babysit tasks celery queue in a different way

send_task  should have the same options as apply_async,
nevertheless passing queue as an option is not working.
Probably because the referenced queues have to be defined in task_queues.
Instead of defining task_queues let define explicitly the routes.

Reviewed-by: Laura Barcziová
  • Loading branch information
2 parents 01dc472 + 2d07aaf commit d7cd014
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
6 changes: 6 additions & 0 deletions packit_service/celery_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std-setting-task_default_queue
task_default_queue = packit_service.constants.CELERY_TASK_DEFAULT_QUEUE


task_routes = [
("task.babysit_vm_image_build", {"queue": "short-running"}),
("task.babysit_copr_build", {"queue": "short-running"}),
]

# https://docs.celeryq.dev/en/stable/userguide/periodic-tasks.html
beat_schedule = {
"update-pending-copr-builds": {
Expand Down
1 change: 0 additions & 1 deletion packit_service/worker/handlers/vm_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ def run(self) -> TaskResults:
"task.babysit_vm_image_build",
args=(image_id,),
countdown=10, # do the first check in 10s
queue="long-running",
)

self.report_status(VMImageBuildStatus.pending, "")
Expand Down
1 change: 0 additions & 1 deletion packit_service/worker/helpers/build/copr_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,6 @@ def handle_rpm_build_start(
"task.babysit_copr_build",
args=(build_id,),
countdown=120, # do the first check in 120s
queue="long-running",
)

def _visualize_chroots_diff(
Expand Down

0 comments on commit d7cd014

Please sign in to comment.