![]() |
A job created on the IonQ API.
cirq.ionq.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
|
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() -> 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() -> 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
) -> Union[cirq.ionq.QPUResult
, cirq.ionq.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. |
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
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. |