AbstractRemoteTask
dataclass
AbstractRemoteTask(
kernel: Method[Params, RetType],
args: tuple[Any, ...],
kwargs: dict[str, Any],
)
Bases: AbstractTask[Params, RetType]
Base class for tasks generated by the devices.
run_async
abstractmethod
run_async(*, shots: int = 1) -> BatchFuture[RetType]
Executes the kernel asynchronously and returns a Future object.
Source code in .venv/lib/python3.12/site-packages/bloqade/task.py
73 74 75 |
|
AbstractSimulatorTask
dataclass
AbstractSimulatorTask(
kernel: Method[Params, RetType],
args: tuple[Any, ...],
kwargs: dict[str, Any],
)
Bases: AbstractTask[Params, RetType]
, Generic[Params, RetType, StateType]
Base class for tasks generated by local simulators.
state
abstractmethod
property
state: StateType
Returns the state of the simulator after running the task.
run
abstractmethod
run() -> RetType
Executes the kernel and returns the result.
Source code in .venv/lib/python3.12/site-packages/bloqade/task.py
87 88 89 |
|
BatchFuture
Bases: ABC
, Generic[RetType]
Protocol for future objects that can be awaited.
cancel
cancel()
Attempts to cancel the execution of the future.
Source code in .venv/lib/python3.12/site-packages/bloqade/task.py
28 29 30 31 32 |
|
cancelled
cancelled() -> bool
Returns True if the future was cancelled, False otherwise.
Source code in .venv/lib/python3.12/site-packages/bloqade/task.py
34 35 36 37 38 |
|
fetch
abstractmethod
fetch() -> None
Fetches the result of the future that are currently available.
Source code in .venv/lib/python3.12/site-packages/bloqade/task.py
24 25 26 |
|
partial_result
abstractmethod
partial_result() -> list[RetType | MISSING_RESULT]
Return all results that are available so far, or MISSING_RESULT for those that are not yet available.
Source code in .venv/lib/python3.12/site-packages/bloqade/task.py
20 21 22 |
|
result
abstractmethod
result(timeout: float | None) -> list[RetType]
Returns the result of the future, blocking until it is available or the timeout expires.
Source code in .venv/lib/python3.12/site-packages/bloqade/task.py
16 17 18 |
|
DeviceTaskExpectMixin
dataclass
DeviceTaskExpectMixin(
kernel: Method[Params, RetType],
args: tuple[Any, ...],
kwargs: dict[str, Any],
)
Bases: AbstractTask
expect
abstractmethod
expect(
observable: Method[[RetType], ObsType], shots: int
) -> ObsType
Returns the expectation value of the given observable after running the task.
Source code in .venv/lib/python3.12/site-packages/bloqade/task.py
61 62 63 |
|