IonQ Job

IonQ’s Job implementation.


IonQ job status names are slightly different than those of the standard JobStatus enum values.

As such, the IonQJob.status() method on the IonQJob class attempts to perform a mapping between these status values for compatibility with BaseJob.

class qiskit_ionq.ionq_job.IonQJob(backend, job_id, client=None, circuit=None, passed_args=None)[source]

Representation of a Job that will run on an IonQ backend.

It is not recommended to create Job instances directly, but rather use the run and retrieve_job methods on sub-class instances of IonQBackend to create and retrieve jobs (both methods return a job instance).


A possibly None Qiskit quantum circuit.




The actual Qiskit Result of this job when done.



Initializes the asynchronous job.

  • backend – the backend used to run the job.

  • job_id – a unique id in the context of the backend used to run the job.

  • kwargs – Any key value metadata to associate with this job.

backend() Backend

Return the backend where this job was executed.


Cancel this job.

cancelled() bool

Return whether the job has been cancelled.

done() bool

Return whether the job has successfully run.


Return the counts for the job.


Result counts for jobs processed by IonQSimulatorBackend are returned from the API as probabilities, and are converted to counts via simple statistical sampling that occurs on the cient side.

To obtain the true probabilities, use the get_probabilties() method instead.


circuit (str or QuantumCircuit or int or None) – Optional. The index of the experiment.


A dictionary of counts.

Return type:



Return the probabilities for the job.

This is effectively a pass-through to



circuit (str or QuantumCircuit or int or None) – Optional.


A tuple counts, probabilities.

Return type:

tuple(dict[str, float], dict[str, float])

in_final_state() bool

Return whether the job is in a final job state such as DONE or ERROR.

job_id() str

Return a unique id identifying the job.

result(sharpen: bool = None, extra_query_params: dict = None, **kwargs)[source]

Retrieve job result data.


_result is populated by status(), when the job status has reached a “final” state.

This method calls the wait_for_final_state method to poll for a completed job.

  • IonQJobTimeoutError – If after the default wait period in wait_for_final_state elapses and the job has not reached a “final” state.

  • IonQJobError – If the job has reached a final state but the job itself was never converted to a Result.


A Qiskit Result representation of this job.

Return type:


running() bool

Return whether the job is actively running.


Retrieve the status of a job


detailed (bool) – If True, returns a detailed status of children.


An enum value from Qiskit’s

JobStatus if detailed is False. A dictionary containing the detailed status of the children if detailed is True.

Return type:

JobStatus or dict

  • IonQJobError – If the IonQ job status was unknown or otherwise unmappable to a qiskit job status.

  • IonQJobFailureError – If the job fails

  • IonQJobStateError – If the job was cancelled


Submit a job to the IonQ API.


IonQJobError – If this instance’s qobj was None.

wait_for_final_state(timeout: float | None = None, wait: float = 5, callback: Callable | None = None) None

Poll the job status until it progresses to a final state such as DONE or ERROR.

  • timeout – Seconds to wait for the job. If None, wait indefinitely.

  • wait – Seconds between queries.

  • callback

    Callback function invoked after each query. The following positional arguments are provided to the callback function:

    • job_id: Job ID

    • job_status: Status of the job from the last query

    • job: This BaseJob instance

    Note: different subclass might provide different arguments to the callback function.


JobTimeoutError – If the job does not reach a final state before the specified timeout.