Skip to content

Nested workflows execute out of order (aka chaining groups together doesn't work properly) #1214

Closed

Description

@w-

I have a scenario where i need to do a variation of what is described here
#1120 (comment)
i've created a new issue because that comment is for a different issue and is 3 months old.

group1 = group(task1.si(), task1.si(), task1.si())
group2 = group(task2.si(), task2.si(), task2.si())

workflow = chain(group1, group2, task3.si())

In this example, the intuitive interpretation is that task3 should only execute after all tasks in group 2 have finished. In reality, task 3 executes while group2 has started but hasn't completed yet.

Is there a different way to accomplish this?

Activity

  1. w- commented on Feb 28, 2013

    @w-
    ContributorAuthor

    As it turns out,
    you cannot chain groups together directly. but you can work around this by introducing a dummy subtask in between.
    i.e.

    group1 = group(task1.si(), task1.si(), task1.si())
    group2 = group(task2.si(), task2.si(), task2.si())
    
    workflow = chain(group1, dummy_task.si(), group2, task3.si())

    will work as expected

    suspected explanation here:
    http://stackoverflow.com/a/15147171/167674

  2. ask commented on Mar 4, 2013

    @ask
    Contributor

    Does using a group as the chord callback work? That's what should happen here, so maybe this is a bug after all

  3. zhxgigi commented on Apr 1, 2013

    @zhxgigi

    it seems this issue also in celery 3.0.17, for now we just use the @w- 's solution, but I think this is not the graceful way to do this, by using chain([group]) is a very straightforward usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions