filewatchpublisher.agent module

class filewatchpublisher.agent.FileWatchPublisher(config, **kwargs)[source]

Bases: volttron.platform.vip.agent.Agent

Monitors files from configuration for changes and publishes added lines on corresponding topics. Ignores if a file does not exist and move to next file in configuration with an error message. Exists if all files does not exist. :param config: Configuration dict :type config: dict

Example configuration:

{
    "publish_file": [
        {
            "file": "/var/log/syslog",
            "topic": "platform/syslog",
        },
        {
            "file": "/home/volttron/tempfile.txt",
            "topic": "temp/filepublisher",
        }
    ]
}
get_end_position(f)[source]
publish_file(line, topic)[source]
read_file(file)[source]
starting(sender, **kwargs)[source]
filewatchpublisher.agent.file_watch_publisher(config_path, **kwargs)[source]

Load the FileWatchPublisher agent configuration and returns and instance of the agent created using that configuration. :param config_path: Path to a configuration file. :type config_path: str :returns: FileWatchPublisher agent instance :rtype: FileWatchPublisher agent

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

Main method called by the platform.