View source on GitHub |
A quantum job backed by a (local) sampler.
Inherits From: AbstractLocalJob
, AbstractJob
cirq_google.engine.SimulatedLocalJob(
*args,
sampler: Optional[cirq.Sampler] = None,
simulation_type: cirq_google.engine.local_simulation_type.LocalSimulationType
= cirq_google.engine.local_simulation_type.LocalSimulationType.SYNCHRONOUS
,
**kwargs
)
This class is designed to execute a local simulator using the
AbstractEngine
and AbstractJob
interface. This class will
keep track of the status based on the sampler's results.
If the simulation type is SYNCHRONOUS, the sampler will be called once the appropriate results method is called. Other methods will be added later.
This does not support calibration requests. ` Attributes: sampler: Sampler to call for results. simulation_type: Whether sampler execution should be synchronous or asynchronous.
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
cancel() -> None
Cancel the job.
create_time
create_time() -> 'datetime.datetime'
Returns when the job was created.
delete
delete() -> None
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
execution_status() -> cirq_google.cloud.quantum.ExecutionStatus.State
Return the execution status of the job.
failure
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