cirq_google.engine.AbstractProgram

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

View source

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

View source

Returns the number of programs in a batch program.

Raises
ValueError if the program created was not a batch program.

create_time

View source

Returns when the program was created.

delete

View source

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

View source

Removes a child job from this program.

description

View source

Returns the description of the program.

engine

View source

Returns the parent Engine object.

Returns
The program's parent Engine.

get_circuit

View source

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

View source

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

View source

Returns the labels of the program.

list_jobs

View source

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

View source

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

View source

Sets the description of the program.

Params
description The new description for the program.

Returns
This AbstractProgram.

set_labels

View source

Sets (overwriting) the labels for a previously created quantum program.

Params
labels The entire set of new program labels.

Returns
This AbstractProgram.

update_time

View source

Returns when the program was last updated.