| 768 | |
| 769 | |
| 770 | def fast_trace_task(task, uuid, request, body, content_type, |
| 771 | content_encoding, loads=loads_message, _loc=None, |
| 772 | hostname=None, **_): |
| 773 | _loc = _localized if not _loc else _loc |
| 774 | embed = None |
| 775 | try: |
| 776 | tasks, accept, hostname = _loc |
| 777 | except ValueError: |
| 778 | raise RuntimeError( |
| 779 | "fast_trace_task: worker task registry is empty " |
| 780 | "(`_loc` was not populated). This normally means " |
| 781 | "`setup_worker_optimizations()` never ran in this " |
| 782 | "process, which happens when the process was spawned " |
| 783 | "rather than forked (e.g. the default prefork pool on " |
| 784 | "Windows). Try `--pool=solo` or " |
| 785 | "`--pool=threads`, or ensure `use_fast_trace_task` is " |
| 786 | "not enabled for this pool type." |
| 787 | ) from None |
| 788 | if content_type: |
| 789 | args, kwargs, embed = loads( |
| 790 | body, content_type, content_encoding, accept=accept, |
| 791 | ) |
| 792 | else: |
| 793 | args, kwargs, embed = body |
| 794 | request.update({ |
| 795 | 'args': args, 'kwargs': kwargs, |
| 796 | 'hostname': hostname, 'is_eager': False, |
| 797 | }, **embed or {}) |
| 798 | R, I, T, Rstr = tasks[task].__trace__( |
| 799 | uuid, args, kwargs, request, |
| 800 | ) |
| 801 | return (1, R, T) if I else (0, Rstr, T) |
| 802 | |
| 803 | |
| 804 | def report_internal_error(task, exc): |