Module enrgdaq.daq.models
Classes
class DAQJobConfig (*,
verbosity: LogVerbosity = LogVerbosity.INFO,
remote_config: DAQRemoteConfig | None = <factory>,
daq_job_type: str)-
Expand source code
class DAQJobConfig(Struct, kw_only=True): """ 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. """ verbosity: LogVerbosity = LogVerbosity.INFO remote_config: Optional[DAQRemoteConfig] = field(default_factory=DAQRemoteConfig) daq_job_type: strDAQJobConfig 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
- msgspec.Struct
- msgspec._core._StructMixin
Subclasses
- DAQJobAlertSlackConfig
- DAQJobHealthcheckConfig
- DAQJobRemoteConfig
- DAQJobRemoteProxyConfig
- DAQJobServeHTTPConfig
- DAQJobStoreCSVConfig
- DAQJobStoreMySQLConfig
- DAQJobStoreRawConfig
- DAQJobStoreRedisConfig
- DAQJobStoreROOTConfig
- StorableDAQJobConfig
Instance variables
var daq_job_type : str-
Expand source code
class DAQJobConfig(Struct, kw_only=True): """ 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. """ verbosity: LogVerbosity = LogVerbosity.INFO remote_config: Optional[DAQRemoteConfig] = field(default_factory=DAQRemoteConfig) daq_job_type: str var remote_config : DAQRemoteConfig | None-
Expand source code
class DAQJobConfig(Struct, kw_only=True): """ 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. """ verbosity: LogVerbosity = LogVerbosity.INFO remote_config: Optional[DAQRemoteConfig] = field(default_factory=DAQRemoteConfig) daq_job_type: str var verbosity : LogVerbosity-
Expand source code
class DAQJobConfig(Struct, kw_only=True): """ 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. """ verbosity: LogVerbosity = LogVerbosity.INFO remote_config: Optional[DAQRemoteConfig] = field(default_factory=DAQRemoteConfig) daq_job_type: str
class DAQJobInfo (daq_job_type: str,
daq_job_class_name: str,
unique_id: str,
instance_id: int,
supervisor_config: SupervisorConfig | None = None)-
Expand source code
@dataclass class DAQJobInfo: """ A class to represent the information of a DAQJob. Attributes: daq_job_type : str The type of the DAQ job. daq_job_class_name : str The class name of the DAQ job, typically the name of the class itself. unique_id : str A unique identifier for the DAQ job. instance_id : int An instance identifier for the DAQ job. supervisor_config : Optional[SupervisorConfig] Configuration for the supervisor, if any. """ daq_job_type: str daq_job_class_name: str # has type(self).__name__ unique_id: str instance_id: int supervisor_config: Optional[SupervisorConfig] = None @staticmethod def mock() -> "DAQJobInfo": return DAQJobInfo( daq_job_type="mock", daq_job_class_name="mock", unique_id="mock", instance_id=0, supervisor_config=SupervisorConfig(supervisor_id="mock"), )A class to represent the information of a DAQJob.
Attributes
daq_job_type : str The type of the DAQ job. daq_job_class_name : str The class name of the DAQ job, typically the name of the class itself. unique_id : str A unique identifier for the DAQ job. instance_id : int An instance identifier for the DAQ job. supervisor_config : Optional[SupervisorConfig] Configuration for the supervisor, if any.
Class variables
var daq_job_class_name : strvar daq_job_type : strvar instance_id : intvar supervisor_config : SupervisorConfig | Nonevar unique_id : str
Static methods
def mock() ‑> DAQJobInfo-
Expand source code
@staticmethod def mock() -> "DAQJobInfo": return DAQJobInfo( daq_job_type="mock", daq_job_class_name="mock", unique_id="mock", instance_id=0, supervisor_config=SupervisorConfig(supervisor_id="mock"), )
class DAQJobMessage (*,
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 DAQJobMessage(Struct, kw_only=True): """ DAQJobMessage is the base class for messages sent between DAQJobs. Attributes: id (Optional[str]): The unique identifier for the message. Defaults to a UUID. timestamp (Optional[datetime]): The timestamp for the message. Defaults to the current datetime. is_remote (bool): Whether the message is sent by a remote DAQJob. Defaults to False. daq_job_info (Optional[DAQJobInfo]): The information about the DAQJob that sent the message. Defaults to None. remote_config (DAQRemoteConfig): The remote configuration for the DAQ job. Defaults to an instance of DAQRemoteConfig. """ id: Optional[str] = field(default_factory=lambda: str(uuid.uuid4())) timestamp: Optional[datetime] = field(default_factory=datetime.now) is_remote: bool = False daq_job_info: Optional["DAQJobInfo"] = None remote_config: DAQRemoteConfig = field(default_factory=DAQRemoteConfig) @property def supervisor_id(self) -> str: if self.daq_job_info is None or self.daq_job_info.supervisor_config is None: return "unknown" return self.daq_job_info.supervisor_config.supervisor_idDAQJobMessage is the base class for messages sent between DAQJobs.
Attributes
id:Optional[str]- The unique identifier for the message. Defaults to a UUID.
timestamp:Optional[datetime]- The timestamp for the message. Defaults to the current datetime.
is_remote:bool- Whether the message is sent by a remote DAQJob. Defaults to False.
daq_job_info:Optional[DAQJobInfo]- The information about the DAQJob that sent the message. Defaults to None.
remote_config:DAQRemoteConfig- The remote configuration for the DAQ job. Defaults to an instance of DAQRemoteConfig.
Ancestors
- msgspec.Struct
- msgspec._core._StructMixin
Subclasses
Instance variables
var daq_job_info : DAQJobInfo | None-
Expand source code
class DAQJobMessage(Struct, kw_only=True): """ DAQJobMessage is the base class for messages sent between DAQJobs. Attributes: id (Optional[str]): The unique identifier for the message. Defaults to a UUID. timestamp (Optional[datetime]): The timestamp for the message. Defaults to the current datetime. is_remote (bool): Whether the message is sent by a remote DAQJob. Defaults to False. daq_job_info (Optional[DAQJobInfo]): The information about the DAQJob that sent the message. Defaults to None. remote_config (DAQRemoteConfig): The remote configuration for the DAQ job. Defaults to an instance of DAQRemoteConfig. """ id: Optional[str] = field(default_factory=lambda: str(uuid.uuid4())) timestamp: Optional[datetime] = field(default_factory=datetime.now) is_remote: bool = False daq_job_info: Optional["DAQJobInfo"] = None remote_config: DAQRemoteConfig = field(default_factory=DAQRemoteConfig) @property def supervisor_id(self) -> str: if self.daq_job_info is None or self.daq_job_info.supervisor_config is None: return "unknown" return self.daq_job_info.supervisor_config.supervisor_id var id : str | None-
Expand source code
class DAQJobMessage(Struct, kw_only=True): """ DAQJobMessage is the base class for messages sent between DAQJobs. Attributes: id (Optional[str]): The unique identifier for the message. Defaults to a UUID. timestamp (Optional[datetime]): The timestamp for the message. Defaults to the current datetime. is_remote (bool): Whether the message is sent by a remote DAQJob. Defaults to False. daq_job_info (Optional[DAQJobInfo]): The information about the DAQJob that sent the message. Defaults to None. remote_config (DAQRemoteConfig): The remote configuration for the DAQ job. Defaults to an instance of DAQRemoteConfig. """ id: Optional[str] = field(default_factory=lambda: str(uuid.uuid4())) timestamp: Optional[datetime] = field(default_factory=datetime.now) is_remote: bool = False daq_job_info: Optional["DAQJobInfo"] = None remote_config: DAQRemoteConfig = field(default_factory=DAQRemoteConfig) @property def supervisor_id(self) -> str: if self.daq_job_info is None or self.daq_job_info.supervisor_config is None: return "unknown" return self.daq_job_info.supervisor_config.supervisor_id var is_remote : bool-
Expand source code
class DAQJobMessage(Struct, kw_only=True): """ DAQJobMessage is the base class for messages sent between DAQJobs. Attributes: id (Optional[str]): The unique identifier for the message. Defaults to a UUID. timestamp (Optional[datetime]): The timestamp for the message. Defaults to the current datetime. is_remote (bool): Whether the message is sent by a remote DAQJob. Defaults to False. daq_job_info (Optional[DAQJobInfo]): The information about the DAQJob that sent the message. Defaults to None. remote_config (DAQRemoteConfig): The remote configuration for the DAQ job. Defaults to an instance of DAQRemoteConfig. """ id: Optional[str] = field(default_factory=lambda: str(uuid.uuid4())) timestamp: Optional[datetime] = field(default_factory=datetime.now) is_remote: bool = False daq_job_info: Optional["DAQJobInfo"] = None remote_config: DAQRemoteConfig = field(default_factory=DAQRemoteConfig) @property def supervisor_id(self) -> str: if self.daq_job_info is None or self.daq_job_info.supervisor_config is None: return "unknown" return self.daq_job_info.supervisor_config.supervisor_id var remote_config : DAQRemoteConfig-
Expand source code
class DAQJobMessage(Struct, kw_only=True): """ DAQJobMessage is the base class for messages sent between DAQJobs. Attributes: id (Optional[str]): The unique identifier for the message. Defaults to a UUID. timestamp (Optional[datetime]): The timestamp for the message. Defaults to the current datetime. is_remote (bool): Whether the message is sent by a remote DAQJob. Defaults to False. daq_job_info (Optional[DAQJobInfo]): The information about the DAQJob that sent the message. Defaults to None. remote_config (DAQRemoteConfig): The remote configuration for the DAQ job. Defaults to an instance of DAQRemoteConfig. """ id: Optional[str] = field(default_factory=lambda: str(uuid.uuid4())) timestamp: Optional[datetime] = field(default_factory=datetime.now) is_remote: bool = False daq_job_info: Optional["DAQJobInfo"] = None remote_config: DAQRemoteConfig = field(default_factory=DAQRemoteConfig) @property def supervisor_id(self) -> str: if self.daq_job_info is None or self.daq_job_info.supervisor_config is None: return "unknown" return self.daq_job_info.supervisor_config.supervisor_id prop supervisor_id : str-
Expand source code
@property def supervisor_id(self) -> str: if self.daq_job_info is None or self.daq_job_info.supervisor_config is None: return "unknown" return self.daq_job_info.supervisor_config.supervisor_id var timestamp : datetime.datetime | None-
Expand source code
class DAQJobMessage(Struct, kw_only=True): """ DAQJobMessage is the base class for messages sent between DAQJobs. Attributes: id (Optional[str]): The unique identifier for the message. Defaults to a UUID. timestamp (Optional[datetime]): The timestamp for the message. Defaults to the current datetime. is_remote (bool): Whether the message is sent by a remote DAQJob. Defaults to False. daq_job_info (Optional[DAQJobInfo]): The information about the DAQJob that sent the message. Defaults to None. remote_config (DAQRemoteConfig): The remote configuration for the DAQ job. Defaults to an instance of DAQRemoteConfig. """ id: Optional[str] = field(default_factory=lambda: str(uuid.uuid4())) timestamp: Optional[datetime] = field(default_factory=datetime.now) is_remote: bool = False daq_job_info: Optional["DAQJobInfo"] = None remote_config: DAQRemoteConfig = field(default_factory=DAQRemoteConfig) @property def supervisor_id(self) -> str: if self.daq_job_info is None or self.daq_job_info.supervisor_config is None: return "unknown" return self.daq_job_info.supervisor_config.supervisor_id
class DAQJobMessageStop (reason: str,
*,
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 DAQJobMessageStop(DAQJobMessage): reason: strDAQJobMessage is the base class for messages sent between DAQJobs.
Attributes
id:Optional[str]- The unique identifier for the message. Defaults to a UUID.
timestamp:Optional[datetime]- The timestamp for the message. Defaults to the current datetime.
is_remote:bool- Whether the message is sent by a remote DAQJob. Defaults to False.
daq_job_info:Optional[DAQJobInfo]- The information about the DAQJob that sent the message. Defaults to None.
remote_config:DAQRemoteConfig- The remote configuration for the DAQ job. Defaults to an instance of DAQRemoteConfig.
Ancestors
- DAQJobMessage
- msgspec.Struct
- msgspec._core._StructMixin
Instance variables
var reason : str-
Expand source code
class DAQJobMessageStop(DAQJobMessage): reason: str
class DAQJobStats (message_in_stats: DAQJobStatsRecord = <factory>,
message_out_stats: DAQJobStatsRecord = <factory>,
restart_stats: DAQJobStatsRecord = <factory>,
is_alive: bool = True)-
Expand source code
class DAQJobStats(Struct): """ A class to represent statistics for a DAQJob. Gets created and updated by Supervisor. Attributes: message_in_stats (DAQJobStatsRecord): The statistics for incoming messages. message_out_stats (DAQJobStatsRecord): The statistics for outgoing messages. restart_stats (DAQJobStatsRecord): The statistics for restarts. is_alive (bool): Whether the DAQJob is alive. """ message_in_stats: DAQJobStatsRecord = field(default_factory=DAQJobStatsRecord) message_out_stats: DAQJobStatsRecord = field(default_factory=DAQJobStatsRecord) restart_stats: DAQJobStatsRecord = field(default_factory=DAQJobStatsRecord) is_alive: bool = TrueA class to represent statistics for a DAQJob. Gets created and updated by Supervisor.
Attributes
message_in_stats:DAQJobStatsRecord- The statistics for incoming messages.
message_out_stats:DAQJobStatsRecord- The statistics for outgoing messages.
restart_stats:DAQJobStatsRecord- The statistics for restarts.
is_alive:bool- Whether the DAQJob is alive.
Ancestors
- msgspec.Struct
- msgspec._core._StructMixin
Instance variables
var is_alive : bool-
Expand source code
class DAQJobStats(Struct): """ A class to represent statistics for a DAQJob. Gets created and updated by Supervisor. Attributes: message_in_stats (DAQJobStatsRecord): The statistics for incoming messages. message_out_stats (DAQJobStatsRecord): The statistics for outgoing messages. restart_stats (DAQJobStatsRecord): The statistics for restarts. is_alive (bool): Whether the DAQJob is alive. """ message_in_stats: DAQJobStatsRecord = field(default_factory=DAQJobStatsRecord) message_out_stats: DAQJobStatsRecord = field(default_factory=DAQJobStatsRecord) restart_stats: DAQJobStatsRecord = field(default_factory=DAQJobStatsRecord) is_alive: bool = True var message_in_stats : DAQJobStatsRecord-
Expand source code
class DAQJobStats(Struct): """ A class to represent statistics for a DAQJob. Gets created and updated by Supervisor. Attributes: message_in_stats (DAQJobStatsRecord): The statistics for incoming messages. message_out_stats (DAQJobStatsRecord): The statistics for outgoing messages. restart_stats (DAQJobStatsRecord): The statistics for restarts. is_alive (bool): Whether the DAQJob is alive. """ message_in_stats: DAQJobStatsRecord = field(default_factory=DAQJobStatsRecord) message_out_stats: DAQJobStatsRecord = field(default_factory=DAQJobStatsRecord) restart_stats: DAQJobStatsRecord = field(default_factory=DAQJobStatsRecord) is_alive: bool = True var message_out_stats : DAQJobStatsRecord-
Expand source code
class DAQJobStats(Struct): """ A class to represent statistics for a DAQJob. Gets created and updated by Supervisor. Attributes: message_in_stats (DAQJobStatsRecord): The statistics for incoming messages. message_out_stats (DAQJobStatsRecord): The statistics for outgoing messages. restart_stats (DAQJobStatsRecord): The statistics for restarts. is_alive (bool): Whether the DAQJob is alive. """ message_in_stats: DAQJobStatsRecord = field(default_factory=DAQJobStatsRecord) message_out_stats: DAQJobStatsRecord = field(default_factory=DAQJobStatsRecord) restart_stats: DAQJobStatsRecord = field(default_factory=DAQJobStatsRecord) is_alive: bool = True var restart_stats : DAQJobStatsRecord-
Expand source code
class DAQJobStats(Struct): """ A class to represent statistics for a DAQJob. Gets created and updated by Supervisor. Attributes: message_in_stats (DAQJobStatsRecord): The statistics for incoming messages. message_out_stats (DAQJobStatsRecord): The statistics for outgoing messages. restart_stats (DAQJobStatsRecord): The statistics for restarts. is_alive (bool): Whether the DAQJob is alive. """ message_in_stats: DAQJobStatsRecord = field(default_factory=DAQJobStatsRecord) message_out_stats: DAQJobStatsRecord = field(default_factory=DAQJobStatsRecord) restart_stats: DAQJobStatsRecord = field(default_factory=DAQJobStatsRecord) is_alive: bool = True
class DAQJobStatsRecord (count: int = 0, last_updated: datetime.datetime | None = None)-
Expand source code
class DAQJobStatsRecord(Struct): """ A class to represent a record of statistics for a DAQJob. Attributes: count (int): The number of times the DAQJob has been called. last_updated (Optional[datetime]): The last time the DAQJob was called. """ count: int = 0 last_updated: Optional[datetime] = None def increase(self, amount: int = 1): self.count += amount self.last_updated = datetime.now()A class to represent a record of statistics for a DAQJob.
Attributes
count:int- The number of times the DAQJob has been called.
last_updated:Optional[datetime]- The last time the DAQJob was called.
Ancestors
- msgspec.Struct
- msgspec._core._StructMixin
Instance variables
var count : int-
Expand source code
class DAQJobStatsRecord(Struct): """ A class to represent a record of statistics for a DAQJob. Attributes: count (int): The number of times the DAQJob has been called. last_updated (Optional[datetime]): The last time the DAQJob was called. """ count: int = 0 last_updated: Optional[datetime] = None def increase(self, amount: int = 1): self.count += amount self.last_updated = datetime.now() var last_updated : datetime.datetime | None-
Expand source code
class DAQJobStatsRecord(Struct): """ A class to represent a record of statistics for a DAQJob. Attributes: count (int): The number of times the DAQJob has been called. last_updated (Optional[datetime]): The last time the DAQJob was called. """ count: int = 0 last_updated: Optional[datetime] = None def increase(self, amount: int = 1): self.count += amount self.last_updated = datetime.now()
Methods
def increase(self, amount: int = 1)-
Expand source code
def increase(self, amount: int = 1): self.count += amount self.last_updated = datetime.now()
class DAQJobStopError (reason: str)-
Expand source code
class DAQJobStopError(Exception): def __init__(self, reason: str): self.reason = reasonCommon base class for all non-exit exceptions.
Ancestors
- builtins.Exception
- builtins.BaseException
class DAQRemoteConfig (*,
remote_topic: str | None = 'DAQ',
remote_disable: bool | None = False,
drop_remote_messages: bool | None = False)-
Expand source code
class DAQRemoteConfig(Struct, kw_only=True): """ Configuration for remote communication of DAQJobMessages. Used both in DAQJobConfig and in DAQJobMessageStore. Attributes: remote_topic (Optional[str]): The topic to send the message to for remote communication. remote_disable (Optional[bool]): Whether to send messages from this DAQ job to remote. If True, messages will not be sent to any remote. drop_remote_messages (Optional[bool]): Whether to drop remote messages. If True, messages from remote will not be processed, but messages may still be sent to remote. """ remote_topic: Optional[str] = DEFAULT_REMOTE_TOPIC remote_disable: Optional[bool] = False drop_remote_messages: Optional[bool] = FalseConfiguration for remote communication of DAQJobMessages.
Used both in DAQJobConfig and in DAQJobMessageStore.
Attributes
remote_topic:Optional[str]- The topic to send the message to for remote communication.
remote_disable:Optional[bool]- Whether to send messages from this DAQ job to remote. If True, messages will not be sent to any remote.
drop_remote_messages:Optional[bool]- Whether to drop remote messages. If True, messages from remote will not be processed, but messages may still be sent to remote.
Ancestors
- msgspec.Struct
- msgspec._core._StructMixin
Instance variables
var drop_remote_messages : bool | None-
Expand source code
class DAQRemoteConfig(Struct, kw_only=True): """ Configuration for remote communication of DAQJobMessages. Used both in DAQJobConfig and in DAQJobMessageStore. Attributes: remote_topic (Optional[str]): The topic to send the message to for remote communication. remote_disable (Optional[bool]): Whether to send messages from this DAQ job to remote. If True, messages will not be sent to any remote. drop_remote_messages (Optional[bool]): Whether to drop remote messages. If True, messages from remote will not be processed, but messages may still be sent to remote. """ remote_topic: Optional[str] = DEFAULT_REMOTE_TOPIC remote_disable: Optional[bool] = False drop_remote_messages: Optional[bool] = False var remote_disable : bool | None-
Expand source code
class DAQRemoteConfig(Struct, kw_only=True): """ Configuration for remote communication of DAQJobMessages. Used both in DAQJobConfig and in DAQJobMessageStore. Attributes: remote_topic (Optional[str]): The topic to send the message to for remote communication. remote_disable (Optional[bool]): Whether to send messages from this DAQ job to remote. If True, messages will not be sent to any remote. drop_remote_messages (Optional[bool]): Whether to drop remote messages. If True, messages from remote will not be processed, but messages may still be sent to remote. """ remote_topic: Optional[str] = DEFAULT_REMOTE_TOPIC remote_disable: Optional[bool] = False drop_remote_messages: Optional[bool] = False var remote_topic : str | None-
Expand source code
class DAQRemoteConfig(Struct, kw_only=True): """ Configuration for remote communication of DAQJobMessages. Used both in DAQJobConfig and in DAQJobMessageStore. Attributes: remote_topic (Optional[str]): The topic to send the message to for remote communication. remote_disable (Optional[bool]): Whether to send messages from this DAQ job to remote. If True, messages will not be sent to any remote. drop_remote_messages (Optional[bool]): Whether to drop remote messages. If True, messages from remote will not be processed, but messages may still be sent to remote. """ remote_topic: Optional[str] = DEFAULT_REMOTE_TOPIC remote_disable: Optional[bool] = False drop_remote_messages: Optional[bool] = False
class LogVerbosity (*args, **kwds)-
Expand source code
class LogVerbosity(str, Enum): """ Enum representing the verbosity levels for logging. Used in DAQJobConfig. """ DEBUG = "DEBUG" INFO = "INFO" WARNING = "WARNING" ERROR = "ERROR" def to_logging_level(self) -> int: return logging._nameToLevel[self.value]Enum representing the verbosity levels for logging.
Used in DAQJobConfig.
Ancestors
- builtins.str
- enum.Enum
Class variables
var DEBUGvar ERRORvar INFOvar WARNING
Methods
def to_logging_level(self) ‑> int-
Expand source code
def to_logging_level(self) -> int: return logging._nameToLevel[self.value]