espnet3.utils.logging_utils.log_run_metadata
About 1 min
espnet3.utils.logging_utils.log_run_metadata
espnet3.utils.logging_utils.log_run_metadata(logger: Logger, argv: Iterable[str] | None = None, configs: Mapping[str, Path | None] | None = None, write_requirements: bool = False) → None
Log runtime metadata for the current run.
Logged fields include: : - Start timestamp.
- Python executable and command-line arguments.
- Working directory (current process directory).
- Python version.
- Config paths (if provided).
- Git metadata (commit/branch/dirty), when available.
- Optional requirements snapshot (pip freeze).
Example usage: : ``` ``
<br/>`
<br/>
python
from pathlib import Path
from espnet3.utils.logging_utils import configure_logging, log_run_metadata
<br/>
logger = configure_logging(log_dir=Path(“exp/run1”))
log_run_metadata(
<br/>
> logger,
> argv=[“espnet3-train”, “–config”, “conf/train.yaml”],
<br/>
configs={“train”: Path(“conf/train.yaml”)},
)
<br/>``
<br/>`
Example log output (wrapped for readability):
: ``
[hostname] 2026-02-11 03:57:16 EST (logging_utils.py:376) INFO: [train] === ESPnet3 run started: 2026-02-11T03:57:16.826337 ===
[hostname] 2026-02-11 03:57:16 EST (run.py:244) INFO: [train] === ESPnet3 run started: 2026-02-11T03:57:16.826430 ===
[hostname] 2026-02-11 03:57:16 EST (run.py:244) INFO: [train] Command: /path/to/espnet3/tools/.venv/bin/python run.py ...
[hostname] 2026-02-11 03:57:16 EST (run.py:244) INFO: [train] Python: 3.10.18 (main, Aug 18 2025, 19:18:25) [Clang 20.1.4 ]
[hostname] 2026-02-11 03:57:16 EST (run.py:244) INFO: [train] Working directory: /path/to/espnet3/egs3/librispeech_100/asr
[hostname] 2026-02-11 03:57:16 EST (run.py:244) INFO: [train] train config: /path/to/espnet3/egs3/librispeech_100/asr/conf/train.yaml
[hostname] 2026-02-11 03:57:16 EST (run.py:244) INFO: [train] infer config: /path/to/espnet3/egs3/librispeech_100/asr/conf/inference.yaml
[hostname] 2026-02-11 03:57:16 EST (run.py:244) INFO: [train] measure config: /path/to/espnet3/egs3/librispeech_100/asr/conf/measure.yaml
[hostname] 2026-02-11 03:57:17 EST (run.py:244) INFO: [train] Git: commit=..., short_commit=..., branch=master, worktree=clean
``
* **Parameters:**
* **logger** (*logging.Logger*) – Logger used to emit metadata.
* **argv** (*Iterable* *[**str* *]* *|* *None*) – Command arguments; defaults to sys.argv.
* **configs** (*Mapping* *[**str* *,* *Path* *|* *None* *]* *|* *None*) – Named config paths to log.
* **write_requirements** (*bool*) – If True, export pip freeze output to
requirements.txt alongside the log file.
* **Returns:**
None
### Example
```python
>>> import logging
>>> log_run_metadata(logging.getLogger("espnet3"))