espnet3.utils.logging_utils.log_stage_metadata
Less than 1 minute
espnet3.utils.logging_utils.log_stage_metadata
espnet3.utils.logging_utils.log_stage_metadata(logger: Logger, system: Any, args: Namespace | None) → None
Write per-stage metadata into the active stage log.
This helper records the invocation context that is useful when auditing a stage log after the fact: CLI command line, selected config file paths, environment metadata, and the resolved in-memory configs attached to the system object.
- Parameters:
- logger (logging.Logger) – Logger that should receive the metadata entries. In practice this is the stage logger configured immediately before a stage starts.
- system (Any) – Instantiated system object. Its config roles (from
roles(type(system)), derived from its declared stages) are read as<role>_configattributes and dumped as resolved YAML for reproducibility. - args (argparse.Namespace | None) – Parsed CLI namespace. The function reads a
<role>_configattribute per role, andwrite_requirements, from this namespace when available.
- Returns: This function is logging-only and does not return a value.
- Return type: None
Examples
>>> from argparse import Namespace
>>> from espnet3.contract.stages import StageSpec
>>> class DummySystem:
... stages = (StageSpec(name="train", config="training"),)
... training_config = {"exp_dir": "./exp/train"}
>>> log_stage_metadata(
... logging.getLogger("espnet3"),
... system=DummySystem(),
... args=Namespace(
... training_config="conf/training.yaml",
... write_requirements=False,
... ),
... )