Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiprocessing: Serialization with Pickle #69

Closed
JSchnepp opened this issue Mar 5, 2020 · 2 comments · Fixed by #70
Closed

Multiprocessing: Serialization with Pickle #69

JSchnepp opened this issue Mar 5, 2020 · 2 comments · Fixed by #70
Labels
bug Something isn't working
Milestone

Comments

@JSchnepp
Copy link

JSchnepp commented Mar 5, 2020

Hi all,

I find it interesting that so far no one has a problem with serialization in multiprocessing using Pickle. After initialization in the following lines

   "" "
  Start writer as a new process
  "" "
 writer = InfluxDBWriter (queue_)

"writer" is started

 writer.start ()

and InfluxDBWriter must be serialized for pipe transfer. The following error message occurs:

File "/Users/joerg/miniconda3/envs/influx/lib/python3.8/multiprocessing/reduction.py", line 60, in dump
ForkingPickler (file, protocol) .dump (obj)
AttributeError: Can't pickle local object 'PoolManager .__ init__. . '

This error is triggered by the line >>>>:
def init __ (self, queue):
Process .
init __ (self)
self.queue = queue

self.client = InfluxDBClient (url = 'http: // localhost: 9999',
token = "my_token", org = "my_org", debug = False)

Hardware: MacBook Pro, OS: Catalina
Python: 3.8.1
pypi: 2.1
influxdb-client: 1.4.0

@bednar
Copy link
Contributor

bednar commented Mar 5, 2020

Hi @JSchnepp,

Thanks for reporting a problem.

It's probably caused by not serializing:

self.pool_manager = urllib3.PoolManager(
on
class RESTResponse(io.IOBase):

We will fix it asap.

Regards

@bednar bednar added this to the 1.6.0 milestone Mar 5, 2020
@bednar bednar added the bug Something isn't working label Mar 5, 2020
@bednar bednar modified the milestones: 1.6.0, 1.5.0 Mar 5, 2020
@bednar
Copy link
Contributor

bednar commented Mar 6, 2020

Hi @JSchnepp,

I prepared fixed version in a branch fix/pickle.

If you would like to test it then install client via:

pip install git+https://github.com/influxdata/influxdb-client-python.git@fix/pickle

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants