Return true if task is aborted. Checks against the backend whether this :class:`AbortableAsyncResult` is :const:`ABORTED`. Always return :const:`False` in case the `task_id` parameter refers to a regular (non-abortable) :class:`Task`. Be aware that invoking
(self, **kwargs)
| 145 | return AbortableAsyncResult(task_id, backend=self.backend) |
| 146 | |
| 147 | def is_aborted(self, **kwargs): |
| 148 | """Return true if task is aborted. |
| 149 | |
| 150 | Checks against the backend whether this |
| 151 | :class:`AbortableAsyncResult` is :const:`ABORTED`. |
| 152 | |
| 153 | Always return :const:`False` in case the `task_id` parameter |
| 154 | refers to a regular (non-abortable) :class:`Task`. |
| 155 | |
| 156 | Be aware that invoking this method will cause a hit in the |
| 157 | backend (for example a database query), so find a good balance |
| 158 | between calling it regularly (for responsiveness), but not too |
| 159 | often (for performance). |
| 160 | """ |
| 161 | task_id = kwargs.get('task_id', self.request.id) |
| 162 | result = self.AsyncResult(task_id) |
| 163 | if not isinstance(result, AbortableAsyncResult): |
| 164 | return False |
| 165 | return result.is_aborted() |