View source on GitHub |
A program backed by a (local) sampler.
Inherits From: AbstractLocalProgram
, AbstractProgram
cirq_google.engine.SimulatedLocalProgram(
*args,
program_id: str,
simulation_type: cirq_google.engine.local_simulation_type.LocalSimulationType
= cirq_google.engine.local_simulation_type.LocalSimulationType.SYNCHRONOUS
,
processor: Optional['SimulatedLocalProcessor'] = None,
**kwargs
)
This class functions as a parent class for a SimulatedLocalJob
object.
Methods
add_job
add_job(
job_id: str, job: 'AbstractLocalJob'
) -> None
add_labels
add_labels(
labels: Dict[str, str]
) -> 'AbstractProgram'
Adds new labels to a previously created quantum program.
Params | |
---|---|
labels
|
New labels to add to the existing program labels. |
Returns | |
---|---|
This AbstractProgram. |
batch_size
batch_size() -> int
Returns the number of programs in a batch program.
create_time
create_time() -> 'datetime.datetime'
Returns when the program was created.
delete
delete(
delete_jobs: bool = False
) -> None
Deletes a previously created quantum program.
Params | |
---|---|
delete_jobs
|
If True will delete all the program's jobs, other this will fail if the program contains any jobs. |
delete_job
delete_job(
job_id: str
) -> None
Removes a child job from this program.
description
description() -> str
Returns the description of the program.
engine
engine() -> 'AbstractLocalEngine'
Returns the parent Engine object.
Returns | |
---|---|
The program's parent Engine. |
get_circuit
get_circuit(
program_num: Optional[int] = None
) -> cirq.Circuit
Returns the cirq Circuit for the program. This is only supported if the program was created with the V2 protos.
Args | |
---|---|
program_num
|
if this is a batch program, the index of the circuit in the batch. This argument is zero-indexed. Negative values indexing from the end of the list. |
Returns | |
---|---|
The program's cirq Circuit. |
get_job
get_job(
job_id: str
) -> 'AbstractLocalJob'
Returns an AbstractLocalJob for an existing Quantum Engine job.
Args | |
---|---|
job_id
|
Unique ID of the job within the parent program. |
Returns | |
---|---|
A AbstractLocalJob for this program. |
Raises | |
---|---|
KeyError
|
if job is not found. |
id
id() -> str
labels
labels() -> Dict[str, str]
Returns the labels of the program.
list_jobs
list_jobs(
created_before: Optional[Union[datetime.datetime, datetime.date]] = None,
created_after: Optional[Union[datetime.datetime, datetime.date]] = None,
has_labels: Optional[Dict[str, str]] = None,
execution_states: Optional[Set[quantum.ExecutionStatus.State]] = None
) -> Sequence['AbstractLocalJob']
Returns the list of jobs for this program.
Args | |
---|---|
created_after
|
retrieve jobs that were created after this date or time. |
created_before
|
retrieve jobs that were created before this date or time. |
has_labels
|
retrieve jobs that have labels on them specified by
this dict. If the value is set to * , filters having the label
regardless of the label value will be filtered. For example, to
query programs that have the shape label and have the color
label with value red can be queried using
{'color': 'red', 'shape':'*'} |
execution_states
|
retrieve jobs that have an execution state that
is contained in execution_states . See
quantum.ExecutionStatus.State enum for accepted values.
|
remove_labels
remove_labels(
keys: List[str]
) -> 'AbstractProgram'
Removes labels with given keys from the labels of a previously created quantum program.
Params | |
---|---|
label_keys
|
Label keys to remove from the existing program labels. |
Returns | |
---|---|
This AbstractProgram. |
set_description
set_description(
description: str
) -> 'AbstractProgram'
Sets the description of the program.
Params | |
---|---|
description
|
The new description for the program. |
Returns | |
---|---|
This AbstractProgram. |
set_labels
set_labels(
labels: Dict[str, str]
) -> 'AbstractProgram'
Sets (overwriting) the labels for a previously created quantum program.
Params | |
---|---|
labels
|
The entire set of new program labels. |
Returns | |
---|---|
This AbstractProgram. |
update_time
update_time() -> 'datetime.datetime'
Returns when the program was last updated.