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