mirar.monitor package
Submodules
mirar.monitor.base_monitor module
Script containing the Monitor class,
used for processing data in real time.
- exception mirar.monitor.base_monitor.ImageTimeoutError[source]
Bases:
ProcessorErrorTimeout for downloading an image has been exceeded.
- class mirar.monitor.base_monitor.Monitor(night: str, pipeline: str, cal_requirements: list[CalRequirement] | None = None, realtime_configurations: str | list[str] = 'default', postprocess_configurations: str | list[str] | None = None, email_sender: str | None = None, email_recipients: str | list | None = None, midway_postprocess_hours: float = 16.0, final_postprocess_hours: float = 48.0, log_level: str = 'INFO', raw_dir: str = 'raw', base_raw_img_dir: Path = PosixPath('/home/docs'))[source]
Bases:
objectClass to ‘monitor’ a directory, watching for newly created files. It then reduces these files. It will watch for a fixed duration, and run a postprocessing step at some configurable time after starting. It can send automated email notifications.
- configure_logs(log_level='INFO')[source]
Function to configure the log level for the python logger. Posts the log to the terminal and also writes it to a file.
- Parameters:
log_level – python log level
- Returns:
lof file path
- get_cals() ImageBatch[source]
Returns a copy of the calibration images (new and archival)
- Returns:
- postprocess()[source]
Function to be run after some realtime postprocessing has been run. This function is called once after a configurable number of hours (typically when the data is expected to be done), and then again when the monitor stops watching the directory.
- Returns:
None
- process_load_queue(queue: Queue)[source]
This is the worker thread function. It is run as a daemon threads that only exit when the main thread ends.
Args
queue: Queue() object
- summarise_errors(errorstack: ErrorStack)[source]
Create a text summary using an errorstack and the list of processed images. Sends an email of this if configured to do so, or prints otherwise.
- Parameters:
errorstack – list of errors to summarise
- Returns:
None