gui.model.create_run_directory(root, unit, label, today=None)
Create the directory a job writes to, atomically: no two jobs share one.
The name is the one run_directory gives. If another process takes it between the check and mkdir, the next suffix is tried.
Parameters
| root |
Path | str |
The repository root. |
required |
| unit |
str |
The unit name. |
required |
| label |
str |
What ran, for example "mutate". |
required |
| today |
date | None |
The date. Defaults to today. |
None |
Returns
| Path |
Path |
The new, empty directory. |
Examples
from datetime import date
from tempfile import TemporaryDirectory
from spotregen.gui.model import create_run_directory
with TemporaryDirectory() as tmp:
day = date(2026, 10, 11)
print(create_run_directory(tmp, "core.calc", "mutate", day).name)
print(create_run_directory(tmp, "core.calc", "mutate", day).name)
2026-10-11-core.calc-mutate
2026-10-11-core.calc-mutate-2