Cleaning run artifacts¶
A PyRETIS run leaves a number of generated files and directories
behind – log files, the regenerated out.toml / out.rst, restart
files, the NNN ensemble directories (each holding its generate
scratch, the accepted operational trajectory store and the archive
long-term store), the report directory, the multi-run runs
directory, Python byte-code caches, and so on. (A flat top-level load
directory only exists when it is staged by hand as legacy input, and is no
longer a built-in default.) The pyretis tools clean sub-command removes
them so a run (or example) directory can be reset to its committed inputs:
pyretis tools clean # clean the current directory
pyretis tools clean some/dir # clean another directory
pyretis tools clean --dry-run # list what would be removed, delete nothing
pyretis tools clean deletes immediately; use --dry-run (or -n)
first if you want to preview the list.
Note
pyretis clean (without tools) still works as a deprecated
alias: it prints a one-line notice and then behaves identically. Use
pyretis tools clean in new scripts.
What is removed¶
The removed set is the union of a comprehensive built-in default and an
optional per-directory configuration file. The built-in defaults cover the
full set of artifacts a routed run generates, so a plain run folder
resets with no clean.toml at all:
files – byte-code / compiled order parameters (
*.pyc,*.pyo,*.so), the translated config and restart store (output.toml*,out.toml*,out.rst*,infswap.toml,restart.toml*,pyretis.restart,ensemble.restart), the per-run text output (energy.txt*,order.txt*,pathensemble.txt*,cross.txt*,thermo.txt*,traj.txt*), the logs of bothpyretis runandpyretis analyseincluding their backup copies (pyretis.log*,pyretisanalyse.log*,sim.log,worker[0-9]*.log), the RNG state, the engine scratch of every engine (*.tpr,*.edr,*.cpt,*.lammpstrj, …), and the run-done marker / plots;directories –
__pycache__, theNNNensemble directories ([0-9][0-9][0-9], which subsume theirgenerate/accepted/archivesub-stores), theaccepted/archivestores and their previous names (paths/trajs), the retiredworker*scratch, and thereportandrunsdirectories.
Two mechanisms keep these otherwise-aggressive defaults safe (the clean-safety sweep asserts no git-tracked file is ever removed):
Excluded reference/input directories. Anything below
results,output_data,loadorload_copyis never cleaned. These hold committed reference (golden) output and the committedload/NNNinitial-path inputs a load- or restart-initiated run reads.The ``keep`` list (below), for committed inputs that live outside those excluded names – for example a non-standard committed load directory, or the
load/0..load/7initial paths of the validation suite.
Per-directory configuration¶
Drop a clean.toml next to the files to extend (or replace) the
defaults:
[clean]
use_defaults = true # apply the built-in defaults (default: true)
find_files = ["out.toml*", "*.log"] # extra file-name globs (recursive)
find_dirs = ["report"] # extra directory names (recursive)
rm_paths = ["0*", "lammps/system.data"] # root-relative rm -rf globs
keep = ["load/0", "load/1"] # never delete these (or ancestors)
find_files– file-name globs deleted wherever they occur in the tree (likefind . -name PATTERN -delete).find_dirs– directory names deleted recursively wherever they occur.rm_paths– root-relative paths or globs removed withrm -rfsemantics.keep– paths that must survive; a kept path, anything inside it, and its ancestor directories are never removed. Use this to protect committed inputs that would otherwise match (for example the committedload/0..load/7initial paths of the validation suite).use_defaults = falsedisables the built-in defaults so the file is the complete, explicit recipe.
This replaces the per-example Makefile clean targets used in
earlier PyRETIS versions.