datalogd package¶
The datalogd package contains the main DataLogDaemon
,
plus the plugin base classes DataSource
, DataFilter
, and
DataSink
, which must be extended to provide useful functionality.
The included data source/filter/sink plugins are contained separately in the
plugins
package.
-
class
datalogd.
DataFilter
(sinks=[])[source]¶ Bases:
datalogd.DataSource
,datalogd.DataSink
,pluginlib._parent.Plugin
The base class for all data filter plugins.
DataFilter
s are subclasses of bothDataSource
s andDataSink
s, thus are capable of both sending and receiving data. Typically, they are used to sit between aDataSource
and aDataSink
(or otherDataFilter
s) in order to modify the data flowing between them in some way.
-
class
datalogd.
DataLogDaemon
(configfile=None, plugindirs=[], graph_dot=None)[source]¶ Bases:
object
The main datalogd class.
The
DataLogDaemon
reads configuration file(s), interprets the connection graph DOT specification, and initialises data source/filter/sink plugins and connections. Theasyncio
event loop must be started separately. For an example of this, see themain()
method, which is the typical way the daemon is started.Parameters: - configfile – Path to configuration file to load.
- plugindirs – Directory, or list of directories from which to load additional plugins.
- graph_dot – Connection graph specified in the DOT graph description language.
-
class
datalogd.
DataSink
[source]¶ Bases:
pluginlib._parent.Plugin
The base class for all data sink plugins.
DataSink
s have areceive()
method which accepts data from connectedDataSource
s.
-
class
datalogd.
DataSource
(sinks=[])[source]¶ Bases:
pluginlib._parent.Plugin
The base class for all data sink plugins.
DataSource
implements methods for connecting or disconnecting sinks, and for sending data to connected sinks. It has no intrinsic functionality (it does not actually produce any data) and is not itself considered a plugin, so can’t be instantiated using the connection graph.Parameters: sinks – DataSink
or list ofDataSink
s to receive data produced by thisDataSource
.-
connect_sinks
(sinks)[source]¶ Register the provided
DataSink
as a receiver of data produced by thisDataSource
. A list of sinks may also be provided.Parameters: sinks – DataSink
or list ofDataSink
s.
-
-
class
datalogd.
NullDataFilter
(sinks=[])[source]¶ Bases:
datalogd.DataFilter
A
DataFilter
which accepts data and passes it unchanged to any connectedDataSink
s.
-
class
datalogd.
NullDataSink
[source]¶ Bases:
datalogd.DataSink
A
DataSink
which accepts data and does nothing with it.Unlike the base
DataSink
, this can be instantiated using the connection graph, although it provides no additional functionality.
-
class
datalogd.
NullDataSource
(sinks=[])[source]¶ Bases:
datalogd.DataSource
A
DataSource
which produces no data.Unlike the base
DataSource
, this can be instantiated using the connection graph, although it provides no additional functionality.
-
datalogd.
listify
(value)[source]¶ Convert
value
into a list.Modifies the behaviour of the python builtin
list()
by accepting all types asvalue
, not just iterables. Additionally, the behaviour of iterables is changed:list('str') == ['s', 't', 'r']
, whilelistify('str') == ['str']
list({'key': 'value'}) == ['key']
, whilelistify({'key': 'value'}) == [{'key': 'value'}]
Parameters: value – Input value to convert to a list. Returns: value
as a list.
-
datalogd.
main
()[source]¶ Read command line parameters, instantiate a new
DataLogDaemon
and begin execution of the event loop.
-
datalogd.
parse_dot_json
(value)[source]¶ Interpret the value of a DOT attribute as JSON data.
DOT syntax requires double quotes around values which contain DOT punctuation (space, comma, {}, [] etc), and, if used, these quotes will also be present in the obtained value string. Unfortunately, JSON also uses double quotes for string values, which are then in conflict. This method will strip any double quotes from the passed
value
, then will attempt to interpret as JSON after replacing single quotes with double quotes.Note that the use of this workaround means that single quotes must be used in any JSON data contained in the DOT attribute values.
Parameters: value – string to interpret. Returns: value
, possibly as a new type.
Subpackages¶
- datalogd.plugins package
- Submodules
- datalogd.plugins.aggregator_datafilter module
- datalogd.plugins.coolingpower_datafilter module
- datalogd.plugins.csv_datafilter module
- datalogd.plugins.file_datasink module
- datalogd.plugins.flowsensorcalibration_datafilter module
- datalogd.plugins.influxdb2_datasink module
- datalogd.plugins.influxdb_datasink module
- datalogd.plugins.join_datafilter module
- datalogd.plugins.keyval_datafilter module
- datalogd.plugins.libsensors_datasource module
- datalogd.plugins.logging_datasink module
- datalogd.plugins.matplotlib_datasink module
- datalogd.plugins.picotc08_datasource module
- datalogd.plugins.polynomialfunction_datafilter module
- datalogd.plugins.print_datasink module
- datalogd.plugins.pyqtgraph_datasink module
- datalogd.plugins.randomwalk_datasource module
- datalogd.plugins.serial_datasource module
- datalogd.plugins.thorlabspm100_datasource module
- datalogd.plugins.timestamp_datafilter module
- Submodules