Save Handler

The SaveHandler persists each OutputBatch to the results file and keeps the run metadata up to date. On startup it can load a previous save and report the set of already-completed ids, which is how a run resumes after an interruption.

save_handler

SaveHandler

SaveHandler(run_params: RunParams, solver_config: SolverConfig[Any], checker_params: dict[str, Any])

Responsible for handling the result file; so loading the save if it is present, and appending new output to it.

Create a new save handler. If the output file exists, look for a save in it for cross-run persistence. If a save is present, the completed data ids are found and can be retrieved by calling completed_ids_from_save. The save format is JSONL for the output batches and JSON for run metadata.

completed_ids_from_save

completed_ids_from_save() -> set[str]

Return the set of completed data item IDs from the save.

Returns:
  • set[str]

    set[str]: IDs of all completed data items.

save

save(output_batch: OutputBatch[DataT, SolutionT]) -> None

Add the new results to the save file.

Parameters:
  • output_batch (OutputBatch[DataT, SolutionT]) –

    the output batch to save