nirs4all.controllers.controller module

Base class for pipeline operator controllers.

class nirs4all.controllers.controller.OperatorController[source]

Bases: ABC

Base class for pipeline operators.

abstractmethod execute(step_info: ParsedStep, dataset: SpectroDataset, context: ExecutionContext, runtime_context: RuntimeContext, source: int = -1, mode: str = 'train', loaded_binaries: List[Tuple[str, Any]] | None = None, prediction_store: Any | None = None) Tuple[ExecutionContext, Any][source]

Run the operator with the given parameters and context.

Parameters:
  • step_info – Parsed step containing operator, keyword, and metadata

  • dataset – Dataset to operate on

  • context – Pipeline execution context

  • runtime_context – Runtime infrastructure context

  • source – Data source index

  • mode – Execution mode (“train” or “predict”)

  • loaded_binaries – Pre-loaded binary objects for prediction mode

  • prediction_store – External prediction store for model predictions

Returns:

Tuple of (updated_context, StepOutput)

abstractmethod classmethod matches(step: Any, operator: Any, keyword: str) bool[source]

Check if the operator matches the step and keyword.

priority: int = 100
classmethod supports_prediction_mode() bool[source]

Check if the controller should execute during prediction mode.

Returns:

True if the controller should execute in prediction mode, False if it should be skipped (e.g., chart controllers)

abstractmethod classmethod use_multi_source() bool[source]

Check if the operator supports multi-source datasets.