Skip to Content
Hands-On Reactive Programming with Python
book

Hands-On Reactive Programming with Python

by Romain Picard
October 2018
Intermediate to advanced
420 pages
10h 26m
English
Packt Publishing
Content preview from Hands-On Reactive Programming with Python

Monitoring changes in the configuration file

The final step is to use the inotify driver in the application. It must first be added in the driver, source, and sink of the application entry point:

Drivers = namedtuple('Drivers',     ['encoder', 'httpd', 's3', 'file', 'inotify', 'argv'])Source = namedtuple('Source',     ['encoder', 'httpd', 's3', 'file', 'inotify', 'argv'])Sink = namedtuple('Sink',     ['encoder', 'httpd', 's3', 'file', 'inotify'])

The inotify driver must be created in the constructor of the Drivers object when the run function is called. Then it can be configured:

    monitor_init = (        parsed_argv        .flat_map(lambda i : Observable.from_([            inotify.AddWatch(id='config', path=i.value,             flags=aionotify.Flags.MODIFY),            inotify.Start(),        ]))    )
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python Programming with Design Patterns

Python Programming with Design Patterns

James W. Cooper

Publisher Resources

ISBN: 9781789138726Supplemental Content