Adding support to replaced_task_nesting in chains allows for overcoming a very specific use case.
Overall, what it does is set all of the tasks of the chain with the correct replaced_task_nesting level, if the canvas is built from a chain that contains a replaced task that is also a chain (in which case the DAG gets broken as two tasks can be each other's parents which this fix allows overcoming).

TODO:
Maybe add some example doc with enhanced explanation although it would require a bit of effort so I'll get to it at a later date.
Added support for replaced_task_nesting in chains. Adding support to replaced_task_nesting in chains allows for overcoming a very specific use case.
Overall, what it does is set all of the tasks of the chain with the correct replaced_task_nesting level, if the canvas is built from a chain that contains a replaced task that is also a chain (in which case the DAG gets broken as two tasks can be each other's parents which this fix allows overcoming).

TODO:
Maybe add some example doc with enhanced explanation although it would require a bit of effort so I'll get to it at a later date.
from celery import Celery

app = Celery('tasks', broker='amqp://')


@app.task()
def add(x, y):
    return x + y


if __name__ == '__main__':
    app.start()

from celery import Celery

app = Celery('tasks', broker='amqp://')


@app.task()
def add(x, y):
    return x + y


if __name__ == '__main__':
    app.start()
