Module enrgdaq.daq.store.models

Classes

class DAQJobMessageStore (store_config: DAQJobStoreConfig,
tag: str | None = None,
*,
id: str | None = <factory>,
timestamp: datetime.datetime | None = <factory>,
is_remote: bool = False,
daq_job_info: DAQJobInfo | None = None,
remote_config: DAQRemoteConfig = <factory>)
Expand source code
class DAQJobMessageStore(DAQJobMessage):
    """
    DAQJobMessageStore is a class that extends DAQJobMessage and is used to store
    configuration and data related to a DAQ (Data Acquisition) job.
    Attributes:
        store_config (DAQJobStoreConfig): Configuration for the DAQ job store.
        tag (str | None): Optional tag associated with the message.
    """

    store_config: DAQJobStoreConfig
    tag: str | None = None

    def get_remote_config(self) -> Optional[DAQRemoteConfig]:
        """
        Retrieves the remote configuration from the store_config.
        Iterates through the attributes of `self.store_config` to find an instance
        of `DAQJobStoreConfigBase` that has a non-None `remote_config` attribute.
        Returns:
            Optional[DAQRemoteConfig]: The remote configuration if found, otherwise None.
        """

        for key in dir(self.store_config):
            value = getattr(self.store_config, key)
            if not isinstance(value, DAQJobStoreConfigBase):
                continue
            if value.remote_config is None:
                continue
            return value.remote_config
        return None

DAQJobMessageStore is a class that extends DAQJobMessage and is used to store configuration and data related to a DAQ (Data Acquisition) job.

Attributes

store_config : DAQJobStoreConfig
Configuration for the DAQ job store.
tag : str | None
Optional tag associated with the message.

Ancestors

Subclasses

Instance variables

var store_configDAQJobStoreConfig
Expand source code
class DAQJobMessageStore(DAQJobMessage):
    """
    DAQJobMessageStore is a class that extends DAQJobMessage and is used to store
    configuration and data related to a DAQ (Data Acquisition) job.
    Attributes:
        store_config (DAQJobStoreConfig): Configuration for the DAQ job store.
        tag (str | None): Optional tag associated with the message.
    """

    store_config: DAQJobStoreConfig
    tag: str | None = None

    def get_remote_config(self) -> Optional[DAQRemoteConfig]:
        """
        Retrieves the remote configuration from the store_config.
        Iterates through the attributes of `self.store_config` to find an instance
        of `DAQJobStoreConfigBase` that has a non-None `remote_config` attribute.
        Returns:
            Optional[DAQRemoteConfig]: The remote configuration if found, otherwise None.
        """

        for key in dir(self.store_config):
            value = getattr(self.store_config, key)
            if not isinstance(value, DAQJobStoreConfigBase):
                continue
            if value.remote_config is None:
                continue
            return value.remote_config
        return None
var tag : str | None
Expand source code
class DAQJobMessageStore(DAQJobMessage):
    """
    DAQJobMessageStore is a class that extends DAQJobMessage and is used to store
    configuration and data related to a DAQ (Data Acquisition) job.
    Attributes:
        store_config (DAQJobStoreConfig): Configuration for the DAQ job store.
        tag (str | None): Optional tag associated with the message.
    """

    store_config: DAQJobStoreConfig
    tag: str | None = None

    def get_remote_config(self) -> Optional[DAQRemoteConfig]:
        """
        Retrieves the remote configuration from the store_config.
        Iterates through the attributes of `self.store_config` to find an instance
        of `DAQJobStoreConfigBase` that has a non-None `remote_config` attribute.
        Returns:
            Optional[DAQRemoteConfig]: The remote configuration if found, otherwise None.
        """

        for key in dir(self.store_config):
            value = getattr(self.store_config, key)
            if not isinstance(value, DAQJobStoreConfigBase):
                continue
            if value.remote_config is None:
                continue
            return value.remote_config
        return None

Methods

def get_remote_config(self) ‑> DAQRemoteConfig | None
Expand source code
def get_remote_config(self) -> Optional[DAQRemoteConfig]:
    """
    Retrieves the remote configuration from the store_config.
    Iterates through the attributes of `self.store_config` to find an instance
    of `DAQJobStoreConfigBase` that has a non-None `remote_config` attribute.
    Returns:
        Optional[DAQRemoteConfig]: The remote configuration if found, otherwise None.
    """

    for key in dir(self.store_config):
        value = getattr(self.store_config, key)
        if not isinstance(value, DAQJobStoreConfigBase):
            continue
        if value.remote_config is None:
            continue
        return value.remote_config
    return None

