mafw.tools.loop_tuning

Mixin utilities for tuning loop execution parameters via steering files.

This module defines LoopTuningMixin, which exposes loop operational settings as ActiveParameter instances. This allows temporary tuning through steering files without modifying processor code.

Author:

Bulgheroni Antonio (antonio.bulgheroni@ec.europa.eu)

Added in version v2.2.0.

Classes

LoopTuningMixin()

Provide steering-file access to loop operational parameters.

class mafw.tools.loop_tuning.LoopTuningMixin[source]

Bases: object

Provide steering-file access to loop operational parameters.

This mixin is meant to be combined with Processor subclasses when tuning parallel for-loop performance. Once optimal values are found, users can remove the mixin and pass the values via the processor constructor.

static _validate_loop_type(value: Any) LoopType[source]

Validate loop type values supported by loop tuning.

Parameters:

value (Any) – The loop type value to validate.

Returns:

The validated loop type.

Return type:

LoopType

Raises:

ProcessorParameterError – If the loop type is not supported.

initialise_parameters() None[source]

Initialises parameters and applies loop-tuning overrides if provided.

The tuning parameters override constructor settings only when they are explicitly set in the steering file or via keyword arguments.

tuning_loop_type: ActiveParameter[str]

Loop type used by the processor.

tuning_max_workers: ActiveParameter[int]

Number of worker threads for parallel loops.

tuning_queue_batch_size: ActiveParameter[int]

Batch size for queue processing in the queue-based parallel loop.

tuning_queue_size: ActiveParameter[int]

Queue size used by ParallelForLoopWithQueue.