Skip to content

bloqade.core.device.local_storage.DictStorage

← Module overview

classDictStoragesource

bloqade.core.device.local_storage.DictStorage

Bases: StorageBackend

In-memory storage backend for shot results.

class DictStorage

This backend is useful for tests, examples, and short-lived sessions. Data is not persisted across Python processes.

methodadd_shotssource

bloqade.core.device.local_storage.DictStorage.add_shots

def add_shots(shots: Iterable[ShotResult]) -> None

Store shot result rows in memory.

Parameters

NameTypeDescription
shotsIterable[ShotResult]Shot rows to store.
source

methodget_shotssource

bloqade.core.device.local_storage.DictStorage.get_shots

Signature
def get_shots(*, shot_filter: ShotFilter | None = None) -> Iterable[ShotResult]

Return in-memory shot rows matching a filter.

Parameters

NameTypeDefaultDescription
shot_filterShotFilter | NoneNone

Other Parameters

NameTypeDescription
shot_filterShotFilter | NoneOptional shot filter. When None, all shots are returned. Defaults to None.

Returns

Iterable[ShotResult]Matching shot rows.

source

methodtask_idssource

bloqade.core.device.local_storage.DictStorage.task_ids

def task_ids() -> set[str]

Return task IDs with stored task definitions.

Returns

set[str]Stored task IDs.

source

methodadd_task_definitionsource

bloqade.core.device.local_storage.DictStorage.add_task_definition

Signature
def add_task_definition(task_id: str, task_definition: TaskDefinition, creation_time: datetime.datetime)

Store a task definition and creation time in memory.

Parameters

NameTypeDescription
task_idstrBackend task ID.
task_definitionTaskDefinitionTask definition to store.
creation_timedatetime.datetimeBackend task creation time.
source

methodget_program_languagesource

bloqade.core.device.local_storage.DictStorage.get_program_language

def get_program_language(task_id: str) -> str

Return the program language for a stored task definition.

Parameters

NameTypeDescription
task_idstrBackend task ID.

Returns

strstr: Stored program language.

Raises

TypeDescription
KeyErrorIf `task_id` is not present.
source

methodget_profile_idsource

bloqade.core.device.local_storage.DictStorage.get_profile_id

def get_profile_id(task_id: str) -> UUID | None

Parameters

NameTypeDescription
task_idstr

Returns

UUID | None

source

methodget_task_creation_timesource

bloqade.core.device.local_storage.DictStorage.get_task_creation_time

def get_task_creation_time(task_id: str) -> datetime.datetime

Return the creation time for a stored task.

Parameters

NameTypeDescription
task_idstrBackend task ID.

Returns

datetime.datetimeStored task creation time.

Raises

TypeDescription
KeyErrorIf `task_id` is not present.
source

methodget_task_group_idsource

bloqade.core.device.local_storage.DictStorage.get_task_group_id

def get_task_group_id(task_id: str) -> UUID | None

Return the QLAM group stored for a task definition.

Parameters

NameTypeDescription
task_idstr

Returns

UUID | None

source

methodget_programssource

bloqade.core.device.local_storage.DictStorage.get_programs

def get_programs(task_ids: tuple[str, ...] | None = None) -> list[dict]

Return stored program records.

Parameters

NameTypeDefaultDescription
task_idstuple[str, ...] | NoneNoneOptional task IDs to include. When None, programs for all stored tasks are returned. Defaults to None.

Returns

list[dict]Independent program dictionaries.

source

methodget_subtaskssource

bloqade.core.device.local_storage.DictStorage.get_subtasks

Signature
def get_subtasks(storage_filter: StorageFilter | None = None) -> list[dict]

Return stored subtask records.

Parameters

NameTypeDefaultDescription
storage_filterStorageFilter | NoneNoneOptional metadata filter. When None, all subtasks are returned. Defaults to None.

Returns

list[dict]Independent subtask dictionaries.

source

methodupdate_subtasks_completed_datesource

bloqade.core.device.local_storage.DictStorage.update_subtasks_completed_date

Signature
def update_subtasks_completed_date(task_id, subtasks: list[dict]) -> None

Update completion times for stored subtasks.

Parameters

NameTypeDescription
task_idstrBackend task ID.
subtaskslist[dict]API subtask dictionaries containing `completed_date` and `shot_results` whose entries carry the `subtask_index`. The subtask object itself has no index.
source