POVMSamplerJob¶
- class POVMSamplerJob(base_job: BasePrimitiveJob, metadata: list[POVMMetadata])[source]¶
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
- in_final_state() bool [source]¶
Return whether the job is in a final job state such as
DONE
orERROR
.- Return type:
- classmethod recover_job(filename: str, base_job: BasePrimitiveJob | None = None, *, service: QiskitRuntimeService | None = None) POVMSamplerJob [source]¶
Recover a
POVMSamplerJob
instance.This method can be used to recover a job instance after previously saving its
metadata
viasave_metadata()
.- Parameters:
filename (str) – name of the file where the metadata is stored.
base_job (BasePrimitiveJob | None) – the internal
qiskit.primitives.BasePrimitiveJob
object that was stored inside the originalPOVMSamplerJob
object. 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_job
is supplied and its ID does not match with the ID stored in the metadata filefilename
.- Returns:
The recovered
POVMSamplerJob
instance.- Return type:
- result() PrimitiveResult[POVMPubResult] [source]¶
Return the result of the job.
- Returns:
A
PrimitiveResult
containing 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: str | None = None) None [source]¶
Save the
metadata
into 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"
.
Inherited Methods