sweep.load_job_results

sweep.load_job_results(
    cli,
    job,
    registry,
    export_paths,
    *,
    run_id,
    export_type='patch',
    quiet=False,
    load_config=None,
    succeeded_before=0,
)

Load CSV results for a single job into the registry.

Extracts result loading logic from recover_sweep_results() for reuse in adaptive sweep runners. Includes retry logic for robustness against filesystem delays and partial writes.

Parameters

Name Type Description Default
cli JoshCLI JoshCLI instance (needed for path resolution). required
job ExpandedJob The completed job to load results for. required
registry RunRegistry Registry to load results into. required
export_paths ExportPaths Export path configuration from inspect_exports(). required
run_id str The run_id to attribute cell_data rows to. Must be the run_id from the specific CLI invocation that produced these results (from registry.start_run() or RegistryCallback.record()). required
export_type str Type of export (“patch”, “meta”, “entity”). 'patch'
quiet bool Suppress output. False
load_config LoadConfig | None Retry and timing configuration. Uses defaults if None. None
succeeded_before int Number of jobs that succeeded before this one. Used for error context in ResultLoadError. 0

Returns

Name Type Description
int Number of rows loaded.

Raises

Name Type Description
ResultLoadError If raise_on_missing=True and CSV not found after retries, or if CSV load fails after retries.

Examples

>>> # Basic usage
>>> run_id = registry.start_run(run_hash=job.run_hash)
>>> result = cli.run(to_run_config(job))
>>> registry.complete_run(run_id, exit_code=result.exit_code)
>>> export_paths = cli.inspect_exports(InspectExportsConfig(...))
>>> rows = load_job_results(cli, job, registry, export_paths, run_id=run_id)