| |
- plugins.base_plugin.MaukaPlugin(builtins.object)
-
- OutagePlugin
class OutagePlugin(plugins.base_plugin.MaukaPlugin) |
|
OutagePlugin(conf: config.MaukaConfig, exit_event: <bound method BaseContext.Event of <multiprocessing.context.DefaultContext object at 0x1037fcb00>>)
This plugin identifies power outages by keeping track of the health collection for box status. |
|
- Method resolution order:
- OutagePlugin
- plugins.base_plugin.MaukaPlugin
- builtins.object
Methods defined here:
- __init__(self, conf: config.MaukaConfig, exit_event: <bound method BaseContext.Event of <multiprocessing.context.DefaultContext object at 0x1037fcb00>>)
- Initializes the base plugin
:param conf: Configuration dictionary
:param subscriptions: List of subscriptions this plugin should subscribe to
:param name: The name of this plugin
- on_message(self, topic: str, mauka_message: mauka_pb2.MaukaMessage)
- This gets called when a subscriber receives a message from a topic they are subscribed too.
This should be implemented in all subclasses.
:param topic: The topic this message is associated with
:param mauka_message: The message contents
Data and other attributes defined here:
- NAME = 'OutagePlugin'
Methods inherited from plugins.base_plugin.MaukaPlugin:
- debug(self, msg: str)
- Prints a debug message using this classes logger and formatted the plugin name.
:param msg: Message to print to debug.
- get_mongo_client(self)
- Returns an OPQ mongo client
:return: An OPQ mongo client
- get_status(self) -> str
- Return the status of this plugin
:return: The status of this plugin
- handle_self_message(self, message: str)
- Handles a self-message
:param message: The message to handle
- is_self_message(self, topic: str) -> bool
- Determines if this is a message directed at this plugin. I.e. the topic is the name of the plugin.
:param topic: Topic of the message
:return: If this is a self message or not
- produce(self, topic: str, mauka_message: mauka_pb2.MaukaMessage)
- Produces a message with a given topic to the system
:param topic: The topic to produce this message to
:param mauka_message: The message to produce
- run_plugin(self)
- This is the run loop for this plugin process
- start_heartbeat(self)
- This is a recursive function that acts as a heartbeat.
This function calls itself over-and-over on a timer to produce heartbeat messages. The interval can be
configured is the configuration file.
Data descriptors inherited from plugins.base_plugin.MaukaPlugin:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |