View source on GitHub |
A job created on the IonQ API.
cirq_ionq.job.Job( client: cirq_ionq.ionq_client._IonQClient, job_dict: dict ) Note that this is mutable, when calls to get status or results are made the job updates itself to the results returned from the API.
If a job is canceled or deleted, only the job id and the status remain valid.
Args | |
|---|---|
client | The client used for calling the API. |
job_dict | A dict representing the response from a call to get_job on the client. |
Methods
cancel
cancel() Cancel the given job.
This mutates the job to only have a job id and status canceled.
delete
delete() Delete the given job.
This mutates the job to only have a job id and status deleted. Subsequence attempts to get the job with this job id will return not found.
job_id
job_id() -> str Returns the job id (UID) for the job.
This is the id used for identifying the job by the API.
measurement_dict
measurement_dict( circuit_index=0 ) -> dict[str, Sequence[int]] Returns a dictionary of measurement keys to target qubit index.
name
name() -> str Returns the name of the job which was supplied during job creation.
This is different than the job_id.
| Raises | |
|---|---|
IonQUnsuccessfulJob | If the job has failed, been canceled, or deleted. |
IonQException | If unable to get the status of the job from the API. |
num_qubits
num_qubits( circuit_index=None ) -> int Returns the number of qubits for the job.
| Raises | |
|---|---|
IonQUnsuccessfulJob | If the job has failed, been canceled, or deleted. |
IonQException | If unable to get the status of the job from the API. |
repetitions
repetitions() -> int Returns the number of repetitions for the job.
| Raises | |
|---|---|
IonQUnsuccessfulJob | If the job has failed, been canceled, or deleted. |
IonQException | If unable to get the status of the job from the API. |
results
results( timeout_seconds: int = 7200, polling_seconds: int = 1, sharpen: (bool | None) = None, extra_query_params: (dict | None) = None ) -> (list[results.QPUResult] | list[results.SimulatorResult]) Polls the IonQ api for results.
| Args | |
|---|---|
timeout_seconds | The total number of seconds to poll for. |
polling_seconds | The interval with which to poll. |
sharpen | A boolean that determines how to aggregate error mitigated. If True, apply majority vote mitigation; if False, apply average mitigation. |
extra_query_params | Specify any parameters to include in the request. |
| Returns | |
|---|---|
Either a list of cirq_ionq.QPUResult or a list of cirq_ionq.SimulatorResult depending on whether the job was running on an actual quantum processor or a simulator. |
| Raises | |
|---|---|
IonQUnsuccessfulJob | If the job has failed, been canceled, or deleted. |
IonQException | If unable to get the results from the API. |
RuntimeError | If the job reported that it had failed on the server, or the job had an unknown status. |
TimeoutError | If the job timed out at the server. |
status
status() -> str Gets the current status of the job.
This will get a new job if the status of the job previously was determined to not be in a terminal state. A full list of states is given in cirq_ionq.IonQJob.ALL_STATES.
| Raises | |
|---|---|
IonQException | If the API is not able to get the status of the job. |
| Returns | |
|---|---|
| The job status. |
target
target() -> str Returns the target where the job is to be run, or was run.
| Returns | |
|---|---|
| 'qpu' or 'simulator' depending on where the job was run or is running. |
| Raises | |
|---|---|
IonQUnsuccessfulJob | If the job has failed, been canceled, or deleted. |
IonQException | If unable to get the status of the job from the API. |
View source on GitHub