Retrieves the remote configuration from the store_config. Iterates through the attributes of self.store_config to find an instance of DAQJobStoreConfigBase that has a non-None remote_config attribute.

Returns

Optional[DAQRemoteConfig]
The remote configuration if found, otherwise None.
class DAQJobMessageStoreRaw (store_config: DAQJobStoreConfig,
tag: str | None = None,
*,
id: str | None = <factory>,
timestamp: datetime.datetime | None = <factory>,
is_remote: bool = False,
daq_job_info: DAQJobInfo | None = None,
remote_config: DAQRemoteConfig = <factory>,
data: bytes)
Expand source code
class DAQJobMessageStoreRaw(DAQJobMessageStore, kw_only=True):
    """
    DAQJobMessageStoreRaw is a class that inherits from DAQJobMessageStore and represents
    a raw data message store for DAQ jobs.
    Attributes:
        data (bytes): The raw data associated with the DAQ job message.
    """

    data: bytes

DAQJobMessageStoreRaw is a class that inherits from DAQJobMessageStore and represents a raw data message store for DAQ jobs.

Attributes

data : bytes
The raw data associated with the DAQ job message.

Ancestors

Instance variables

var data : bytes
Expand source code
class DAQJobMessageStoreRaw(DAQJobMessageStore, kw_only=True):
    """
    DAQJobMessageStoreRaw is a class that inherits from DAQJobMessageStore and represents
    a raw data message store for DAQ jobs.
    Attributes:
        data (bytes): The raw data associated with the DAQ job message.
    """

    data: bytes

Inherited members

class DAQJobMessageStoreTabular (store_config: DAQJobStoreConfig,
tag: str | None = None,
*,
id: str | None = <factory>,
timestamp: datetime.datetime | None = <factory>,
is_remote: bool = False,
daq_job_info: DAQJobInfo | None = None,
remote_config: DAQRemoteConfig = <factory>,
keys: list[str],
data: list[list[str | float | int]])
Expand source code
class DAQJobMessageStoreTabular(DAQJobMessageStore, kw_only=True):
    """
    DAQJobMessageStoreTabular is a class that inherits from DAQJobMessageStore and represents a tabular data store for DAQ job messages.
    Attributes:
        keys (list[str]): A list of strings representing the keys or column names of the tabular data.
        data (list[list[str | float | int]]): A list of lists where each inner list represents a row of data..
    """

    keys: list[str]
    data: list[list[str | float | int]]

DAQJobMessageStoreTabular is a class that inherits from DAQJobMessageStore and represents a tabular data store for DAQ job messages.

Attributes

keys : list[str]
A list of strings representing the keys or column names of the tabular data.
data : list[list[str | float | int]]
A list of lists where each inner list represents a row of data..

Ancestors

Instance variables

var data : list[list[str | float | int]]
Expand source code
class DAQJobMessageStoreTabular(DAQJobMessageStore, kw_only=True):
    """
    DAQJobMessageStoreTabular is a class that inherits from DAQJobMessageStore and represents a tabular data store for DAQ job messages.
    Attributes:
        keys (list[str]): A list of strings representing the keys or column names of the tabular data.
        data (list[list[str | float | int]]): A list of lists where each inner list represents a row of data..
    """

    keys: list[str]
    data: list[list[str | float | int]]
var keys : list[str]
Expand source code
class DAQJobMessageStoreTabular(DAQJobMessageStore, kw_only=True):
    """
    DAQJobMessageStoreTabular is a class that inherits from DAQJobMessageStore and represents a tabular data store for DAQ job messages.
    Attributes:
        keys (list[str]): A list of strings representing the keys or column names of the tabular data.
        data (list[list[str | float | int]]): A list of lists where each inner list represents a row of data..
    """

    keys: list[str]
    data: list[list[str | float | int]]

Inherited members

