224 lines
6.4 KiB
Plaintext
224 lines
6.4 KiB
Plaintext
---
|
||
title: AerJob
|
||
description: API reference for qiskit_aer.jobs.AerJob
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: class
|
||
python_api_name: qiskit_aer.jobs.AerJob
|
||
---
|
||
|
||
# AerJob
|
||
|
||
<Class id="qiskit_aer.jobs.AerJob" isDedicatedPage={true} github="https://github.com/qiskit/qiskit-aer/tree/stable/0.12/qiskit_aer/jobs/aerjob.py" signature="AerJob(backend, job_id, fn, qobj=None, circuits=None, noise_model=None, config=None, executor=None)" modifiers="class">
|
||
Bases: [`qiskit.providers.job.JobV1`](qiskit.providers.JobV1 "qiskit.providers.job.JobV1")
|
||
|
||
AerJob class for Qiskit Aer Simulators.
|
||
|
||
Initializes the asynchronous job.
|
||
|
||
**Parameters**
|
||
|
||
* **backend** (*AerBackend*) – the backend used to run the job.
|
||
* **job\_id** (*str*) – a unique id in the context of the backend used to run the job.
|
||
* **fn** (*function*) – a callable function to execute qobj on backend. This should usually be a bound `AerBackend._run()` method, with the signature (qobj: QasmQobj, job\_id: str) -> Result.
|
||
* **qobj** ([*QasmQobj*](qiskit.qobj.QasmQobj "qiskit.qobj.QasmQobj")) – qobj to execute
|
||
* **circuits** (*list of QuantumCircuit*) – circuits to execute. If qobj is set, this argument is ignored.
|
||
* **noise\_model** ([*NoiseModel*](qiskit_aer.noise.NoiseModel "qiskit_aer.noise.NoiseModel")) – noise\_model to execute. If qobj is set, this argument is ignored.
|
||
* **config** (*dict*) – configuration to execute. If qobj is set, this argument is ignored.
|
||
* **executor** (*ThreadPoolExecutor or dask.distributed.client*) – The executor to be used to submit the job.
|
||
|
||
**Raises**
|
||
|
||
[**JobError**](qiskit.providers.JobError "qiskit.providers.JobError") – if no qobj and no circuits.
|
||
|
||
## Methods
|
||
|
||
### backend
|
||
|
||
<Function id="qiskit_aer.jobs.AerJob.backend" signature="AerJob.backend()">
|
||
Return the instance of the backend used for this job.
|
||
</Function>
|
||
|
||
### cancel
|
||
|
||
<Function id="qiskit_aer.jobs.AerJob.cancel" signature="AerJob.cancel()">
|
||
Attempt to cancel the job.
|
||
</Function>
|
||
|
||
### cancelled
|
||
|
||
<Function id="qiskit_aer.jobs.AerJob.cancelled" signature="AerJob.cancelled()">
|
||
Return whether the job has been cancelled.
|
||
|
||
**Return type**
|
||
|
||
`bool`
|
||
</Function>
|
||
|
||
### circuits
|
||
|
||
<Function id="qiskit_aer.jobs.AerJob.circuits" signature="AerJob.circuits()">
|
||
Return the list of QuantumCircuit submitted for this job.
|
||
|
||
**Returns**
|
||
|
||
the list of QuantumCircuit submitted for this job.
|
||
|
||
**Return type**
|
||
|
||
list of QuantumCircuit
|
||
</Function>
|
||
|
||
### done
|
||
|
||
<Function id="qiskit_aer.jobs.AerJob.done" signature="AerJob.done()">
|
||
Return whether the job has successfully run.
|
||
|
||
**Return type**
|
||
|
||
`bool`
|
||
</Function>
|
||
|
||
### executor
|
||
|
||
<Function id="qiskit_aer.jobs.AerJob.executor" signature="AerJob.executor()">
|
||
Return the executor for this job
|
||
</Function>
|
||
|
||
### in\_final\_state
|
||
|
||
<Function id="qiskit_aer.jobs.AerJob.in_final_state" signature="AerJob.in_final_state()">
|
||
Return whether the job is in a final job state such as `DONE` or `ERROR`.
|
||
|
||
**Return type**
|
||
|
||
`bool`
|
||
</Function>
|
||
|
||
### job\_id
|
||
|
||
<Function id="qiskit_aer.jobs.AerJob.job_id" signature="AerJob.job_id()">
|
||
Return a unique id identifying the job.
|
||
|
||
**Return type**
|
||
|
||
`str`
|
||
</Function>
|
||
|
||
### qobj
|
||
|
||
<Function id="qiskit_aer.jobs.AerJob.qobj" signature="AerJob.qobj()">
|
||
Return the Qobj submitted for this job.
|
||
|
||
**Returns**
|
||
|
||
the Qobj submitted for this job.
|
||
|
||
**Return type**
|
||
|
||
[Qobj](qiskit.qobj.Qobj "qiskit.qobj.Qobj")
|
||
</Function>
|
||
|
||
### result
|
||
|
||
<Function id="qiskit_aer.jobs.AerJob.result" signature="AerJob.result(timeout=None)">
|
||
Get job result. The behavior is the same as the underlying concurrent Future objects,
|
||
|
||
[https://docs.python.org/3/library/concurrent.futures.html#future-objects](https://docs.python.org/3/library/concurrent.futures.html#future-objects)
|
||
|
||
**Parameters**
|
||
|
||
**timeout** (*float*) – number of seconds to wait for results.
|
||
|
||
**Returns**
|
||
|
||
Result object
|
||
|
||
**Return type**
|
||
|
||
qiskit.Result
|
||
|
||
**Raises**
|
||
|
||
* **concurrent.futures.TimeoutError** – if timeout occurred.
|
||
* **concurrent.futures.CancelledError** – if job cancelled before completed.
|
||
</Function>
|
||
|
||
### running
|
||
|
||
<Function id="qiskit_aer.jobs.AerJob.running" signature="AerJob.running()">
|
||
Return whether the job is actively running.
|
||
|
||
**Return type**
|
||
|
||
`bool`
|
||
</Function>
|
||
|
||
### status
|
||
|
||
<Function id="qiskit_aer.jobs.AerJob.status" signature="AerJob.status()">
|
||
Gets the status of the job by querying the Python’s future
|
||
|
||
**Returns**
|
||
|
||
The current JobStatus
|
||
|
||
**Return type**
|
||
|
||
[JobStatus](qiskit.providers.JobStatus "qiskit.providers.JobStatus")
|
||
|
||
**Raises**
|
||
|
||
* [**JobError**](qiskit.providers.JobError "qiskit.providers.JobError") – If the future is in unexpected state
|
||
* **concurrent.futures.TimeoutError** – if timeout occurred.
|
||
</Function>
|
||
|
||
### submit
|
||
|
||
<Function id="qiskit_aer.jobs.AerJob.submit" signature="AerJob.submit()">
|
||
Submit the job to the backend for execution.
|
||
|
||
**Raises**
|
||
|
||
* **QobjValidationError** – if the JSON serialization of the Qobj passed
|
||
* **during construction does not validate against the Qobj schema.** –
|
||
* [**JobError**](qiskit.providers.JobError "qiskit.providers.JobError") – if trying to re-submit the job.
|
||
</Function>
|
||
|
||
### wait\_for\_final\_state
|
||
|
||
<Function id="qiskit_aer.jobs.AerJob.wait_for_final_state" signature="AerJob.wait_for_final_state(timeout=None, wait=5, callback=None)">
|
||
Poll the job status until it progresses to a final state such as `DONE` or `ERROR`.
|
||
|
||
**Parameters**
|
||
|
||
* **timeout** (`Optional`\[`float`]) – Seconds to wait for the job. If `None`, wait indefinitely.
|
||
|
||
* **wait** (`float`) – Seconds between queries.
|
||
|
||
* **callback** (`Optional`\[`Callable`]) –
|
||
|
||
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.
|
||
|
||
**Raises**
|
||
|
||
[**JobTimeoutError**](qiskit.providers.JobTimeoutError "qiskit.providers.JobTimeoutError") – If the job does not reach a final state before the specified timeout.
|
||
|
||
**Return type**
|
||
|
||
`None`
|
||
</Function>
|
||
|
||
## Attributes
|
||
|
||
### version
|
||
|
||
<Attribute id="qiskit_aer.jobs.AerJob.version" attributeValue="1" />
|
||
</Class>
|
||
|