ait.core.server.plugin module¶
-
class
ait.core.server.plugin.
Plugin
(inputs, outputs, zmq_args=None, **kwargs)¶ Bases:
ait.core.server.client.ZMQInputClient
This is the parent class for all plugins. All plugins must implement their own process method which is called when a message is received.
-
__init__
(inputs, outputs, zmq_args=None, **kwargs)¶ Constructor
- Params:
inputs: names of inbound streams plugin receives data from outputs: names of outbound streams plugin sends its data to zmq_args: dict containing the follow keys:
zmq_context zmq_proxy_xsub_url zmq_proxy_xpub_urlDefaults to empty dict. Default values assigned during instantiation of parent class.
**kwargs: (optional) Dependent on requirements of child class.
-
static
create_plugin
(plugin_config)¶ Static utility method that instantiates extensions of the Plugin class
- Params:
- plugin_config: Plugin configuration associated with Plugin instance
- Returns:
- Plugin - New Plugin extension
- Raises:
- ValueError: if any of the required config values are missing
- or plugin class can not be imported/loaded
-
process
(input_data, topic=None)¶ Not implemented by base Plugin class. This process method must be implemented by any custom plugin class that inherits from this base Plugin.
- Params:
- input_data: Message received from any of the plugin’s input streams. topic: Name of stream that message was received from.
-
-
class
ait.core.server.plugin.
PluginConfig
(name, inputs=None, outputs=None, zmq_args=None, kwargs=None)¶ Bases:
object
Data-structure for plugin information. Would be useful if we allow multiple plugins to run in a common child-process
-
__init__
(name, inputs=None, outputs=None, zmq_args=None, kwargs=None)¶ Constructor
- Params:
name: Name of the Plugin class (required) inputs: names of inbound streams plugin receives data from outputs: names of outbound streams plugin sends its data to zmq_args: dict containing the follow keys:
zmq_context zmq_proxy_xsub_url zmq_proxy_xpub_urlDefaults to empty dict. Default values assigned during instantiation of parent class.
**kwargs: (optional) Dependent on requirements of child class.
-
static
build_from_ait_config
(ait_plugin_config, zmq_args=None)¶ Static method that extracts information from AIT Plugin configuration and returns a newly instantiated PluginConfig object. Any required configuration that is missing will result in error.
- Params:
- ait_plugin_config: AIT configuration section of a plugin zmq_args: ZMQ settings
- Returns:
- PluginConfig - New PluginConfig built from config
- Raises:
- AitConfigMissing: if any of the required config values are missing
-
get_zmq_context
()¶ Convenience method that gets value of the ZMQ context
Returns: ZMQ Context, possibly None
-
set_zmq_context
(context)¶ Convenience method that gets value of the ZMQ context
- Params:
- context: ZeroMQ Context, can be None
-
short_name
¶ Returns the classname portion of the fullname Returns: Class name of plugin type
-