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)
| 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: |