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).
AbstractJob
s can be iterated over, returning Result
s. These
Result
s can also be accessed by index. Note that this will block
until the results are returned.
Methods
add_labels
@abc.abstractmethod
add_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 .
|
cancel
@abc.abstractmethod
cancel() -> Optional[bool]
Cancel the job.
create_time
@abc.abstractmethod
create_time() -> 'datetime.datetime'
Returns when the job was created.
delete
@abc.abstractmethod
delete() -> Optional[bool]
Deletes the job and result, if any.
description
@abc.abstractmethod
description() -> str
Returns the description of the job.
engine
@abc.abstractmethod
engine() -> 'abstract_engine.AbstractEngine'
Returns the parent AbstractEngine
object.
execution_status
@abc.abstractmethod
execution_status() ->
cirq_google.cloud.quantum.ExecutionStatus.State
Return the execution status of the job.
failure
@abc.abstractmethod
failure() -> Optional[Tuple[str, str]]
Return failure code and message of the job if present.
get_calibration
@abc.abstractmethod
get_calibration() -> Optional['calibration.Calibration']
Returns the recorded calibration at the time when the job was run, if one was captured, else None.
get_processor
@abc.abstractmethod
get_processor() -> Optional['abstract_processor.AbstractProcessor']
Returns the AbstractProcessor for the processor the job is/was run on, if available, else None.
get_repetitions_and_sweeps
@abc.abstractmethod
get_repetitions_and_sweeps() -> Tuple[int, List[cirq.Sweep]]
Returns the repetitions and sweeps for the job.
Returns | |
---|---|
A tuple of the repetition count and list of sweeps. |
id
@abc.abstractmethod
id() -> str
Returns the id of this job.
labels
@abc.abstractmethod
labels() -> Dict[str, str]
Returns the labels of the job.
processor_ids
@abc.abstractmethod
processor_ids() -> List[str]
Returns the processor ids provided when the job was created.
program
@abc.abstractmethod
program() -> 'abstract_program.AbstractProgram'
Returns the parent AbstractProgram
object.
remove_labels
@abc.abstractmethod
remove_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.abstractmethod
set_description( description: str ) -> 'AbstractJob'
Sets the description of the job.
Params | |
---|---|
description
|
The new description for the job. |
Returns | |
---|---|
This AbstractJob .
|
set_labels
@abc.abstractmethod
set_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.abstractmethod
update_time() -> 'datetime.datetime'
Returns when the job was last updated.
__getitem__
__getitem__(
item
)
__iter__
__iter__() -> Iterator[cirq.Result]
__len__
__len__() -> int