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 | Sequence[str] = None)[source]#

Bases: object

Represent a work

Work are treated differently by executors depending of the kind argument. Work can be:

  • “global”: the work acts globally on its input and output queues.

  • “one shot”: the work has to be called only once per execution.

  • “io”: the work involves input/output and is not computationally heavy.

  • “eat key value”: the work takes as argument a tuple (key, value).

check_exception(key, obj)[source]#

Check if obj is an exception

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

Bases: OrderedDict

Represent a queue

pop_first_item()[source]#

Pop the first item of the queue

is_name_in_values(image_name)[source]#

Check if a name is in the 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(name: str, kind: str = None)[source]#

Create a new queue.

add_work(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(executor=None, nb_max_workers=None, sleep_time=0.01, sequential=False, stop_if_error=False, kwargs_executor=None)[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(time_since_start)[source]#

Make a text printed before exit.

print_at_exit(time_since_start)[source]#

Print information before exit.

make_code_graphviz(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
read_log_data(path=None)[source]#

Create and return an object containing the data from the log file(s)

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

Bases: TopologyBase, ABC

abstract compute_indices_to_be_computed()[source]#

Compute the indices corresponding to the series to be computed

init_series()[source]#

Initializes the SeriesOfArrays object self.series based on input parameters.

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

Bases: TopologyBase

compute_indices_to_be_computed()[source]#

Compute the indices corresponding to the images to be computed

_fix_indices_images(indices_images)[source]#

Fix the indices images in fill_queue_paths

fill_queue_paths(input_queue, output_queue)[source]#

Fill the first queue (paths)

Classes

Queue(name[, kind])

Represent a queue

TopologyBase([path_dir_result, ...])

Base class for topologies of processing.

TopologyBaseFromImages([path_dir_result, ...])

TopologyBaseFromSeries([path_dir_result, ...])

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

Represent a work