View source on GitHub |
An abstract object representing a quantum program.
This program generally wraps a Circuit
with additional metadata.
When combined with an appropriate RunContext, this becomes a
Job that can run on either an Engine service or simulator.
Programs can also be a batch (list of circuits) or calibration
requests.
This is an abstract class that inheritors should implement.
Methods
add_labels
@abc.abstractmethod
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
@abc.abstractmethod
batch_size() -> int
Returns the number of programs in a batch program.
Raises | |
---|---|
ValueError
|
if the program created was not a batch program. |
create_time
@abc.abstractmethod
create_time() -> 'datetime.datetime'
Returns when the program was created.
delete
@abc.abstractmethod
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
@abc.abstractmethod
delete_job( job_id: str ) -> None
Removes a child job from this program.
description
@abc.abstractmethod
description() -> str
Returns the description of the program.
engine
@abc.abstractmethod
engine() -> 'abstract_engine.AbstractEngine'
Returns the parent Engine object.
Returns | |
---|---|
The program's parent Engine. |
get_circuit
@abc.abstractmethod
get_circuit() -> cirq.Circuit
Returns the cirq Circuit for the program. This is only supported if the program was created with the V2 protos.
Returns | |
---|---|
The program's cirq Circuit. |
get_job
@abc.abstractmethod
get_job( job_id: str ) -> 'abstract_job.AbstractJob'
Returns an AbstractJob for an existing id.
Args | |
---|---|
job_id
|
Unique ID of the job within the parent program. |
Returns | |
---|---|
A AbstractJob for this program. |
labels
@abc.abstractmethod
labels() -> Dict[str, str]
Returns the labels of the program.
list_jobs
@abc.abstractmethod
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['abstract_job.AbstractJob']
Returns the list of jobs for this program.
Args | |
---|---|
project_id
|
A project_id of the parent Google Cloud Project. |
program_id
|
Unique ID of the program within the parent project. |
created_after
|
retrieve jobs that were created after this date or time. |
created_before
|
retrieve jobs that were created after this date or time. |
has_labels
|
retrieve jobs that have labels on them specified by
this dict. If the value is set to * , jobs having the label
regardless of the label value will be returned. 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.
|
Returns | |
---|---|
A sequence of AbstractJob objects that satisfy the constraints.
|
remove_labels
@abc.abstractmethod
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
@abc.abstractmethod
set_description( description: str ) -> 'AbstractProgram'
Sets the description of the program.
Params | |
---|---|
description
|
The new description for the program. |
Returns | |
---|---|
This AbstractProgram. |
set_labels
@abc.abstractmethod
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
@abc.abstractmethod
update_time() -> 'datetime.datetime'
Returns when the program was last updated.