View source on GitHub
|
A job created via the Quantum Engine API.
Inherits From: AbstractJob
cirq_google.engine.EngineJob(
project_id: str,
program_id: str,
job_id: str,
context: engine_base.EngineContext,
_job: (quantum.QuantumJob | None) = None,
job_result_future: (duet.AwaitableFuture[quantum.QuantumResult | quantum.QuantumJob] | None) = None
) -> None
This job may be in a variety of states. It may be scheduling, it may be executing on a machine, or it may have entered a terminal state (either succeeding or failing).
EngineJobs can be iterated over, returning Results. These
Results can also be accessed by index. Note that this will block
until the results are returned from the Engine service.
Attributes | |
|---|---|
project_id
|
A project_id of the parent Google Cloud Project. |
program_id
|
Unique ID of the program within the parent project. |
job_id
|
Unique ID of the job within the parent program. |
Methods
add_labels
add_labels(
labels: dict[str, str]
) -> EngineJob
Adds new labels to a previously created quantum job.
| Params | |
|---|---|
labels
|
New labels to add to the existing job labels. |
| Returns | |
|---|---|
| This EngineJob. |
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() -> engine_base.Engine
Returns the parent Engine object.
execution_status
execution_status() -> quantum.ExecutionStatus.State
Return the execution status of the job.
failure
failure() -> (tuple[str, str] | None)
Return failure code and message of the job if present.
get_calibration
get_calibration() -> (calibration.Calibration | None)
Returns the recorded calibration at the time when the job was run, if one was captured, else None.
get_processor
get_processor() -> (engine_processor.EngineProcessor | None)
Returns the EngineProcessor 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 Quantum Engine job.
| Returns | |
|---|---|
| A tuple of the repetition count and list of sweeps. |
id
id() -> str
Returns the job id.
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() -> engine_program.EngineProgram
Returns the parent EngineProgram object.
remove_labels
remove_labels(
keys: list[str]
) -> EngineJob
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 EngineJob. |
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
) -> EngineJob
Sets the description of the job.
| Params | |
|---|---|
description
|
The new description for the job. |
| Returns | |
|---|---|
| This EngineJob. |
set_labels
set_labels(
labels: dict[str, str]
) -> EngineJob
Sets (overwriting) the labels for a previously created quantum job.
| Params | |
|---|---|
labels
|
The entire set of new job labels. |
| Returns | |
|---|---|
| This EngineJob. |
status
status() -> str
Return the execution status of the job.
update_time
update_time() -> datetime.datetime
Returns when the job was last updated.
__getitem__
__getitem__(
item
)
__iter__
__iter__() -> Iterator[cirq.Result]
__len__
__len__() -> int
View source on GitHub