milia.benchmark.runs#
Run folders: <root>/<experiment>/runs/<timestamp>-<hash>-<commit>/ with a latest link.
Module Attributes
Environment variable overriding the results root. |
Functions
|
Short git commit of the working directory. |
|
The most recent run folder of an experiment. |
|
The results root: |
|
Create a new run folder, write its |
- milia.benchmark.runs.ROOT = 'MILIA_RESULTS'#
Environment variable overriding the results root.
- milia.benchmark.runs.root()#
The results root:
$MILIA_RESULTS, or./results.- Return type:
- Returns:
The root directory (not created).
Examples
>>> import os >>> os.environ["MILIA_RESULTS"] = "/tmp/out" >>> str(root()) '/tmp/out' >>> del os.environ["MILIA_RESULTS"]
- milia.benchmark.runs.commit()#
Short git commit of the working directory.
- Return type:
- Returns:
The commit hash, or
"nogit"outside a repository.
Examples
>>> isinstance(commit(), str) True
- milia.benchmark.runs.start(experiment, settings=None, base=None)#
Create a new run folder, write its
meta.jsonand pointlatestat it.The folder name joins a UTC timestamp, a hash of the settings and the git commit, so two runs never collide and a run states what produced it.
- Parameters:
- Return type:
- Returns:
The new run folder.
Examples
>>> import tempfile >>> from pathlib import Path >>> folder = start("detectors", {"alpha": 0.1}, base=Path(tempfile.mkdtemp())) >>> (folder / "meta.json").exists(), folder.parent.name (True, 'runs')
- milia.benchmark.runs.latest(experiment, base=None)#
The most recent run folder of an experiment.
- Parameters:
- Return type:
- Returns:
The resolved run folder.
- Raises:
FileNotFoundError – If the experiment has no runs.
Examples
>>> import tempfile >>> from pathlib import Path >>> base = Path(tempfile.mkdtemp()) >>> folder = start("detectors", base=base) >>> latest("detectors", base) == folder.resolve() True