AlgorithmJob#

class AlgorithmJob(function, *args, **kwargs)[source]#

Bases: PrimitiveJob

This class is introduced for typing purposes and provides no additional function beyond that inherited from its parents.

Update: AlgorithmJob.submit() method added. See its documentation for more info.

Parameters:

function – A callable function to execute the job.

Methods

cancel()#

Attempt to cancel the job.

cancelled()#

Return whether the job has been cancelled.

Return type:

bool

done()#

Return whether the job has successfully run.

Return type:

bool

in_final_state()#

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

Return type:

bool

job_id()#

Return a unique id identifying the job.

Return type:

str

result()#

Return the results of the job.

Return type:

ResultT

running()#

Return whether the job is actively running.

Return type:

bool

status()#

Return the status of the job.

Return type:

JobStatus

submit()[source]#

Submit the job for execution.

For V1 primitives, Qiskit PrimitiveJob subclassed JobV1 and defined submit(). PrimitiveJob was updated for V2 primitives, no longer subclasses JobV1, and now has a private _submit() method, with submit() being deprecated as of Qiskit version 0.46. This maintains the submit() for AlgorithmJob here as it’s called in many places for such a job. An alternative could be to make 0.46 the required minimum version and alter all algorithm’s call sites to use _submit() and make this an empty class again as it once was. For now this way maintains compatibility with the current min version of 0.44.