quantlab.runs.directory.staged#
- quantlab.runs.directory.staged(final)[source]#
Yield a hidden staging directory that becomes
finalwhen the block succeeds.The run’s files are written into
.{name}.partialbesidefinal, which is renamed into place when the block exits normally (a rename within one filesystem is atomic). On any exception, includingKeyboardInterrupt, the staging directory is removed and the error re-raised, sofinalis complete or absent.- Raises:
- RuntimeError
If
finalalready exists; it is never overwritten.
Examples
>>> with staged(root / "run_1") as staging: ... write_files(staging) >>> (root / "run_1").is_dir() True