0

As I see in celery, It can get number of tasks for a worker, that can run them at a same time.

I need run a task and set number of tasks can run simultaneously with this task.

celery with workers

Therefore, If I set this number to 2 and this task send to worker with 10 threads, worker can run just one another task.

1 Answer 1

1

Worker will reserve tasks for each worker's tread. If you want to limit the number of tasks worker can execute the same time, you should configure your concurrency (e.g. to limit 1 task at the time, you need worker with 1 process -c 1).

You can also check prefetch configuration, but it only defines the number of tasks reserved for each process of the worker.

Here is Celery documentation where prefetch configuration explained: http://celery.readthedocs.org/en/latest/userguide/optimizing.html

Sign up to request clarification or add additional context in comments.

2 Comments

Is there any way to dynamic change number of worker process?
You can start/stop additional workers any time you want. Also it might be possible to change worker's pool to increase/decrease the number of processes for the particular worker, but I can answer how it's better to do. You can refer to this question, maybe it will be helpful: stackoverflow.com/questions/6956272/… Also Celery documentation on workers: celery.readthedocs.org/en/latest/userguide/workers.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.