cirq.google.Engine

class cirq.google.Engine(api_key: Optional[str] = None, api: str = 'quantum', version: str = 'v1alpha1', default_project_id: Optional[str] = None, discovery_url: Optional[str] = None, default_gcs_prefix: Optional[str] = None, **kwargs)[source]

Runs programs via the Quantum Engine API.

This class has methods for creating programs and jobs that execute on
Quantum Engine:
run
run_sweep
Another set of methods return information about programs and jobs that
have been previously created on the Quantum Engine:
get_program
get_job
get_job_results
Finally, the engine has methods to update existing programs and jobs:
cancel_job
set_program_labels
add_program_labels
remove_program_labels
set_job_labels
add_job_labels
remove_job_labels
__init__(api_key: Optional[str] = None, api: str = 'quantum', version: str = 'v1alpha1', default_project_id: Optional[str] = None, discovery_url: Optional[str] = None, default_gcs_prefix: Optional[str] = None, **kwargs) → None[source]

Engine service client.

Parameters:
  • api_key – API key to use to retrieve discovery doc.
  • api – API name.
  • version – API version.
  • default_project_id – A fallback project_id to use when one isn’t specified in the JobConfig given to ‘run’ methods. See JobConfig for more information on project_id.
  • discovery_url – Discovery url for the API. If not supplied, uses Google’s default api.googleapis.com endpoint.
  • default_gcs_prefix – A fallback gcs_prefix to use when one isn’t specified in the JobConfig given to ‘run’ methods. See JobConfig for more information on gcs_prefix.

Methods

add_job_labels(job_resource_name, labels, str])
add_program_labels(program_resource_name, …)
cancel_job(job_resource_name) Cancels the given job.
get_job(job_resource_name) Returns metadata about a previously created job.
get_job_results(job_resource_name) Returns the actual results (not metadata) of a completed job.
get_program(program_resource_name) Returns the previously created quantum program.
implied_job_config(job_config)
program_as_schedule(program, …)
remove_job_labels(job_resource_name, label_keys)
remove_program_labels(program_resource_name, …)
run(*, program, …) Runs the supplied Circuit or Schedule via Quantum Engine.
run_sweep(*, program, …) Runs the supplied Circuit or Schedule via Quantum Engine.
set_job_labels(job_resource_name, labels, str])
set_program_labels(program_resource_name, …)