'Replace this task, with a new task inheriting the task id.
.. versionadded:: 4.0
Arguments:
sig (~@Signature): signature to replace with.
Raises:
~@Ignore: This is always raised, so the best practice
is to always use ``raise self.replace(...)`` to convey
to the reader that the task won\'t continue after being replaced.'

def replace(self, sig):

    chord = self.request.chord
    if (u'chord' in sig.options):
        if chord:
            chord = (sig.options[u'chord'] | chord)
        else:
            chord = sig.options[u'chord']
    if isinstance(sig, group):
        sig |= self.app.tasks[u'celery.accumulate'].s(index=0).set(chord=chord, link=self.request.callbacks, link_error=self.request.errbacks)
        chord = None
    if self.request.chain:
        for t in reversed(self.request.chain):
            sig |= signature(t, app=self.app)
    sig.freeze(self.request.id, group_id=self.request.group, chord=chord, root_id=self.request.root_id)
    sig.delay()
    raise Ignore(u'Replaced    by    new    task')