class DAQJobStoreConfig (csv: DAQJobStoreConfigCSV | None = None,
root: DAQJobStoreConfigROOT | None = None,
mysql: DAQJobStoreConfigMySQL | None = None,
redis: DAQJobStoreConfigRedis | None = None,
raw: DAQJobStoreConfigRaw | None = None)
Expand source code
class DAQJobStoreConfig(Struct, dict=True):
    """
    Used to store the configuration of the DAQ Job Store, usually inside DAQJobConfig.
    """

    csv: "Optional[DAQJobStoreConfigCSV]" = None
    root: "Optional[DAQJobStoreConfigROOT]" = None
    mysql: "Optional[DAQJobStoreConfigMySQL]" = None
    redis: "Optional[DAQJobStoreConfigRedis]" = None
    raw: "Optional[DAQJobStoreConfigRaw]" = None

    def has_store_config(self, store_type: Any) -> bool:
        for key in dir(self):
            if key.startswith("_"):
                continue
            value = getattr(self, key)
            if isinstance(value, store_type):
                return True
        return False

Used to store the configuration of the DAQ Job Store, usually inside DAQJobConfig.

Ancestors

  • msgspec.Struct
  • msgspec._core._StructMixin

Instance variables

var csvDAQJobStoreConfigCSV | None
Expand source code
class DAQJobStoreConfig(Struct, dict=True):
    """
    Used to store the configuration of the DAQ Job Store, usually inside DAQJobConfig.
    """

    csv: "Optional[DAQJobStoreConfigCSV]" = None
    root: "Optional[DAQJobStoreConfigROOT]" = None
    mysql: "Optional[DAQJobStoreConfigMySQL]" = None
    redis: "Optional[DAQJobStoreConfigRedis]" = None
    raw: "Optional[DAQJobStoreConfigRaw]" = None

    def has_store_config(self, store_type: Any) -> bool:
        for key in dir(self):
            if key.startswith("_"):
                continue
            value = getattr(self, key)
            if isinstance(value, store_type):
                return True
        return False
var mysqlDAQJobStoreConfigMySQL | None
Expand source code
class DAQJobStoreConfig(Struct, dict=True):
    """
    Used to store the configuration of the DAQ Job Store, usually inside DAQJobConfig.
    """

    csv: "Optional[DAQJobStoreConfigCSV]" = None
    root: "Optional[DAQJobStoreConfigROOT]" = None
    mysql: "Optional[DAQJobStoreConfigMySQL]" = None
    redis: "Optional[DAQJobStoreConfigRedis]" = None
    raw: "Optional[DAQJobStoreConfigRaw]" = None

    def has_store_config(self, store_type: Any) -> bool:
        for key in dir(self):
            if key.startswith("_"):
                continue
            value = getattr(self, key)
            if isinstance(value, store_type):
                return True
        return False
var rawDAQJobStoreConfigRaw | None
Expand source code
class DAQJobStoreConfig(Struct, dict=True):
    """
    Used to store the configuration of the DAQ Job Store, usually inside DAQJobConfig.
    """

    csv: "Optional[DAQJobStoreConfigCSV]" = None
    root: "Optional[DAQJobStoreConfigROOT]" = None
    mysql: "Optional[DAQJobStoreConfigMySQL]" = None
    redis: "Optional[DAQJobStoreConfigRedis]" = None
    raw: "Optional[DAQJobStoreConfigRaw]" = None

    def has_store_config(self, store_type: Any) -> bool:
        for key in dir(self):
            if key.startswith("_"):
                continue
            value = getattr(self, key)
            if isinstance(value, store_type):
                return True
        return False
var redisDAQJobStoreConfigRedis | None
Expand source code
class DAQJobStoreConfig(Struct, dict=True):
    """
    Used to store the configuration of the DAQ Job Store, usually inside DAQJobConfig.
    """

    csv: "Optional[DAQJobStoreConfigCSV]" = None
    root: "Optional[DAQJobStoreConfigROOT]" = None
    mysql: "Optional[DAQJobStoreConfigMySQL]" = None
    redis: "Optional[DAQJobStoreConfigRedis]" = None
    raw: "Optional[DAQJobStoreConfigRaw]" = None

    def has_store_config(self, store_type: Any) -> bool:
        for key in dir(self):
            if key.startswith("_"):
                continue
            value = getattr(self, key)
            if isinstance(value, store_type):
                return True
        return False
