How to make Celery worker consume single task and exit

Viewed 587

How do I make the celery -A app worker command to consume only a single task and then exit.

I want to run celery workers as a kubernetes Job that finishes after handling a single task.

I'm using KEDA for autoscaling workers according to queue messages. I want to run celery workers as jobs for long running tasks, as suggested in the documentation: KEDA long running execution

1 Answers

There's not really anything specific for this. You would have to hack in your own driver program, probably via a custom concurrency module. Are you trying to use Keda ScaledJobs or something? You would just use a ScaledObject instead.

Related