phenotypic.sdk_.sweep_orphan_parts#

phenotypic.sdk_.sweep_orphan_parts(results_root: Path, *, min_age_seconds: float = 21600) int[source]#

Remove stale orphaned .part / .trash directories.

A uuid identifies the attempt, not whether its process is alive. The staged SLURM engine explicitly assumes stale workers can still be running – that is what assert_active_epoch exists for – and under an array the tasks share one output root and start at different times. A sweep with no liveness signal would rmtree the .part directories its siblings are actively filling, which is the same defect a PID-based sweep has.

Two guards, both required:

  • age: only directories whose mtime is older than min_age_seconds are removed;

  • placement: the caller must run this from the controller before any worker is submitted, not from each worker’s start-up (see Phase 3).

The scan is bounded to results/<dataset>/zarr/ rather than recursive: rglob would descend into every store, which is the same ~400k-stat pathology the spec flags for the GUI’s discovery path.

Parameters:
  • results_root (Path) – The run’s results/ directory.

  • min_age_seconds (float) – Minimum age before a leftover is considered orphaned.

Returns:

Number of directories removed.

Return type:

int