Source code for ska_sdp_batchlet.plugins.plugin

# pylint: disable=R0903

from abc import ABC, abstractmethod


[docs] class FilterPlugin(ABC): """ Abstract base class for plugins that filter events. A filter plugin takes the string log line and validates it against some criteria. If the line is valid, it should return the parsed event as a dictionary. If the line is invalid, it should return None. """ DEFAULT_PACKAGE_PATH = "ska_sdp_batchlet_plugins.filters"
[docs] @abstractmethod def filter(self, line: str) -> dict | None: """ Parameters ---------- line : str The raw log line to be processed Returns ------- event : dict | None The parsed event as a dictionary if the line is valid, or None if it is invalid. """
[docs] class ConsumerPlugin(ABC): """ Abstract base class for plugins that consume events. A consumer plugin takes a parsed event as a dictionary and processes it. """ DEFAULT_PACKAGE_PATH = "ska_sdp_batchlet_plugins.consumers"
[docs] @abstractmethod def process(self, event: dict) -> None: """ Parameters ---------- event : dict The parsed event as a dictionary Returns ------- None """