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

job: add a persistence mechanism to local disk #77

Merged
merged 8 commits into from
Oct 5, 2023
Merged

Conversation

airwoodix
Copy link
Collaborator

@airwoodix airwoodix commented Sep 29, 2023

Summary

This patch adds the possibility to persist AQTJob handles to local disk. This should help writing more resilient Qiskit scripts.

Details and comments

The default storage is the user cache directory for the package, including its version. Since the storage should be relatively short lived, this is not a serious limitation for the end user and makes sure we can modify the storage model in backwards-incomaptible ways in future releases.

The serialization of Qiskit circuits is provided by qiskit.qpy. This is in principle only required for offline simulator jobs, but users may rely on having access to the job details (including the exact QuantumCircuits) from the job handle. This data cannot be faithfully reconstructed from the data served by the cloud portal.

The functionality has two caveats when handling jobs that run on offline simulators:

  1. the state of the offline simulators cannot be easily persisted, and would lead to an overly complex persistence format. Therefore, offline simulator jobs are re-submitted when restored, which leads to a new job_id and varying results for each call to AQTJob.restore. This surprising behavior is clearly indicated in the API reference and the user guide.
  2. for simplicity, restoring an offline simulator job with noise model enabled discards the noise model. The roots of this problem are the same as point 1, but will be worked around in a follow-up patch.

Breaking change: as part of refactoring the resource initializers, renamed OfflineSimulatorResource.noisy to OfflineSimulatorResource.with_noise_model. This addresses #72 (comment).

@airwoodix airwoodix self-assigned this Sep 29, 2023
@airwoodix airwoodix added documentation Improvements or additions to documentation enhancement New feature or request and removed documentation Improvements or additions to documentation labels Sep 29, 2023
@airwoodix airwoodix merged commit c97e3ee into master Oct 5, 2023
4 checks passed
@airwoodix airwoodix deleted the job-persistence branch October 5, 2023 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants