rattail.filemon.actions

File Monitor Actions

class rattail.filemon.actions.Action(config)[source]

Base class for file monitor actions.

class rattail.filemon.actions.CommandAction(config, cmd)[source]

Simple file monitor action which can execute a command as a subprocess.

rattail.filemon.actions.invoke_action(action, path)[source]

Invoke a single action on a file, retrying as necessary.

rattail.filemon.actions.noop(path)[source]

File monitor action which does nothing at all.

This exists for the sake of tests. I doubt it’s useful in any other context.

rattail.filemon.actions.perform_actions(profile)[source]

Target for action threads. Provides the main loop which checks the queue for new files and invokes actions for each, as they appear.

rattail.filemon.actions.raise_exception(path, message='Fake error for testing')[source]

File monitor action which always raises an exception.

This is meant to be a simple way to test the error handling of a file monitor. For example, whether or not file processing continues for subsequent files after the first error is encountered. If logging configuration dictates that an email should be sent, it will of course test that as well.