file_watcher
frequenz.channels.utils.file_watcher
¤
A Channel receiver for watching for new (or modified) files.
Classes¤
frequenz.channels.utils.file_watcher.EventType
¤
Bases: Enum
Available types of changes to watch for.
Source code in frequenz/channels/utils/file_watcher.py
15 16 17 18 19 20 |
|
frequenz.channels.utils.file_watcher.FileWatcher
¤
A channel receiver that watches for file events.
Source code in frequenz/channels/utils/file_watcher.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
Functions¤
__del__()
¤
Cleanup registered watches.
awatch
passes the stop_event
to a separate task/thread. This way
awatch
getting destroyed properly. The background task will continue
until the signal is received.
Source code in frequenz/channels/utils/file_watcher.py
56 57 58 59 60 61 62 63 |
|
__init__(paths, event_types=None)
¤
Create a FileWatcher
instance.
PARAMETER | DESCRIPTION |
---|---|
paths |
Paths to watch for changes. |
event_types |
Types of events to watch for or |
Source code in frequenz/channels/utils/file_watcher.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
receive()
async
¤
Wait for the next file event and return its path.
RETURNS | DESCRIPTION |
---|---|
Optional[pathlib.Path]
|
Path of next file. |
Source code in frequenz/channels/utils/file_watcher.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|