qiskit-documentation/docs/api/qiskit/0.29/qiskit.providers.aer.AerJob...

229 lines
5.9 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: AerJob (v0.29)
description: API reference for qiskit.providers.aer.AerJob in qiskit v0.29
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.providers.aer.AerJob
---
# AerJob
<Class id="qiskit.providers.aer.AerJob" isDedicatedPage={true} github="https://github.com/qiskit/qiskit-aer/tree/stable/0.8/qiskit/providers/aer/aerjob.py" signature="AerJob(backend, job_id, fn, qobj, *args)" modifiers="class">
Bases: `qiskit.providers.job.JobV1`
AerJob class.
### \_executor
<Attribute id="qiskit.providers.aer.AerJob._executor">
executor to handle asynchronous jobs
**Type**
futures.Executor
</Attribute>
Initializes the asynchronous job.
**Parameters**
* **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.
## Methods
<span id="qiskit-providers-aer-aerjob-backend" />
### backend
<Function id="qiskit.providers.aer.AerJob.backend" signature="AerJob.backend()">
Return the instance of the backend used for this job.
</Function>
<span id="qiskit-providers-aer-aerjob-cancel" />
### cancel
<Function id="qiskit.providers.aer.AerJob.cancel" signature="AerJob.cancel()">
Attempt to cancel the job.
</Function>
<span id="qiskit-providers-aer-aerjob-cancelled" />
### cancelled
<Function id="qiskit.providers.aer.AerJob.cancelled" signature="AerJob.cancelled()">
Return whether the job has been cancelled.
**Return type**
`bool`
</Function>
<span id="qiskit-providers-aer-aerjob-done" />
### done
<Function id="qiskit.providers.aer.AerJob.done" signature="AerJob.done()">
Return whether the job has successfully run.
**Return type**
`bool`
</Function>
<span id="qiskit-providers-aer-aerjob-in-final-state" />
### in\_final\_state
<Function id="qiskit.providers.aer.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>
<span id="qiskit-providers-aer-aerjob-job-id" />
### job\_id
<Function id="qiskit.providers.aer.AerJob.job_id" signature="AerJob.job_id()">
Return a unique id identifying the job.
**Return type**
`str`
</Function>
<span id="qiskit-providers-aer-aerjob-qobj" />
### qobj
<Function id="qiskit.providers.aer.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>
<span id="qiskit-providers-aer-aerjob-result" />
### result
<Function id="qiskit.providers.aer.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>
<span id="qiskit-providers-aer-aerjob-running" />
### running
<Function id="qiskit.providers.aer.AerJob.running" signature="AerJob.running()">
Return whether the job is actively running.
**Return type**
`bool`
</Function>
<span id="qiskit-providers-aer-aerjob-status" />
### status
<Function id="qiskit.providers.aer.AerJob.status" signature="AerJob.status()">
Gets the status of the job by querying the Pythons 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>
<span id="qiskit-providers-aer-aerjob-submit" />
### submit
<Function id="qiskit.providers.aer.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>
<span id="qiskit-providers-aer-aerjob-wait-for-final-state" />
### wait\_for\_final\_state
<Function id="qiskit.providers.aer.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.providers.aer.AerJob.version" attributeValue="1" />
</Class>