View source on GitHub |
A job that handles labels and descriptions locally in-memory.
Inherits From: AbstractJob
cirq_google.engine.AbstractLocalJob(
*,
job_id: str,
parent_program: 'AbstractLocalProgram',
repetitions: int,
sweeps: List[cirq.Sweep],
processor_id: str = ''
)
This class is designed to make writing custom AbstractJob objects
that function in-memory easier. This class will handle basic functionality
expected to be common across all local implementations.
Implementors of this class should write the following functions:
- Status functions: execution_status, failure
- Action functions: cancel, delete
- Result functions: results, batched_results, calibration_results
` Attributes: processor_ids: A string list of processor ids that this job can be run on. processor_id: If provided, the processor id that the job was run on. If not provided, assumed to be the first element of processor_ids parent_program: Program containing this job repetitions: number of repetitions for each parameter set sweeps: list of Sweeps that this job should iterate through.
Methods
add_labels
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
create_time() -> 'datetime.datetime'
Returns when the job was created.
delete
@abc.abstractmethod
delete() -> Optional[bool]
Deletes the job and result, if any.
description
description() -> str
Returns the description of the job.
engine
engine() -> 'AbstractLocalEngine'
Returns the parent program's 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
get_calibration() -> Optional[cirq_google.engine.Calibration
]
Returns the recorded calibration at the time when the job was created, from the parent Engine object.
get_processor
get_processor() -> 'AbstractLocalProcessor'
Returns the AbstractProcessor for the processor the job is/was run on, if available, else None.
get_repetitions_and_sweeps
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
id() -> str
Returns the identifier of this job.
labels
labels() -> Dict[str, str]
Returns the labels of the job.
processor_ids
processor_ids() -> List[str]
Returns the processor ids provided when the job was created.
program
program() -> 'AbstractLocalProgram'
Returns the parent AbstractLocalProgram
object.
remove_labels
remove_labels(
keys: List[str]
) -> 'AbstractJob'
Removes labels with given keys from the labels of a previously created quantum job.
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
set_description(
description: str
) -> 'AbstractJob'
Sets the description of the job.
Params | |
---|---|
description
|
The new description for the job. |
Returns | |
---|---|
This AbstractJob. |
set_labels
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
update_time() -> 'datetime.datetime'
Returns when the job was last updated.
__getitem__
__getitem__(
item
)
__iter__
__iter__() -> Iterator[cirq.Result]
__len__
__len__() -> int