bexchange.processor package

Submodules

bexchange.processor.processors module

class bexchange.processor.processors.example_processor(backend, name, active, extra_arguments)[source]

Bases: processor

process(path, meta)[source]

The process function. Must be non-blocking. Otherwise this will lock up threads. This means that the path/metadata should be put on a queue or in some other way passed on to the actual processing-part without locking up the resources.

class bexchange.processor.processors.processor(backend, name, active, extra_arguments=None)[source]

Bases: object

Base class to be used by all processor implementations

active()[source]
Returns:

if this processor is active or not

backend()[source]
Returns:

the backend instance

name()[source]
Returns:

the name of this processor

process(path, metadata)[source]

The process function. Must be non-blocking. Otherwise this will lock up threads. This means that the path/metadata should be put on a queue or in some other way passed on to the actual processing-part without locking up the resources.

start()[source]

Starts this processor. Typically by starting a thread or consumer pool

stop()[source]

Stops this processor. Typically by joining a number of threads

class bexchange.processor.processors.processor_manager[source]

Bases: object

The processor manager. Will ensure that files are passed on to the processors.

add_processor(processor)[source]

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

classmethod create_processor(name, 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 processor instance from provided json config :param config: The json config as a dictionary :param backend: The backend this processor should have access to :return: the processor instance

process(file, meta)[source]

Passes on the file to all registered processors. It is up to the processor to determine how the provided file should be handled.

remove_processor(name)[source]

Removes a processor from the manager :param name: The name of the processor that should be removed

Module contents