Django Celery Group tasks executing only the first task

。_饼干妹妹 提交于 2021-01-27 08:53:05

问题


I have celery which has different tasks and has one queue.These tasks are not however all called at once depending on the request from the user the tasks called vary. So i have written a code that identifies which tasks to run and creates subtasks with parameters and create a list of them.Add this list to group and use apply_async() on the group to run these tasks.

The code for calling the tasks is as follows:

tasks_list = []
for provider_name in params['providers']:
    provider = Provider.objects.get(name=provider_name)

    #getting different tasks depending on the provider, each provider has it's own task
    provider_api = provider.api_client()
    for pid in pids:
        sub_params['pid'] = pid
        tasks_list.append(provider_api.subtask((provider.id, action, params), sub_params))

job = group(tasks_list)
result = job.apply_async().join()

The issue is that only first task from the list gets executed in the celery and hangs.can any one suggest to me why only the first task is executed and the rest doesn't.

来源:https://stackoverflow.com/questions/51299860/django-celery-group-tasks-executing-only-the-first-task

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!