Skip to content

chord does nothing when the header is an empty list #4333

Description

@xavierhardy

Checklist

  • [ x ] I have included the output of celery -A proj report in the issue.
    (if you are not able to do this, then at least specify the Celery
    version affected).
    Affected version: 4.1.0

  • [ x ] I have verified that the issue exists against the master branch of Celery.

Steps to reproduce

Initiate the Celery configuration, and run the following code.

@celery.task()
def add(a, b):
    return sum(a) + b

print(chord([], add.s(3)).apply_async().get())

Expected behavior

Does not wait, executes the callback task, prints 3.

Actual behavior

Does nothing, the get call is stuck forever. I do not know if it's a bug, or a non-feature, but it should be at least documented. The use case behind this is we generate a list dynamically using Python's list comprehension [my_task.s(i) for i in range(n)], the list is potentially empty.

Another thing is the fact that the response sent to the callback is a list only if there is more than one element in the list is also counter intuitive and should be at best overridable.

http://docs.celeryproject.org/en/latest/userguide/canvas.html#chords

Thanks a lot in advance

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions