mafw.steering.builder
Editable steering configuration builder independent from the execution engine.
- Author:
Bulgheroni Antonio
- Description:
Provides helpers to construct steering metadata without running processors.
Classes
Editable domain model for building MAFw steering files. |
|
|
Validation tiers that can be requested from the steering builder. |
- class mafw.steering.builder.SteeringBuilder[source]
Bases:
objectEditable domain model for building MAFw steering files.
- classmethod from_toml(path: Path | str) SteeringBuilder[source]
Create a builder from an existing steering file while keeping TOML metadata.
- classmethod from_toml_text(text: str) SteeringBuilder[source]
Create a builder from TOML text while keeping TOML metadata.
- _parse_storage_configuration(value: Any) None[source]
Parse a storage table while retaining malformed values for validation.
- add_group(name: str, processors: Iterable[str], description: str | None = None) None[source]
Register a processor group.
- add_processor(base_name: str, replica: str | None = None) None[source]
Add a processor reference to the global processors_to_run list.
- add_replica(base_name: str, replica: str) None[source]
Create a replica entry without touching the base configuration.
- add_storage_volume(name: str, *, root: str, access: StorageAccess | str = StorageAccess.FULL, type: VolumeStorageType | str = VolumeStorageType.FILESYSTEM, parameters: Mapping[str, Mapping[str, Any]] | None = None, attributes: Mapping[str, Any] | None = None) StorageVolumeConfiguration[source]
Add a named storage volume to the optional global configuration.
- Parameters:
name – Stable logical name of the volume;
:is reserved for the logical file-reference separator.root – Literal filesystem root expression.
access – Access policy, defaulting to
full.type – Backend type, defaulting to
filesystem.parameters – Backend-specific values grouped by backend name.
attributes – Additional volume-level TOML values to preserve.
- Returns:
The newly created volume configuration.
- Raises:
ValueError – If the name is empty or contains
:.KeyError – If the volume name is already present.
Added in version 2.4.
- clear_parameters(processor_full_name: str) None[source]
Clear every parameter override for a processor.
- disable_storage_configuration() None[source]
Disable the StorageConfiguration section while retaining its values.
Added in version 2.4.
- enable_storage_configuration() None[source]
Enable the StorageConfiguration section for serialization.
Added in version 2.4.
- ensure_processor_section(base_name: str) None[source]
Create an empty processor section without adding it to the run list.
- get_group(name: str) GroupConfig[source]
Return the stored configuration for a group section.
- get_processor_config(full_name: str) ProcessorConfig[source]
Return the stored configuration for a processor or replica.
- get_storage_volume(name: str) StorageVolumeConfiguration[source]
Return the named storage volume.
- Parameters:
name – Configured volume name.
- Returns:
The mutable volume configuration.
Added in version 2.4.
- is_db_configuration_enabled() bool[source]
Return whether the DBConfiguration section should be present.
- is_storage_configuration_enabled() bool[source]
Return whether the StorageConfiguration section will be serialized.
Added in version 2.4.
- remove_filter(processor_full_name: str, model_name: str) None[source]
Remove a filter model definition.
- remove_parameter(processor_full_name: str, key: str) None[source]
Remove a processor parameter override if present.
- remove_storage_volume(name: str) None[source]
Remove a named volume and omit the section when it becomes empty.
- Parameters:
name – Configured volume name.
Added in version 2.4.
- remove_storage_volume_parameter(name: str, backend: str, key: str) None[source]
Remove one backend-specific parameter from a named volume.
- Parameters:
name – Configured volume name.
backend – Backend subsection key.
key – Backend parameter name.
Added in version 2.4.
- set_db_attribute(key: str, value: Any | None) None[source]
Store a generic key/value pair inside DBConfiguration.
- set_db_authentication(authentication: Mapping[str, Any] | None) None[source]
Set the database authentication mapping.
- set_db_parameters(parameters: Mapping[str, Mapping[str, Any]] | None) None[source]
Set the backend-specific database parameters mapping.
- set_env_files(paths: Iterable[str]) None[source]
Replace the literal dotenv path list in steering globals.
- set_filter_conditionals(processor_full_name: str, model_name: str, conditionals: list[dict[str, Any]] | None) None[source]
Assign
__conditional__blocks to a filter model.
- set_filter_config(processor_full_name: str, model_name: str, config: dict[str, Any]) None[source]
Replace the configuration for a given filter model.
- set_filter_field(processor_full_name: str, model_name: str, field: str, value: Any) None[source]
Set or update a single field within a filter model.
- set_filter_logic(processor_full_name: str, logic: str | None) None[source]
Set the global
__logic__string for the processor filters.
- set_migration_directory(directory: str | None) None[source]
Set the schema-migration directory in the database configuration.
Added in version 2.4.
- Parameters:
directory (str | None) – The migration directory value, or
Noneto remove it.
- set_parameter(processor_full_name: str, key: str, value: Any) None[source]
Set a processor parameter.
- set_processor_documentation(processor_full_name: str, description: str | None, parameter_help: Mapping[str, str | None] | None = None) None[source]
Store processor and parameter documentation used for generated TOML comments.
- set_processor_filters(processor_full_name: str, filters: dict[str, list[FilterConfig]], logic: str | None) None[source]
Update the filters and logic for a given processor.
- set_processor_new_only(processor_full_name: str, new_only: bool | None) None[source]
Explicitly set
__new_only__for a processor or replica.
- set_processors_to_run(processors: Iterable[str]) None[source]
Overwrite the processors_to_run list.
- set_replica_inheritance(replica_full_name: str, inheritance: bool | None) None[source]
Toggle the inheritance behaviour for a replica.
- set_storage_volume_parameter(name: str, backend: str, key: str, value: Any) None[source]
Set one backend-specific parameter on a named volume.
- Parameters:
name – Configured volume name.
backend – Backend subsection key, such as
filesystem.key – Backend parameter name.
value – TOML-compatible parameter value.
Added in version 2.4.
- to_config_dict() dict[str, Any][source]
Return a plain dictionary representing the steering configuration.
- to_document(*, validation_level: ValidationLevel | None = None) TOMLDocument[source]
Serialize the builder state into a TOML document.
- update_storage_volume(name: str, *, root: str | None = None, access: StorageAccess | str | None = None, type: VolumeStorageType | str | None = None, parameters: Mapping[str, Mapping[str, Any]] | None = None, attributes: Mapping[str, Any] | None = None) StorageVolumeConfiguration[source]
Update selected properties of a named storage volume.
Nonemeans leave a property unchanged; pass an empty mapping to clear backend parameters or extra attributes.- Parameters:
name – Configured volume name.
root – Replacement literal root expression, if supplied.
access – Replacement access policy, if supplied.
type – Replacement backend type, if supplied.
parameters – Replacement backend parameter mapping, if supplied.
attributes – Replacement extra volume values, if supplied.
- Returns:
The updated mutable volume configuration.
Added in version 2.4.
- validate(validation_level: ValidationLevel = ValidationLevel.SEMANTIC) list[ValidationIssue][source]
Run steering validation at the requested level and report every issue.
- write(path: Path | str, *, validation_level: ValidationLevel | None = None) None[source]
Dump the builder to disk.
- property document: TOMLDocument | None
Return the parsed TOML document this builder originated from.
- property extra_globals: dict[str, Any]
Return extra top-level globals preserved from the steering file.