
Clean Up Mismatched or Superseded Checkpoint Files (E5)
Source:R/survival_metrics.R
clean_checkpoints.RdInspects `.rds` checkpoint files in `dir` and removes files from older runs, mismatched fingerprints, or superseded `seed_scheme` versions while keeping the active run's checkpoints.
Usage
clean_checkpoints(
dir,
keep = c("current", "matching", "none"),
run_fingerprint = NULL,
seed_scheme = NULL,
recursive = FALSE,
dry_run = FALSE
)Arguments
- dir
Directory containing checkpoint `.rds` files.
- keep
Retention policy:
- `"current"`
(Default) Keeps checkpoint files belonging to the most recent `checkpoint_run_fingerprint` in each checkpoint family (or the explicitly supplied `run_fingerprint`) and removes older, mismatched, or corrupted checkpoint files.
- `"matching"`
Keeps only checkpoint files matching the supplied `run_fingerprint` and/or `seed_scheme`.
- `"none"`
Removes all checkpoint files in `dir`.
- run_fingerprint
Optional expected `checkpoint_run_fingerprint` hash. When `NULL` under `keep = "current"`, the fingerprint of the newest valid checkpoint file per family (`tune` / `score_outer`) is used.
- seed_scheme
Optional expected seed scheme string (e.g. `"v0.5.6"`).
- recursive
Logical (default `FALSE`). Search subdirectories of `dir`.
- dry_run
Logical (default `FALSE`). When `TRUE`, reports which files would be kept or removed without deleting anything from disk.