discover_checkpoint

jaxrens.cli.output_gate.discover_checkpoint(working_dir, prefix)[source]

Pick the checkpoint to restart from in working_dir.

Strategy:
  • Look for {prefix}.final.checkpoint.h5 and {prefix}.checkpoint.h5.

  • If neither exists → SystemExit(2) listing the dir.

  • If exactly one exists → use it.

  • If both exist → use the higher-mtime one. On exact mtime tie the .final variant wins (a completed-run final beats the last rolling write that produced it).

  • The chosen path is logged so the audit trail records which file actually drove the restart.

Returns:

Absolute path of the chosen checkpoint.

Raises:

SystemExit – With code 2 when no candidate exists.

Parameters:
Return type:

Path