This method prepends the global keyprefix to the existing keyprefixes. This method checks if a global keyprefix is configured in `result_backend_transport_options` using the `global_keyprefix` key. If so, then it is prepended to the task, group and chord key prefixes.
(self)
| 940 | self.apply_chord = self._apply_chord_incr |
| 941 | |
| 942 | def _add_global_keyprefix(self): |
| 943 | """ |
| 944 | This method prepends the global keyprefix to the existing keyprefixes. |
| 945 | |
| 946 | This method checks if a global keyprefix is configured in `result_backend_transport_options` using the |
| 947 | `global_keyprefix` key. If so, then it is prepended to the task, group and chord key prefixes. |
| 948 | """ |
| 949 | global_keyprefix = self.app.conf.get('result_backend_transport_options', {}).get("global_keyprefix", None) |
| 950 | if global_keyprefix: |
| 951 | if global_keyprefix[-1] not in ':_-.': |
| 952 | global_keyprefix += '_' |
| 953 | self.task_keyprefix = f"{global_keyprefix}{self.task_keyprefix}" |
| 954 | self.group_keyprefix = f"{global_keyprefix}{self.group_keyprefix}" |
| 955 | self.chord_keyprefix = f"{global_keyprefix}{self.chord_keyprefix}" |
| 956 | |
| 957 | def _encode_prefixes(self): |
| 958 | self.task_keyprefix = self.key_t(self.task_keyprefix) |