I have a celery task that launches three other celery tasks. I want these tasks to execute asynchronously and wait for them to finish before i resume the parent task. However the child tasks are running synchronosly and I don't know why. The problem started when I upgraded celery from 4.4.7 to 5.0.0
app_celery.py
@app.task(name="app_celery.scraping_process", soft_time_limit=900, time_limit=960, max_retries=3)
def scraping_process():
sources = ["a", "b", "c"]
job = group((company_representation.s(src) for src in sources))
result = job.apply_async(queue="spiders", routing_key="spiders")
while not result.ready():
time.sleep(5)
@app.task(name="app_celery.company_representation", max_retries=3)
def company_representation(source: str):
# do something
time.sleep(60)
I am running celery like this:
celery -A app_celery worker -c 8 -Q spiders -n spiders@%%h
celery -A app_celery worker -c 2 -Q companies -n companies@%%h --without-mingle --without-heartbeat -Ofair
celery==5.0.0