[GRASS-dev] [GRASS GIS] #3799: Python 3 Error using MultiModule and ParallelModuleQueue

#3799: Python 3 Error using MultiModule and ParallelModuleQueue
-------------------------+-------------------------
Reporter: AnikaBettge | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.6.1
Component: Default | Version: svn-trunk
Keywords: python3 | CPU: Unspecified
Platform: Linux |
-------------------------+-------------------------
I tested the examples on
https://grass.osgeo.org/grass77/manuals/libpython/pygrass.modules.interface.html?highlight=parallelmodulequeue#pygrass.modules.interface.module.ParallelModuleQueue
with Python 3.6.7.

The example "Check MultiModule approach with three by two processes
running in a background process" leads to

{{{
...

Traceback (most recent call last):
   File "/usr/lib/python3.6/multiprocessing/queues.py", line 235, in _feed
     obj = _ForkingPickler.dumps(obj)
   File "/usr/lib/python3.6/multiprocessing/reduction.py", line 52, in
dumps
     cls(buf, protocol).dump(obj)
TypeError: can't pickle _thread.lock objects

...

}}}

The same error appears in the MultiModule example "Asynchronous module
run, setting finish = False and using temporary region".

Using python 2.7.15rc1 all works fine.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3799&gt;
GRASS GIS <https://grass.osgeo.org>

#3799: Python 3 Error using MultiModule and ParallelModuleQueue
--------------------------+-------------------------
  Reporter: AnikaBettge | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.6.2
Component: Default | Version: svn-trunk
Resolution: | Keywords: python3
       CPU: Unspecified | Platform: Linux
--------------------------+-------------------------

Comment (by neteler):

Does the suggestion here apply?

https://stackoverflow.com/questions/44144584/typeerror-cant-pickle-thread-
lock-objects

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3799#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>

#3799: Python 3 Error using MultiModule and ParallelModuleQueue
--------------------------+-------------------------
  Reporter: AnikaBettge | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.6.2
Component: Default | Version: svn-trunk
Resolution: | Keywords: python3
       CPU: Unspecified | Platform: Linux
--------------------------+-------------------------
Changes (by neteler):

* Attachment "test_multimodule.py" added.

Python test script

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3799&gt;
GRASS GIS <https://grass.osgeo.org>

#3799: Python 3 Error using MultiModule and ParallelModuleQueue
--------------------------+----------------------------------
  Reporter: AnikaBettge | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.8.3
Component: Python | Version: git-releasebranch78
Resolution: | Keywords: python3, multimodule
       CPU: Unspecified | Platform: Linux
--------------------------+----------------------------------
Changes (by neteler):

* keywords: python3 => python3, multimodule
* version: svn-trunk => git-releasebranch78
* component: Default => Python
* milestone: 7.6.2 => 7.8.3

Comment:

Still broken... (test script attached):

{{{
GRASS 7.8.2dev (nc_spm_08):~ > python3 test_multimodule.py
projection: 99 (Lambert Conformal Conic)
zone: 0
datum: nad83
ellipsoid: a=6378137 es=0.006694380022900787
north: 228500
south: 215000
west: 630000
east: 645000
nsres: 10
ewres: 10
rows: 1350
cols: 1500
cells: 2025000
projection: 99 (Lambert Conformal Conic)
zone: 0
datum: nad83
ellipsoid: a=6378137 es=0.006694380022900787
north: 228500
south: 215000
west: 630000
east: 645000
nsres: 10
ewres: 10
rows: 1350
cols: 1500
cells: 2025000
projection: 99 (Lambert Conformal Conic)
zone: 0
datum: nad83
ellipsoid: a=6378137 es=0.006694380022900787
north: 228500
south: 215000
west: 630000
east: 645000
nsres: 10
ewres: 10
rows: 1350
cols: 1500
cells: 2025000
  100%
Traceback (most recent call last):
   File "/usr/lib64/python3.7/multiprocessing/queues.py", line 236, in
_feed
     obj = _ForkingPickler.dumps(obj)
   File "/usr/lib64/python3.7/multiprocessing/reduction.py", line 51, in
dumps
     cls(buf, protocol).dump(obj)
TypeError: can't pickle _thread.lock objects
  100%
  100%
Traceback (most recent call last):
   File "/usr/lib64/python3.7/multiprocessing/queues.py", line 236, in
_feed
     obj = _ForkingPickler.dumps(obj)
   File "/usr/lib64/python3.7/multiprocessing/reduction.py", line 51, in
dumps
     cls(buf, protocol).dump(obj)
TypeError: can't pickle _thread.lock objects
Traceback (most recent call last):
   File "/usr/lib64/python3.7/multiprocessing/queues.py", line 236, in
_feed
     obj = _ForkingPickler.dumps(obj)
   File "/usr/lib64/python3.7/multiprocessing/reduction.py", line 51, in
dumps
     cls(buf, protocol).dump(obj)
TypeError: can't pickle _thread.lock objects
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3799#comment:3&gt;
GRASS GIS <https://grass.osgeo.org>