var rootDAQJobStoreConfigROOT | None
Expand source code
class DAQJobStoreConfig(Struct, dict=True):
    """
    Used to store the configuration of the DAQ Job Store, usually inside DAQJobConfig.
    """

    csv: "Optional[DAQJobStoreConfigCSV]" = None
    root: "Optional[DAQJobStoreConfigROOT]" = None
    mysql: "Optional[DAQJobStoreConfigMySQL]" = None
    redis: "Optional[DAQJobStoreConfigRedis]" = None
    raw: "Optional[DAQJobStoreConfigRaw]" = None

    def has_store_config(self, store_type: Any) -> bool:
        for key in dir(self):
            if key.startswith("_"):
                continue
            value = getattr(self, key)
            if isinstance(value, store_type):
                return True
        return False

Methods

def has_store_config(self, store_type: Any) ‑> bool
Expand source code
def has_store_config(self, store_type: Any) -> bool:
    for key in dir(self):
        if key.startswith("_"):
            continue
        value = getattr(self, key)
        if isinstance(value, store_type):
            return True
    return False
class DAQJobStoreConfigBase (*,
remote_config: DAQRemoteConfig | None = None)
Expand source code
class DAQJobStoreConfigBase(Struct, kw_only=True):
    """
    DAQJobStoreConfigBase is a configuration class for DAQ job store,
    that is expected to be extended by specific store configurations, such as CSV, MySQL, etc.

    Attributes:
        remote_config (Optional[DAQRemoteConfig]): Configuration for remote DAQ.
    """

    remote_config: Optional[DAQRemoteConfig] = None

DAQJobStoreConfigBase is a configuration class for DAQ job store, that is expected to be extended by specific store configurations, such as CSV, MySQL, etc.

Attributes

remote_config : Optional[DAQRemoteConfig]
Configuration for remote DAQ.

Ancestors

  • msgspec.Struct
  • msgspec._core._StructMixin

Subclasses

Instance variables

var remote_configDAQRemoteConfig | None
Expand source code
class DAQJobStoreConfigBase(Struct, kw_only=True):
    """
    DAQJobStoreConfigBase is a configuration class for DAQ job store,
    that is expected to be extended by specific store configurations, such as CSV, MySQL, etc.

    Attributes:
        remote_config (Optional[DAQRemoteConfig]): Configuration for remote DAQ.
    """

    remote_config: Optional[DAQRemoteConfig] = None
class DAQJobStoreConfigCSV (file_path: str,
add_date: bool = False,
overwrite: bool = False,
use_gzip: bool = False,
*,
remote_config: DAQRemoteConfig | None = None)
Expand source code
class DAQJobStoreConfigCSV(DAQJobStoreConfigBase):
    file_path: str
    """
    File path to store data in.
    """

    add_date: bool = False
    """
    Include the date in the file path.
    """

    overwrite: bool = False
    """
    Overwrite the file contents.
    """

    use_gzip: bool = False
    """
    Use gzip compression.
    """

DAQJobStoreConfigBase is a configuration class for DAQ job store, that is expected to be extended by specific store configurations, such as CSV, MySQL, etc.

Attributes

remote_config : Optional[DAQRemoteConfig]
Configuration for remote DAQ.

Ancestors

Instance variables

var add_date : bool
Expand source code
class DAQJobStoreConfigCSV(DAQJobStoreConfigBase):
    file_path: str
    """
    File path to store data in.
    """

    add_date: bool = False
    """
    Include the date in the file path.
    """

    overwrite: bool = False
    """
    Overwrite the file contents.
    """

    use_gzip: bool = False
    """
    Use gzip compression.
    """

Include the date in the file path.

var file_path : str
Expand source code
class DAQJobStoreConfigCSV(DAQJobStoreConfigBase):
    file_path: str
    """
    File path to store data in.
    """

    add_date: bool = False
    """
    Include the date in the file path.
    """

    overwrite: bool = False
    """
    Overwrite the file contents.
    """

    use_gzip: bool = False
    """
    Use gzip compression.
    """

File path to store data in.

var overwrite : bool
Expand source code
class DAQJobStoreConfigCSV(DAQJobStoreConfigBase):
    file_path: str
    """
    File path to store data in.
    """

    add_date: bool = False
    """
    Include the date in the file path.
    """

    overwrite: bool = False
    """
    Overwrite the file contents.
    """

    use_gzip: bool = False
    """
    Use gzip compression.
    """

