问题
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