bexchange.runner package

Submodules

bexchange.runner.runners module

class bexchange.runner.runners.inotify_runner(backend, active, **args)[source]

Bases: runner

The inotify runner is used to monitor folders and trigger “store” events. It is run in a separate thread instead of beeing created as a daemon-thread since all initiation is performed in the main thread before server is started.

MASK = 136
get_pending_files(folder)[source]

Lists all files in specified folder

handle_file(filename)[source]

Handles the file (by sending it to the backend using the name given to this runner :param filename: The filename to handle

is_ignored(filename)[source]

Checks if the specified file should be ignored or not, for example when a tmpfile is written. the check is performed on basename. :param filename: The filename to be checked :return True if file should be ignored otherwise False

pending_run(pending_filenames)[source]
run()[source]

The runner for the thread. Starts the inotify notifier loop

start()[source]

Starts this runner by adding the watched folders and then starting a daemonized thread.

stop()[source]

Abstract stop method. Will try to stop the runner.

class bexchange.runner.runners.inotify_runner_event_handler(inotify_runner)[source]

Bases: ProcessEvent

process_IN_CLOSE_WRITE(event)[source]

Will be called by the inotify notifier when file event occurs. :param event: The file event

process_IN_MOVED_TO(event)[source]

Will be called by the inotify notifier when file event occurs. :param event: The file event

class bexchange.runner.runners.runner(backend, active)[source]

Bases: object

Base class for any runner

active()[source]

:return if this runner is active or not

backend()[source]

:return the backend

setactive(active)[source]
Parameters:

active – If this runner should be active or not

start()[source]

Abstract start method. Will start the runner. Typically by setting up some event listening or starting a thread.

stop()[source]

Abstract stop method. Will try to stop the runner.

class bexchange.runner.runners.runner_manager[source]

Bases: object

The runner manager. Will create and register the runner

add_runner(runner)[source]

Adds a runner to the manager :param runner: The runner that should be added

classmethod create_runner(clz, backend, active, extra_arguments)[source]

Creates an instance of clz with specified arguments :param clz: class name specified as <module>.<classname> :param arguments: a list of arguments that should be used to initialize the class

classmethod from_conf(config, backend)[source]

Creates a runner from the specified configuration if it is possible :param config: A runner config pattern. Should at least contain the following {“class”:”<packagename>.<classname>” “active”:<true or false> “extra_arguments”:{}” }

get_runners()[source]

:return the runners

remove(runner)[source]

Stops and removes a specific runner

start()[source]

Starts all runners

class bexchange.runner.runners.statistics_cleanup_runner(backend, active, **args)[source]

Bases: runner

Cleans the statistics database

run()[source]

The runner for the thread. Will trigger a wait for

start()[source]

Starts this runner by starting a daemonized thread.

stop()[source]

Abstract stop method. Will try to stop the runner.

class bexchange.runner.runners.triggered_fetch_runner(backend, active, **args)[source]

Bases: runner, message_aware

A triggered runner. This runner implements ‘message_aware’ so that a json-message can be handled. This runner is actually triggered from the WSGI-process and as such is using the WSGI-servers thread pool. @todo: Implement this as a producer/consumer thread to avoid any possibility to starve the WSGI-thread pool.

handle_message(json_message, nodename)[source]

Handles the message if the json message contains a trigger that matches trigger names and that the nodename is allowed within the invoker_names by invoking the fetch method in fetcher using “arguments” in the json-message.

start()[source]

Not used

stop()[source]

Not used

Module contents