MCPcopy Create free account
hub / github.com/celery/celery / on_replace

Method on_replace

celery/app/task.py:1311–1327  ·  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

1309 """
1310
1311 def on_replace(self, sig):
1312 """Handler called when the task is replaced.
1313
1314 Must return super().on_replace(sig) when overriding to ensure the task replacement
1315 is properly handled.
1316
1317 .. versionadded:: 5.3
1318
1319 Arguments:
1320 sig (Signature): signature to replace with.
1321 """
1322 # Finally, either apply or delay the new signature!
1323 if self.request.is_eager:
1324 return sig.apply().get()
1325 else:
1326 sig.delay()
1327 raise Ignore('Replaced by new task')
1328
1329 def add_trail(self, result):
1330 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