Add signature to the chord the current task is a member of. .. versionadded:: 4.0 Currently only supported by the Redis result backend. Arguments: sig (Signature): Signature to extend chord with. lazy (bool): If enabled the new task won't actually b
(self, sig, lazy=False)
| 1015 | return self.on_replace(sig) |
| 1016 | |
| 1017 | def add_to_chord(self, sig, lazy=False): |
| 1018 | """Add signature to the chord the current task is a member of. |
| 1019 | |
| 1020 | .. versionadded:: 4.0 |
| 1021 | |
| 1022 | Currently only supported by the Redis result backend. |
| 1023 | |
| 1024 | Arguments: |
| 1025 | sig (Signature): Signature to extend chord with. |
| 1026 | lazy (bool): If enabled the new task won't actually be called, |
| 1027 | and ``sig.delay()`` must be called manually. |
| 1028 | """ |
| 1029 | if not self.request.chord: |
| 1030 | raise ValueError('Current task is not member of any chord') |
| 1031 | sig.set( |
| 1032 | group_id=self.request.group, |
| 1033 | group_index=self.request.group_index, |
| 1034 | chord=self.request.chord, |
| 1035 | root_id=self.request.root_id, |
| 1036 | ) |
| 1037 | result = sig.freeze() |
| 1038 | self.backend.add_to_chord(self.request.group, result) |
| 1039 | return sig.delay() if not lazy else sig |
| 1040 | |
| 1041 | def update_state(self, task_id=None, state=None, meta=None, **kwargs): |
| 1042 | """Update task state. |