dwave-system
dwave-system copied to clipboard
Make DWaveSampler picklable
DWaveSampler is not picklable. It should be in order to integrate for example with sklearn.
In [1]: from dwave.system.samplers import DWaveSampler
In [2]: import pickle
In [3]: annealer = DWaveSampler()
In [4]: pickle.dumps(annealer)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-4-bef1022bace0> in <module>()
----> 1 pickle.dumps(annealer)
TypeError: can't pickle _thread.lock objects
This basically translates to making dwave.cloud.Client
picklable (in dwave-cloud-client
package). Currently it isn't by default, because thread pools and mutexes would have to be recreated manually.
Can you show here the exact example that requires the DWaveSampler
to be picklable? Thanks.