Overwrite the file contents.

var use_gzip : bool
Expand source code
class DAQJobStoreConfigCSV(DAQJobStoreConfigBase):
    file_path: str
    """
    File path to store data in.
    """

    add_date: bool = False
    """
    Include the date in the file path.
    """

    overwrite: bool = False
    """
    Overwrite the file contents.
    """

    use_gzip: bool = False
    """
    Use gzip compression.
    """

Use gzip compression.

class DAQJobStoreConfigMySQL (table_name: str,
*,
remote_config: DAQRemoteConfig | None = None)
Expand source code
class DAQJobStoreConfigMySQL(DAQJobStoreConfigBase):
    table_name: str

DAQJobStoreConfigBase is a configuration class for DAQ job store, that is expected to be extended by specific store configurations, such as CSV, MySQL, etc.

Attributes

remote_config : Optional[DAQRemoteConfig]
Configuration for remote DAQ.

Ancestors

Instance variables

var table_name : str
Expand source code
class DAQJobStoreConfigMySQL(DAQJobStoreConfigBase):
    table_name: str
class DAQJobStoreConfigROOT (file_path: str,
add_date: bool,
*,
remote_config: DAQRemoteConfig | None = None)
Expand source code
class DAQJobStoreConfigROOT(DAQJobStoreConfigBase):
    file_path: str
    add_date: bool

DAQJobStoreConfigBase is a configuration class for DAQ job store, that is expected to be extended by specific store configurations, such as CSV, MySQL, etc.

Attributes

remote_config : Optional[DAQRemoteConfig]
Configuration for remote DAQ.

Ancestors

Instance variables

var add_date : bool
Expand source code
class DAQJobStoreConfigROOT(DAQJobStoreConfigBase):
    file_path: str
    add_date: bool
var file_path : str
Expand source code
class DAQJobStoreConfigROOT(DAQJobStoreConfigBase):
    file_path: str
    add_date: bool
class DAQJobStoreConfigRaw (file_path: str,
add_date: bool = False,
overwrite: bool = True,
*,
remote_config: DAQRemoteConfig | None = None)
Expand source code
class DAQJobStoreConfigRaw(DAQJobStoreConfigBase):
    file_path: str
    """
    File path to store data in.
    """

    add_date: bool = False
    """
    Overwrite the file contents always.
    """

    overwrite: bool = True
    """
    Overwrite the file contents.
    """

DAQJobStoreConfigBase is a configuration class for DAQ job store, that is expected to be extended by specific store configurations, such as CSV, MySQL, etc.

Attributes

remote_config : Optional[DAQRemoteConfig]
Configuration for remote DAQ.

Ancestors

Instance variables

var add_date : bool
Expand source code
class DAQJobStoreConfigRaw(DAQJobStoreConfigBase):
    file_path: str
    """
    File path to store data in.
    """

    add_date: bool = False
    """
    Overwrite the file contents always.
    """

    overwrite: bool = True
    """
    Overwrite the file contents.
    """

Overwrite the file contents always.

var file_path : str
Expand source code
class DAQJobStoreConfigRaw(DAQJobStoreConfigBase):
    file_path: str
    """
    File path to store data in.
    """

    add_date: bool = False
    """
    Overwrite the file contents always.
    """

    overwrite: bool = True
    """
    Overwrite the file contents.
    """

File path to store data in.

var overwrite : bool
Expand source code
class DAQJobStoreConfigRaw(DAQJobStoreConfigBase):
    file_path: str
    """
    File path to store data in.
    """

    add_date: bool = False
    """
    Overwrite the file contents always.
    """

    overwrite: bool = True
    """
    Overwrite the file contents.
    """

Overwrite the file contents.

