POVMSamplerJob¶
- class POVMSamplerJob(base_job, metadata)¶
Bases:
BasePrimitiveJob[POVMPubResult,JobStatus]The job returned by
POVMSampler.run().Initialize the job.
- Parameters:
base_job (BasePrimitiveJob) – the raw job from which to extract results.
metadata (list[POVMMetadata]) – the metadata list associated with the submitted Pubs.
Attributes
- base_job: BasePrimitiveJob¶
The internally submitted job instance.
- metadata: list[POVMMetadata]¶
The metadata list associated with the submitted Pubs.
Methods
- cancel()¶
Attempt to cancel the job.
- in_final_state()¶
Return whether the job is in a final job state such as
DONEorERROR.- Return type:
- classmethod recover_job(filename, base_job=None, *, service=None)¶
Recover a
POVMSamplerJobinstance.This method can be used to recover a job instance after previously saving its
metadataviasave_metadata().- Parameters:
filename (str) – name of the file where the metadata is stored.
base_job (BasePrimitiveJob | None) – the internal
qiskit.primitives.BasePrimitiveJobobject that was stored inside the originalPOVMSamplerJobobject. IfNone, the internal job ID stored in the metadata will be used to recover the internal job from theQiskitRuntimeService.service (QiskitRuntimeService | None) – an optional instance of the
QiskitRuntimeService. IfNone, an instance will be generated with no arguments, resulting in it extracting the saved configuration from disk.
- Raises:
ValueError – if a
base_jobis supplied and its ID does not match with the ID stored in the metadata filefilename.- Returns:
The recovered
POVMSamplerJobinstance.- Return type:
- result()¶
Return the result of the job.
- Returns:
A
PrimitiveResultcontaining a list ofPOVMPubResult.- Raises:
ValueError – If the number of raw results does not match the number of metadata objects stored in
metadata.- Return type:
- save_metadata(filename=None)¶
Save the
metadatainto a pickle file.- Parameters:
filename (str | None) – name of the file where to store the metadata. If
None, the default filename isf"job_metadata_{self.base_job.job_id()}.pkl".- Return type:
None
Inherited Methods