﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
37063	PicklingError: Can't pickle Task	Johannes Maron		"Hi there,

I am working on Django tasks executor and noticed that the current implementation has a few oddities and bugs that we might want to address in future releases.

For now, let's focus on the biggest one, Tasks, and therefore TasksResults can't be pickled.
However, it is essential to use multiprocessing and to utilize the entire CPU to execute tasks.

{{{
Traceback (most recent call last):
  File ""<console>"", line 1, in <module>
  File ""$HOME/.local/share/uv/python/cpython-3.14.0-macos-aarch64-none/lib/python3.14/multiprocessing/reduction.py"", line 51, in dumps
    cls(buf, protocol).dump(obj)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^
_pickle.PicklingError: Can't pickle <function cpu_heavy_task at 0x10986eae0>: it's not the same object as tests.testapp.tasks.cpu_heavy_task
}}}

Of course, you can serialize and deserialize objects yourself, but that's a pretty high bar to clear.
Especially since it's a fairly easy fix for Django.

Cheers!
Joe
"	New feature	closed	Tasks	6.0	Normal	duplicate		Johannes Maron	Unreviewed	0	0	0	0	0	0
