fluidimage.topologies.base

Topology base (fluidimage.topologies.base)

class fluidimage.topologies.base.Work(name: str, func_or_cls, params_cls=None, input_queue=None, output_queue=None, kind: str = None)[source]

Bases: object

Represent a work

check_exception(self, key, obj)[source]

Check if obj is an exception

class fluidimage.topologies.base.Queue(name, kind=None)[source]

Bases: collections.OrderedDict

Represent a queue

class fluidimage.topologies.base.TopologyBase(path_dir_result=None, logging_level='info', nb_max_workers=None)[source]

Bases: object

Base class for topologies of processing.

This class is meant to be subclassed, not instantiated directly.

Parameters
path_dir_resultNone, str
logging_levelNone, {‘warning’, ‘info’, ‘debug’, …}
nb_max_workersNone, int
add_queue(self, name: str, kind: str = None)[source]

Create a new queue.

add_work(self, name: str, func_or_cls, params_cls=None, input_queue=None, output_queue=None, kind: str = None)[source]

Create a new work relating queues.

compute(self, executor=None, nb_max_workers=None, sleep_time=0.01, sequential=False, stop_if_error=False)[source]

Compute (run the works until all queues are empty).

Parameters
executorstr or fluidimage.executors.base.ExecutorBase, optional

If None, executor="multi_exec_async"

nb_max_workersint, optional
sleep_timenumber, optional {0.01}
sequentialbool, optional {False}
stop_if_errorbool, optional {False}
make_text_at_exit(self, time_since_start)[source]

Make a text printed before exit.

print_at_exit(self, time_since_start)[source]

Print information before exit.

make_code_graphviz(self, name_file='tmp.dot')[source]

Generate the graphviz / dot code.

This method only generates a graphviz code. The graph can be visualized with for example:

dot {name_file}.dot -Tpng -o {name_file}.png && eog {name_file}.png

Classes

Queue(name[, kind])

Represent a queue

TopologyBase([path_dir_result, …])

Base class for topologies of processing.

Work(name, func_or_cls[, params_cls, …])

Represent a work