[Django] #36919: Allow `TaskResult` (and `Task`) to be pickled

0 views
Skip to first unread message

Django

unread,
Feb 11, 2026, 12:17:59 PM (3 days ago) Feb 11
to django-...@googlegroups.com
#36919: Allow `TaskResult` (and `Task`) to be pickled
-------------------------------------+-------------------------------------
Reporter: Jake Howard | Type:
| Cleanup/optimization
Status: new | Component: Tasks
Version: 6.0 | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
As part of implementing some task backends, it can be useful to pickle a
`TaskResult` to pass it around implementation.

Since it's a `dataclass` most of the implementation is already there - the
main issue is that `Task` itself can't be pickled as it references a
function. Replacing that with a string reference during pickling will
likely resolve the current issues.

The implementation isn't especially complex, so I'm not opposed to this
being closed and left to backend implementers to deal with instead.
--
Ticket URL: <https://code.djangoproject.com/ticket/36919>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 13, 2026, 9:36:18 AM (yesterday) Feb 13
to django-...@googlegroups.com
#36919: Allow `TaskResult` (and `Task`) to be pickled
-------------------------------------+-------------------------------------
Reporter: Jake Howard | Owner: (none)
Type: | Status: new
Cleanup/optimization |
Component: Tasks | Version: 6.0
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Vidhi Singh):

I’d like to investigate this further.

I’ll start by reproducing the pickling failure for Task and TaskResult on
the current main branch to better understand the exact limitations.

Before exploring an implementation, I’d appreciate clarification on
whether this is something Django core should support directly, or if the
expectation is that task backends handle serialization themselves.

I’ll report back with findings shortly.
--
Ticket URL: <https://code.djangoproject.com/ticket/36919#comment:1>
Reply all
Reply to author
Forward
0 new messages