mafw.scaffold.steering

Deterministic generation of the example steering file.

The generated project ships a runnable steering file in conf/. Rather than hand-writing TOML, this module reuses MAFw’s own generate_steering_file() so the steering file always matches the real parameter schema of the example processor (single source of truth).

Two project-specific adjustments are applied on top of the generic generator:

  • the database is a self-contained SQLite file written under a project-relative run/ directory, expressed with environment-variable expansion so the same steering file works on a laptop and on a headless HPC node;

  • the non-deterministic “generated on <timestamp>” comment emitted by the generic generator is normalized to a fixed line, so that generating the same project twice yields byte-identical output.

Added in version 2.4.

Functions

write_example_steering_file(output_file)

Write the deterministic example steering file to output_file.

class mafw.scaffold.steering._ExampleProcessorStandIn(*args: Any, **kwargs: Any)[source]

Bases: Processor

Example processor that sums the first last_value integers.

Note

This private class is only a schema stand-in: it lets the generic steering generator introspect the example processor’s parameters at generation time, when the real generated module is not yet importable. Its first docstring line is reused as the steering-file section comment, so it must read like the real example processor’s purpose, and it must stay in sync with the example.py template (same name and parameters).

Processor parameters

  • last_value: Sum the integers from 0 up to, but excluding, this value. (default: 10)

Constructor parameters

Parameters:
  • name (str, Optional) – The name of the processor. If None is provided, the class name is used instead. Defaults to None.

  • description (str, Optional) – A short description of the processor task. Defaults to the processor name.

  • config (dict, Optional) – A configuration dictionary for this processor. Defaults to None.

  • looper (LoopType, Optional) – Enumerator to define the looping type. Defaults to LoopType.ForLoop

  • user_interface (UserInterfaceBase, Optional) – A user interface instance to be used by the processor to interact with the user.

  • timer (Timer, Optional) – A timer object to measure process duration.

  • timer_params (dict, Optional) – Parameters for the timer object.

  • database (Database, Optional) – A database instance. Defaults to None.

  • database_conf (dict, Optional) – Configuration for the database. Default to None.

  • remove_orphan_files (bool, Optional) – Boolean flag to remove files on disc without a reference to the database. See Standard tables and _remove_orphan_files(). Defaults to True

  • replica_id (str, Optional) – The replica identifier for the current processor.

  • create_standard_tables (bool, Optional) – Boolean flag to create std tables on disk. Defaults to True When a nested steering configuration is loaded, this value can be overridden by the global create_standard_tables entry. Flat processor configurations keep the constructor value.

  • max_workers (int, Optional) – Number of worker threads for parallel loops.

  • queue_size (int, Optional) – Maximum size of the internal queue for the queue-based parallel loop.

  • queue_batch_size (int, Optional) – Number of items processed per worker task in the queue-based parallel loop.

  • kwargs – Keyword arguments that can be used to set processor parameters.

get_items() → Collection[Any][source]

Return an empty item set; the stand-in is never executed.

mafw.scaffold.steering._activate_processors_to_run(content: str) → str[source]

Replace the commented processors_to_run placeholder with an active array.

The generic steering generator emits an explanatory comment and a commented-out processors_to_run line. We replace that block with a valid array listing the example processor, so the generated steering file is runnable as-is.

Parameters:

content (str) – The generated steering-file text.

Returns:

The steering-file text with an active processors_to_run array.

Return type:

str

mafw.scaffold.steering.write_example_steering_file(output_file: Path) → None[source]

Write the deterministic example steering file to output_file.

Parameters:

output_file (Path) – Destination path of the steering file (inside conf/).