Celery --pool=threads -- what does this do and how do I use it properly?

Viewed 7747

I'm hitting a segfault error while running a task using Celery. After looking up the issue, it seems others are solving similar issues by starting celery with --pool=threads.

When I try passing --pool=threads I get ModuleNotFoundError: No module named 'threads'

I don't believe this is the same as the thread module which would throw the error of No module named 'thread' instead.

How do I start using threads and what does it do?

The documentation regarding --pool=threads in the Celery site is very sparse. Searching for "--pool" will return nothing substantial, other than things related to billiard

2 Answers

Just-released Celery 4.4.0 adds --pool thread to the concurrency list.

You can read more at Celery 4.4 Changelogs:

Threaded Tasks Pool

We reintroduced a threaded task pool using concurrent.futures.ThreadPoolExecutor.

The previous threaded task pool was experimental. In addition it was based on the threadpool package which is obsolete.

You can use the new threaded task pool by setting worker_pool to ‘threads` or by passing –pool threads to the celery worker command.

Now you can use threads instead of processes for pooling.

celery worker -A your_application --pool threads --loginfo=INFO
Related