LocalStorage#

Module: exa.core.local_storage

class LocalStorage(path=None)#

Bases: StorageInterface

Local, in-memory implementation of StorageInterface.

Only observation and observation set related methods are implemented; all other methods raise NotImplementedError. State lives in memory by default; pass path to also persist it to a JSON file, which is loaded on construction (if it already exists) and transparently rewritten after every create/update operation.

Methods

create_observation_set

Create the set in memory, resolve its dut_label from constituents, and persist.

create_observations

Assign each definition a new sequential id and the current timestamp, then persist if configured.

create_sequence_metadata

Not implemented: LocalStorage has no concept of sequence metadata.

deserialize

Build an instance from a dict produced by serialize(); overrides Serializable.

finalize_observation_set

Set end_timestamp on the set in memory and persist; a no-op if already finalized.

get_calibration_set

Not implemented: LocalStorage has no concept of calibration sets.

get_calibration_set_quality_metric_set

Not implemented: LocalStorage has no concept of calibration or quality metric sets.

get_chip_design_record

Not implemented: LocalStorage has no concept of chip design records.

get_dut_fields

Not implemented: LocalStorage does not track which dut fields have been observed.

get_dynamic_quantum_architecture

Not implemented: LocalStorage has no concept of calibration sets.

get_observation_set

Look up the observation set by id in memory.

get_observation_set_observations

Look up the set's constituent observations from the in-memory observation store.

get_run

Not implemented: LocalStorage has no concept of runs.

get_sequence_result

Not implemented: LocalStorage has no concept of sequence results.

query_observation_sets

Filter, sort and limit the in-memory sets; see _OBSERVATION_SET_MATCHERS for lookups.

query_observations

Filter, sort and limit the in-memory observations; see _OBSERVATION_MATCHERS for lookups.

query_runs

Not implemented: LocalStorage has no concept of runs.

query_sequence_metadatas

Not implemented: LocalStorage has no concept of sequence metadata.

save_sequence_result

Not implemented: LocalStorage has no concept of sequence results.

serialize

Serialize the current state to a dict; overrides Serializable.

update_observation_set

Merge new observation ids into the set in memory, recompute dut_label, and persist.

update_observations

Replace each observation in memory with a copy carrying the updated invalid flag, then persist.

Parameters:

path (str | Path | None)

create_observations(observation_definitions)#

Assign each definition a new sequential id and the current timestamp, then persist if configured.

Parameters:

observation_definitions (Sequence[ObservationDefinition])

Return type:

list[ObservationData]

query_observations(**kwargs)#

Filter, sort and limit the in-memory observations; see _OBSERVATION_MATCHERS for lookups.

Parameters:

kwargs (Any)

Return type:

Iterator[ObservationData]

update_observations(observation_updates)#

Replace each observation in memory with a copy carrying the updated invalid flag, then persist.

Parameters:

observation_updates (Sequence[ObservationUpdate])

Return type:

list[ObservationData]

query_observation_sets(**kwargs)#

Filter, sort and limit the in-memory sets; see _OBSERVATION_SET_MATCHERS for lookups.

Parameters:

kwargs (Any)

Return type:

Iterator[ObservationSetData]

create_observation_set(observation_set_definition)#

Create the set in memory, resolve its dut_label from constituents, and persist.

Parameters:

observation_set_definition (ObservationSetDefinition)

Return type:

ObservationSetData

get_observation_set(observation_set_id)#

Look up the observation set by id in memory.

Parameters:

observation_set_id (str | UUID)

Return type:

ObservationSetData

update_observation_set(observation_set_update)#

Merge new observation ids into the set in memory, recompute dut_label, and persist.

Raises:

ConflictError – If the set is already finalized and new observation ids are given.

Parameters:

observation_set_update (ObservationSetUpdate)

Return type:

ObservationSetData

finalize_observation_set(observation_set_id)#

Set end_timestamp on the set in memory and persist; a no-op if already finalized.

Parameters:

observation_set_id (str | UUID)

Return type:

None

get_observation_set_observations(observation_set_id)#

Look up the set’s constituent observations from the in-memory observation store.

Parameters:

observation_set_id (str | UUID)

Return type:

list[ObservationData]

get_calibration_set(calibration_set_id)#

Not implemented: LocalStorage has no concept of calibration sets.

Parameters:

calibration_set_id (str | UUID | Literal['default'])

Return type:

ObservationSetWithObservationData

get_dynamic_quantum_architecture(calibration_set_id)#

Not implemented: LocalStorage has no concept of calibration sets.

Parameters:

calibration_set_id (str | UUID | Literal['default'])

Return type:

DynamicQuantumArchitecture

get_calibration_set_quality_metric_set(calibration_set_id)#

Not implemented: LocalStorage has no concept of calibration or quality metric sets.

Parameters:

calibration_set_id (str | UUID | Literal['default'])

Return type:

ObservationSetWithObservationData

get_chip_design_record(dut_label)#

Not implemented: LocalStorage has no concept of chip design records.

Parameters:

dut_label (str)

Return type:

dict[str, Any]

get_run(run_id)#

Not implemented: LocalStorage has no concept of runs.

Parameters:

run_id (str | UUID)

Return type:

RunData

query_runs(**kwargs)#

Not implemented: LocalStorage has no concept of runs.

Parameters:

kwargs (Any)

Return type:

Iterator[RunLite]

get_dut_fields(dut_label)#

Not implemented: LocalStorage does not track which dut fields have been observed.

Parameters:

dut_label (str)

Return type:

list[DutFieldData]

query_sequence_metadatas(**kwargs)#

Not implemented: LocalStorage has no concept of sequence metadata.

Parameters:

kwargs (Any)

Return type:

Iterator[SequenceMetadataData]

create_sequence_metadata(sequence_metadata_definition)#

Not implemented: LocalStorage has no concept of sequence metadata.

Parameters:

sequence_metadata_definition (SequenceMetadataDefinition)

Return type:

SequenceMetadataData

save_sequence_result(sequence_result_definition)#

Not implemented: LocalStorage has no concept of sequence results.

Parameters:

sequence_result_definition (SequenceResultDefinition)

Return type:

SequenceResultData

get_sequence_result(sequence_id)#

Not implemented: LocalStorage has no concept of sequence results.

Parameters:

sequence_id (str | UUID)

Return type:

SequenceResultData

serialize()#

Serialize the current state to a dict; overrides Serializable.

Not meant to be called directly: it exists to satisfy Serializable, and is used internally to implement disk persistence.

Return type:

dict[str, Any]

classmethod deserialize(data)#

Build an instance from a dict produced by serialize(); overrides Serializable.

Not meant to be called directly: it exists to satisfy Serializable, and is used internally to implement disk persistence.

Parameters:

data (dict[str, Any])

Return type:

LocalStorage

Inheritance

Inheritance diagram of exa.core.local_storage.LocalStorage