datamover.agent module

class datamover.agent.DataMover(destination_vip, destination_serverkey, destination_historian_identity='platform.historian', remote_identity=None, **kwargs)[source]

Bases: volttron.platform.agent.base_historian.BaseHistorian

This historian forwards data to another platform.

capture_data(peer, sender, bus, topic, headers, message)[source]
configure(configuration)[source]

Optional, may be implemented by a concrete implementation to add support for the configuration store. Values should be stored in this function only.

The process thread is stopped before this is called if it is running. It is started afterwards.

historian_setup is called after this is called.

historian_setup()[source]

Optional setup routine, run in the processing thread before main processing loop starts. Gives the Historian a chance to setup connections in the publishing thread.

historian_teardown()[source]

Optional teardown routine, run in the processing thread if the main processing loop is stopped. This happened whenever a new configuration arrives from the config store.

publish_to_historian(to_publish_list)[source]

Main publishing method for historian Agents.

Parameters

to_publish_list (list) – List of records

to_publish_list takes the following form:

[
    {
        'timestamp': timestamp1.replace(tzinfo=pytz.UTC),
        'source': 'scrape',
        'topic': "pnnl/isb1/hvac1/thermostat",
        'value': 73.0,
        'meta': {"units": "F", "tz": "UTC", "type": "float"}
    },
    {
        'timestamp': timestamp2.replace(tzinfo=pytz.UTC),
        'source': 'scrape',
        'topic': "pnnl/isb1/hvac1/temperature",
        'value': 74.1,
        'meta': {"units": "F", "tz": "UTC", "type": "float"}
    },
    ...
]

The contents of meta is not consistent. The keys in the meta data values can be different and can change along with the values of the meta data. It is safe to assume that the most recent value of the “meta” dictionary are the only values that are relevant. This is the way the cache treats meta data.

Once one or more records are published either BaseHistorianAgent.report_all_handled() or BaseHistorianAgent.report_handled() must be called to report records as being published.

timestamp()[source]
datamover.agent.historian(config_path, **kwargs)[source]
datamover.agent.main(argv=['/home/docs/checkouts/readthedocs.org/user_builds/volttron/envs/releases-8.2/lib/python3.6/site-packages/sphinx/__main__.py', '-T', '-E', '-b', 'html', '-d', '_build/doctrees', '-D', 'language=en', '.', '_build/html'])[source]