View source on GitHub
|
An abstract object representing a quantum job execution.
This represents the state of a possibly asynchronous Job being executed by a simulator, the cloud Engine service, or other means.
This is an abstract interface that implementers of services or mocks should implement. It generally represents the execution of a circuit using a set of parameters called a sweep. It can also represent the execution of a batch job (a list of circuit/sweep pairs) or the execution of a calibration request.
This job may be in a variety of states. It may be scheduling, it may be executing on a machine, or it may have entered a terminal state (either succeeding or failing).
AbstractJobs can be iterated over, returning Results. These
Results can also be accessed by index. Note that this will block
until the results are returned.
Methods
add_labels
@abc.abstractmethodadd_labels( labels: dict[str, str] ) -> AbstractJob
Adds new labels to a previously created quantum job.
| Params | |
|---|---|
labels
|
New labels to add to the existing job labels. |
| Returns | |
|---|---|
This AbstractJob.
|
batched_results
batched_results()
Returns the job results split by program/circuit in the batch.
Instead of flattening results into a single list, this will return a Sequence[EngineResult] for each circuit in the batch.
batched_results_async
batched_results_async()
Returns the job results split by program/circuit in the batch.
Instead of flattening results into a single list, this will return a Sequence[EngineResult] for each circuit in the batch.
cancel
@abc.abstractmethodcancel() -> (bool | None)
Cancel the job.
create_time
@abc.abstractmethodcreate_time() -> datetime.datetime
Returns when the job was created.
delete
@abc.abstractmethoddelete() -> (bool | None)
Deletes the job and result, if any.
description
@abc.abstractmethoddescription() -> str
Returns the description of the job.
engine
@abc.abstractmethodengine() -> abstract_engine.AbstractEngine
Returns the parent AbstractEngine object.
execution_status
@abc.abstractmethodexecution_status() -> quantum.ExecutionStatus.State
Return the execution status of the job.
failure
@abc.abstractmethodfailure() -> (tuple[str, str] | None)
Return failure code and message of the job if present.
get_calibration
@abc.abstractmethodget_calibration() -> (calibration.Calibration | None)
Returns the recorded calibration at the time when the job was run, if one was captured, else None.
get_circuit
@abc.abstractmethodget_circuit( circuit_num: (int | None) = None ) -> cirq.Circuit
Returns the cirq Circuit for the job.
| Args | |
|---|---|
circuit_num
|
if this is a multi-circuit job, the index of the circuit to return. This argument is zero-indexed. Negative values index from the end of the list. Ignored if not multi-circuit. |
| Returns | |
|---|---|
| The job's cirq Circuit. |
get_processor
@abc.abstractmethodget_processor() -> (abstract_processor.AbstractProcessor | None)
Returns the AbstractProcessor for the processor the job is/was run on, if available, else None.
get_repetitions_and_sweeps
@abc.abstractmethodget_repetitions_and_sweeps( circuit_num: (int | None) = None ) -> tuple[int, list[cirq.Sweep]]
Returns the repetitions and sweeps for the job.
| Args | |
|---|---|
circuit_num
|
if this is a batch job, the index of the circuit to return the sweeps for. This argument is zero-indexed. Negative values index from the end of the list. |
| Returns | |
|---|---|
| A tuple of the repetition count and list of sweeps. |
id
@abc.abstractmethodid() -> str
Returns the id of this job.
labels
@abc.abstractmethodlabels() -> dict[str, str]
Returns the labels of the job.
processor_ids
@abc.abstractmethodprocessor_ids() -> list[str]
Returns the processor ids provided when the job was created.
program
@abc.abstractmethodprogram() -> abstract_program.AbstractProgram
Returns the parent AbstractProgramobject.
remove_labels
@abc.abstractmethodremove_labels( keys: list[str] ) -> AbstractJob
Removes labels with given keys.
| Params | |
|---|---|
label_keys
|
Label keys to remove from the existing job labels. |
| Returns | |
|---|---|
This AbstractJob.
|
results
results()
Returns the job results, blocking until the job is complete.
results_async
results_async()
Returns the job results, blocking until the job is complete.
set_description
@abc.abstractmethodset_description( description: str ) -> AbstractJob
Sets the description of the job.
| Params | |
|---|---|
description
|
The new description for the job. |
| Returns | |
|---|---|
This AbstractJob.
|
set_labels
@abc.abstractmethodset_labels( labels: dict[str, str] ) -> AbstractJob
Sets (overwriting) the labels for a previously created quantum job.
| Params | |
|---|---|
labels
|
The entire set of new job labels. |
| Returns | |
|---|---|
This AbstractJob.
|
update_time
@abc.abstractmethodupdate_time() -> datetime.datetime
Returns when the job was last updated.
__getitem__
__getitem__(
item
)
__iter__
__iter__() -> Iterator[cirq.Result]
__len__
__len__() -> int
View source on GitHub