| 403 | return backend.fail_from_current_stack(group_callback.id, exc=exc) |
| 404 | |
| 405 | def fail_from_current_stack(self, task_id, exc=None): |
| 406 | type_, real_exc, tb = sys.exc_info() |
| 407 | try: |
| 408 | exc = real_exc if exc is None else exc |
| 409 | exception_info = ExceptionInfo((type_, exc, tb)) |
| 410 | self.mark_as_failure(task_id, exc, exception_info.traceback) |
| 411 | return exception_info |
| 412 | finally: |
| 413 | while tb is not None: |
| 414 | try: |
| 415 | tb.tb_frame.clear() |
| 416 | tb.tb_frame.f_locals |
| 417 | except RuntimeError: |
| 418 | # Ignore the exception raised if the frame is still executing. |
| 419 | pass |
| 420 | tb = tb.tb_next |
| 421 | |
| 422 | del tb |
| 423 | |
| 424 | def prepare_exception(self, exc, serializer=None): |
| 425 | """Prepare exception for serialization.""" |