cirq.ionq.Job

A job created on the IonQ API.

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.

client The client used for calling the API.
job A dict representing the response from a call to get_job on the client.

Methods

cancel

View source

Cancel the given job.

This mutates the job to only have a job id and status canceled.

delete

View source

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

View source

Returns the job id (UID) for the job.

This is the id used for identifying the job by the API.

measurement_dict

View source

Returns a dictionary of measurement keys to target qubit index.

name

View source

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

View source

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

View source

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

View source

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.

Returns
Either a cirq.ionq.QPUResults or cirq.ionq.SimulatorResults 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.

status

View source

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

View source

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.

ALL_STATES ('completed', 'canceled', 'failed', 'deleted', 'ready', 'submitted', 'running')

All states that an IonQ API job can exist in.

NON_TERMINAL_STATES ('ready', 'submitted', 'running')

States of the IonQ API job which can transition to other states.

TERMINAL_STATES ('completed', 'canceled', 'failed', 'deleted')

States of the IonQ API job from which the job cannot transition. Note that deleted can only exist in a return call from a delete (subsequent calls will return not found).

UNSUCCESSFUL_STATES ('canceled', 'failed', 'deleted')

States of the IonQ API job when it was not successful and so does not have any data associated with it beyond an id and a status.