| 585 | return backend.fail_from_current_stack(group_callback.id, exc=exc) |
| 586 | |
| 587 | def fail_from_current_stack(self, task_id, exc=None): |
| 588 | type_, real_exc, tb = sys.exc_info() |
| 589 | try: |
| 590 | exc = real_exc if exc is None else exc |
| 591 | exception_info = ExceptionInfo((type_, exc, tb)) |
| 592 | self.mark_as_failure(task_id, exc, exception_info.traceback) |
| 593 | return exception_info |
| 594 | finally: |
| 595 | while tb is not None: |
| 596 | try: |
| 597 | tb.tb_frame.clear() |
| 598 | tb.tb_frame.f_locals |
| 599 | except RuntimeError: |
| 600 | # Ignore the exception raised if the frame is still executing. |
| 601 | pass |
| 602 | tb = tb.tb_next |
| 603 | |
| 604 | del tb |
| 605 | |
| 606 | def prepare_exception(self, exc, serializer=None): |
| 607 | """Prepare exception for serialization.""" |