MCPcopy
hub / github.com/celery/celery / unchain_tasks

Method unchain_tasks

celery/canvas.py:1014–1031  ·  view source on GitHub ↗

Return a list of tasks in the chain. The tasks list would be cloned from the chain's tasks. All of the chain callbacks would be added to the last task in the (cloned) chain. All of the tasks would be linked to the same error callback as the chain itself, to ensure th

(self)

Source from the content-addressed store, hash-verified

1012 return signature
1013
1014 def unchain_tasks(self):
1015 """Return a list of tasks in the chain.
1016
1017 The tasks list would be cloned from the chain's tasks.
1018 All of the chain callbacks would be added to the last task in the (cloned) chain.
1019 All of the tasks would be linked to the same error callback
1020 as the chain itself, to ensure that the correct error callback is called
1021 if any of the (cloned) tasks of the chain fail.
1022 """
1023 # Clone chain's tasks assigning signatures from link_error
1024 # to each task and adding the chain's links to the last task.
1025 tasks = [t.clone() for t in self.tasks]
1026 for sig in maybe_list(self.options.get('link')) or []:
1027 tasks[-1].link(sig)
1028 for sig in maybe_list(self.options.get('link_error')) or []:
1029 for task in tasks:
1030 task.link_error(sig)
1031 return tasks
1032
1033 def apply_async(self, args=None, kwargs=None, **options):
1034 # python is best at unpacking kwargs, so .run is here to do that.

Callers 2

__or__Method · 0.95
__or__Method · 0.80

Calls 5

maybe_listFunction · 0.85
cloneMethod · 0.45
getMethod · 0.45
linkMethod · 0.45
link_errorMethod · 0.45

Tested by

no test coverage detected