#37063: PicklingError: Can't pickle Task
--------------------------------+-----------------------------------------
     Reporter:  Johannes Maron  |                     Type:  Uncategorized
       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:  1               |                    UI/UX:  0
--------------------------------+-----------------------------------------
 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
-- 
Ticket URL: <https://code.djangoproject.com/ticket/37063>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019dc02b9269-bc35f640-9fe1-40d0-b740-fa5903c97ed8-000000%40eu-central-1.amazonses.com.

Reply via email to