MCPcopy
hub / github.com/celery/celery / on_replace

Method on_replace

celery/app/task.py:1131–1147  ·  view source on GitHub ↗

Handler called when the task is replaced. Must return super().on_replace(sig) when overriding to ensure the task replacement is properly handled. .. versionadded:: 5.3 Arguments: sig (Signature): signature to replace with.

(self, sig)

Source from the content-addressed store, hash-verified

1129 """
1130
1131 def on_replace(self, sig):
1132 """Handler called when the task is replaced.
1133
1134 Must return super().on_replace(sig) when overriding to ensure the task replacement
1135 is properly handled.
1136
1137 .. versionadded:: 5.3
1138
1139 Arguments:
1140 sig (Signature): signature to replace with.
1141 """
1142 # Finally, either apply or delay the new signature!
1143 if self.request.is_eager:
1144 return sig.apply().get()
1145 else:
1146 sig.delay()
1147 raise Ignore('Replaced by new task')
1148
1149 def add_trail(self, result):
1150 if self.trail:

Callers 1

replaceMethod · 0.95

Calls 4

IgnoreClass · 0.90
getMethod · 0.45
applyMethod · 0.45
delayMethod · 0.45

Tested by

no test coverage detected