braket.tasks.quantum_task module

class braket.tasks.quantum_task.QuantumTask[source]

Bases: ABC

An abstraction over a quantum task on a quantum device.

abstract property id: str

Get the quantum task ID.

Returns:

str – The quantum task ID.

abstract cancel() None[source]

Cancel the quantum task.

abstract state() str[source]

Get the state of the quantum task.

Returns:

str – State of the quantum task.

abstract result() GateModelQuantumTaskResult | AnnealingQuantumTaskResult | PhotonicModelQuantumTaskResult[source]

Get the quantum task result.

Returns:

Union[GateModelQuantumTaskResult, AnnealingQuantumTaskResult, PhotonicModelQuantumTaskResult] – Get the quantum task result. Call async_result if you want the result in an asynchronous way.

abstract async_result() Task[source]

Get the quantum task result asynchronously.

Returns:

asyncio.Task – Get the quantum task result asynchronously.

metadata(use_cached_value: bool = False) dict[str, Any][source]

Get task metadata.

Parameters:

use_cached_value (bool) – If True, uses the value retrieved from the previous request. Default is False.

Returns:

dict[str, Any] – The metadata regarding the quantum task. If use_cached_value is True, then the value retrieved from the most recent request is used.