cosapp.tools.trigger¶
Utility classes for executing CoSApp simulation following file events.
Those classes use third-party watchdog package to observe file events.
Classes
|
Specific watchdog class to monitor file creation events |
|
Specific watchdog class to monitor file modification events. |
|
Define a watchdog class that allows to trigger actions on file events (creation, modification, etc.). |
- class cosapp.tools.trigger.FileCreationHandler(owner: System, folder: str, timeout: float = 30.0, patterns: List | AnyStr = '*.*')[source]¶
Bases:
WatchdogHandler
Specific watchdog class to monitor file creation events
- Parameters:
owner (System) – Owner of the watchdog. Actions will be triggered on him on events
folder (str) – Folder to supervise with the watchdog
timeout (float, optional) – Define the max inactivity duration of the watchdog
patterns (Union[List, AnyStr], optional) – Define the file patterns to monitor in the chosen path
- class cosapp.tools.trigger.FileModificationHandler(owner: System, folder: str, timeout: float = 30.0, patterns: List | AnyStr = '*.*')[source]¶
Bases:
WatchdogHandler
Specific watchdog class to monitor file modification events.
- Parameters:
owner (System) – Owner of the watchdog. Actions will be triggered on him on events
folder (str) – Folder to supervise with the watchdog
timeout (float, optional) – Define the max inactivity duration of the watchdog
patterns (Union[List, AnyStr], optional) – Define the file patterns to monitor in the chosen path
- class cosapp.tools.trigger.WatchdogHandler(owner: System, folder: str, timeout: float = 30.0, patterns: List | AnyStr = '*.*')[source]¶
Bases:
PatternMatchingEventHandler
Define a watchdog class that allows to trigger actions on file events (creation, modification, etc.).
- Parameters:
owner (System) – Owner of the watchdog. Actions will be triggered on him on events
folder (str) – Folder to supervise with the watchdog
timeout (float, optional) – Define the max inactivity duration of the watchdog
patterns (Union[List, AnyStr], optional) – Define the file patterns to monitor in the chosen path
- compute(file_full_path: str) None [source]¶
Actions to do while an event is detected
- Parameters:
file_full_path (str) – Gives access to the file that triggered an event