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: Optional[cirq_google.cloud.quantum.QuantumJob
] = None,
job_result_future: Optional[duet.AwaitableFuture[Union[quantum.QuantumResult, quantum.QuantumJob]]
] = 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).
EngineJob
s can be iterated over, returning Result
s. These
Result
s 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() -> cirq_google.cloud.quantum.ExecutionStatus.State
Return the execution status of the job.
failure
failure() -> Optional[Tuple[str, str]]
Return failure code and message of the job if present.
get_calibration
get_calibration() -> Optional[cirq_google.engine.Calibration
]
Returns the recorded calibration at the time when the job was run, if one was captured, else None.
get_processor
get_processor() -> 'Optional[engine_processor.EngineProcessor]'
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