checkpoint_transactions

Transactional helpers for Puzzletron HF checkpoint realizations.

Functions

invalidate_realization

Quarantine a published realization after its first load proves it invalid.

prepare_realization_retry

Quarantine stale partial realizations so a retry can rebuild cleanly.

quarantine_incomplete_realization

Move an incomplete or corrupt realization aside before a clean retry.

realization_is_complete

Return whether a realization directory is complete and loadable.

remove_realization_temp_dir

Remove a stale materialization transaction directory if present.

invalidate_realization(checkpoint_dir)

Quarantine a published realization after its first load proves it invalid.

Unlike quarantine_incomplete_realization(), this deliberately permits moving a checkpoint whose manifest and shard inventory look complete. It must therefore only be called from the first-load failure path.

Parameters:

checkpoint_dir (str | Path)

Return type:

Path | None

prepare_realization_retry(output_dir, *, expected_identity=None)

Quarantine stale partial realizations so a retry can rebuild cleanly.

Returns True when the destination was quarantined or absent and a rebuild should proceed. Returns False when a matching complete realization exists.

Parameters:
  • output_dir (str | Path)

  • expected_identity (Mapping[str, str] | None)

Return type:

bool

quarantine_incomplete_realization(checkpoint_dir)

Move an incomplete or corrupt realization aside before a clean retry.

Parameters:

checkpoint_dir (str | Path)

Return type:

Path | None

realization_is_complete(checkpoint_dir)

Return whether a realization directory is complete and loadable.

Parameters:

checkpoint_dir (str | Path)

Return type:

bool

remove_realization_temp_dir(checkpoint_dir)

Remove a stale materialization transaction directory if present.

Parameters:

checkpoint_dir (str | Path)

Return type:

None