pyGSTi icon indicating copy to clipboard operation
pyGSTi copied to clipboard

Enable IBMQExperiment checkpointing

Open sserita opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe. It would be nice if it was possible to do a possible checkpointing of an IBMQExperiment.

Describe the solution you'd like The use case I'm imagining is that a notebook has generated an IBMQExperiment and submitted at least some of the jobs, but then the kernel dies. It should be able to save the state of the IBMQExperiment on each submit/poll for results. Even on notebook restart, it should be possible to interact with the existing jobs since we save the job ids.

sserita avatar Jun 20 '23 22:06 sserita

Environment: Windows 11, Python 3.10.11, PyGSTi 0.9.11.1

Issue: Attempting to write experiment results, the following error occurs and prevents writing:

Code: combined_exp.write("C:\Users\nemill\pyGSTi\nathan_scripts")

Error: TypeError Traceback (most recent call last) Cell In[30], line 1 ----> 1 combined_exp.write("C:\Users\nemill\pyGSTi\nathan_scripts")

File ~\pyGSTi\pygsti\extras\ibmq\ibmqcore.py:384, in IBMQExperiment.write(self, dirname) 382 for atr in _attribute_to_pickle: 383 with open(dirname + '/ibmqexperiment/{}.pkl'.format(atr), 'wb') as f: --> 384 _pickle.dump(self[atr], f)

TypeError: cannot pickle '_thread.lock' object

nemill avatar Jun 20 '23 23:06 nemill

TODO: Enable partial checkpointing to avoid big writes for large edesigns

sserita avatar Jul 26 '24 17:07 sserita