class DAQJobStoreConfigRedis (key: str,
key_expiration_days: int | None = None,
use_timeseries: bool | None = None,
*,
remote_config: DAQRemoteConfig | None = None)
Expand source code
class DAQJobStoreConfigRedis(DAQJobStoreConfigBase):
    key: str
    """
    Redis key to store data in.
    
    Data keys will be prefixed with the redis_key, e.g. for the data key "test", the redis key will be "redis_key.test".
    
    If the expiration is set, the key will be prefixed with the date, e.g. for the data key "test", the redis key will be "redis_key.test:2023-01-01".
    """

    key_expiration_days: Optional[int] = None
    """
    Delete keys older than this number of days.
    
    If None, keys will not be deleted.
    """

    use_timeseries: Optional[bool] = None
    """
    Utilize Redis Timeseries to store data.

    A key called "timestamp" is requires when using timeseries.
    """

DAQJobStoreConfigBase is a configuration class for DAQ job store, that is expected to be extended by specific store configurations, such as CSV, MySQL, etc.

Attributes

remote_config : Optional[DAQRemoteConfig]
Configuration for remote DAQ.

Ancestors

Instance variables

var key : str
Expand source code
class DAQJobStoreConfigRedis(DAQJobStoreConfigBase):
    key: str
    """
    Redis key to store data in.
    
    Data keys will be prefixed with the redis_key, e.g. for the data key "test", the redis key will be "redis_key.test".
    
    If the expiration is set, the key will be prefixed with the date, e.g. for the data key "test", the redis key will be "redis_key.test:2023-01-01".
    """

    key_expiration_days: Optional[int] = None
    """
    Delete keys older than this number of days.
    
    If None, keys will not be deleted.
    """

    use_timeseries: Optional[bool] = None
    """
    Utilize Redis Timeseries to store data.

    A key called "timestamp" is requires when using timeseries.
    """

Redis key to store data in.

Data keys will be prefixed with the redis_key, e.g. for the data key "test", the redis key will be "redis_key.test".

If the expiration is set, the key will be prefixed with the date, e.g. for the data key "test", the redis key will be "redis_key.test:2023-01-01".

var key_expiration_days : int | None
Expand source code
class DAQJobStoreConfigRedis(DAQJobStoreConfigBase):
    key: str
    """
    Redis key to store data in.
    
    Data keys will be prefixed with the redis_key, e.g. for the data key "test", the redis key will be "redis_key.test".
    
    If the expiration is set, the key will be prefixed with the date, e.g. for the data key "test", the redis key will be "redis_key.test:2023-01-01".
    """

    key_expiration_days: Optional[int] = None
    """
    Delete keys older than this number of days.
    
    If None, keys will not be deleted.
    """

    use_timeseries: Optional[bool] = None
    """
    Utilize Redis Timeseries to store data.

    A key called "timestamp" is requires when using timeseries.
    """

Delete keys older than this number of days.

If None, keys will not be deleted.

var use_timeseries : bool | None
Expand source code
class DAQJobStoreConfigRedis(DAQJobStoreConfigBase):
    key: str
    """
    Redis key to store data in.
    
    Data keys will be prefixed with the redis_key, e.g. for the data key "test", the redis key will be "redis_key.test".
    
    If the expiration is set, the key will be prefixed with the date, e.g. for the data key "test", the redis key will be "redis_key.test:2023-01-01".
    """

    key_expiration_days: Optional[int] = None
    """
    Delete keys older than this number of days.
    
    If None, keys will not be deleted.
    """

    use_timeseries: Optional[bool] = None
    """
    Utilize Redis Timeseries to store data.

    A key called "timestamp" is requires when using timeseries.
    """

Utilize Redis Timeseries to store data.

A key called "timestamp" is requires when using timeseries.

class StorableDAQJobConfig (store_config: DAQJobStoreConfig,
*,
verbosity: LogVerbosity = LogVerbosity.INFO,
remote_config: DAQRemoteConfig | None = <factory>,
daq_job_type: str)
Expand source code
class StorableDAQJobConfig(DAQJobConfig):
    store_config: DAQJobStoreConfig

DAQJobConfig is the base configuration class for DAQJobs.

Attributes

verbosity : LogVerbosity
The verbosity level for logging. Defaults to LogVerbosity.INFO.
remote_config : Optional[DAQRemoteConfig]
The remote configuration for the DAQ job. Defaults to an instance of DAQRemoteConfig.
daq_job_type : str
The type of the DAQ job.

Ancestors

Subclasses

Instance variables

var store_configDAQJobStoreConfig
Expand source code
class StorableDAQJobConfig(DAQJobConfig):
    store_config: DAQJobStoreConfig