AQTJob#

class qiskit_aqt_provider.aqt_job.AQTJob[source]#

Handle for quantum circuits jobs running on AQT cloud backends.

Jobs contain one or more quantum circuits that are executed with a common set of options (see AQTOptions).

Job handles should be retrieved from calls to AQTResource.run, which immediately returns after submitting the job. The result() method allows blocking until a job completes:

>>> import qiskit
>>> from qiskit.providers import JobStatus
>>> from qiskit_aqt_provider import AQTProvider
>>>
>>> backend = AQTProvider("").get_backend("offline_simulator_no_noise")
>>>
>>> qc = qiskit.QuantumCircuit(1)
>>> _ = qc.rx(3.14, 0)
>>> _ = qc.measure_all()
>>> qc = qiskit.transpile(qc, backend)
>>>
>>> job = backend.run(qc, shots=100)
>>> result = job.result()
>>> job.status() is JobStatus.DONE
True
>>> result.success
True
>>> result.get_counts()
{'1': 100}
property error_message: str | None#

Error message for this job (if any).

persist(*, store_path: Path | None = None) Path[source]#

Save this job to local persistent storage.

Warning

Only jobs that have been submitted for execution can be persisted (a valid job_id is required).

Parameters:

store_path – local persistent storage directory. By default, use a standard cache directory.

Returns:

The path to the job data in local persistent storage.

Raises:

RuntimeError – the job was never submitted for execution.

progress() Progress[source]#

Progress information for this job.

classmethod restore(job_id: str, *, access_token: str | None = None, store_path: Path | None = None, remove_from_store: bool = True) Self[source]#

Restore a job handle from local persistent storage.

Warning

The default local storage path depends on the qiskit_aqt_provider package version. Job persisted with a different package version will therefore not be found!

Hint

If the job’s execution backend is an offline simulator, the job is re-submitted to the simulation backend and the new job ID differs from the one passed to this function.

Parameters:
  • job_id – identifier of the job to retrieve.

  • access_token – access token for the AQT cloud. See AQTProvider.

  • store_path – local persistent storage directory. By default, use a standard cache directory.

  • remove_from_store – if True, remove the retrieved job’s data from persistent storage after a successful load.

Returns:

A job handle for the passed job_id.

Raises:

JobNotFoundError – the target job was not found in persistent storage.

result() Result[source]#

Block until all circuits have been evaluated and return the combined result.

Success or error is signalled by the success field in the returned Result instance.

Returns:

The combined result of all circuit evaluations.

status() JobStatus[source]#

Query the job’s status.

Returns:

Aggregated job status for all the circuits in this job.

submit() None[source]#

Submit this job for execution.

This operation is not blocking. Use result() to block until the job completes.

Raises:

RuntimeError – this job was already submitted.

class qiskit_aqt_provider.aqt_job.AQTDirectAccessJob[source]#

Handle for quantum circuits jobs running on direct-access AQT backends.

Use AQTDirectAccessResource.run to get a handle and evaluate circuits on a direct-access backend.

result() Result[source]#

Iteratively submit all circuits and block until full completion.

If an error occurs, the remaining circuits are not executed and the whole job is marked as failed.

Returns:

The combined result of all circuit evaluations.

status() JobStatus[source]#

Query the job’s status.

Returns:

Aggregated job status for all the circuits in this job.

class qiskit_aqt_provider.aqt_job.Progress[source]#

Progress information of a job.

finished_count: int#

Number of completed circuits.

total_count: int#

Total number of circuits in the job.

class qiskit_aqt_provider.persistence.JobNotFoundError[source]#

Bases: Exception

A job was not found in persistent storage.