instancespace.progress_reporter
Progress reporting for instance space analysis.
Reports build()-time stage progress to external systems via HTTP callbacks or file output. This is what lets a pipeline that is split across multiple processes (e.g. one SLURM job per stage, triggered by a scheduler rather than a single long-lived Python process looping over every stage) tell an orchestrator what happened without that orchestrator polling for it.
Level of detail to include in progress reports.
Status of a pipeline stage.
Serialize stage output for inclusion in progress reports.
Parameters
- instance_space (Any): The InstanceSpace object after stage completion.
- stage_name (str): Name of the completed stage.
- detail_level (OutputDetail): How much detail to include.
Returns
- dict[str, Any]: Dictionary with stage output information.
Abstract base class for progress reporters.
Progress reporters are responsible for communicating stage execution status to external systems. They can include varying levels of detail about stage outputs in their reports.
Report that a stage has started.
Report that a stage has completed successfully.
Parameters
- stage_name (str): Name of the completed stage.
- duration_seconds (float | None): How long the stage took.
- instance_space (Any): The InstanceSpace object. The reporter uses it to save the intermediate state and to add the output data to the report.
Report that a stage has failed.
Reports progress via HTTP POST to a callback URL.
Example callback URL: http://backend:8081/internal/jobs/123/stage-callback
The reporter can include different levels of detail in its callbacks:
- NONE: Just status updates
- METADATA: Status + output type/size information
- FULL: Status + metadata + base64-encoded pickle of InstanceSpace
Initialize the HTTP progress reporter.
Parameters
- callback_url (str): URL to POST progress updates to.
- job_id (int): Job ID for the callback payload.
- auth_token (str | None): Optional bearer token for authentication.
- timeout_seconds (int): HTTP request timeout.
- output_detail (OutputDetail): Level of detail to include for stage outputs.
- include_pickle_on_completion (bool): If True, the final callback includes the full pickle. For the final callback, this setting overrides output_detail.
Report that a stage has completed successfully.
Reports progress by writing to a JSON file.
Useful as a fallback when HTTP callbacks aren't available, or for
debugging/testing. If stages_dir is given, this also writes an
unsigned pickle snapshot of the InstanceSpace after every stage - a
convenient debugging artifact, but not the supported checkpoint/resume
mechanism (see InstanceSpace.save()/InstanceSpace.load(), which sign
the file the same way Model.save()/Model.load() do).
Initialize the file progress reporter.
Parameters
- progress_file (Path): Path to the progress.json file.
- stages_dir (Path | None): Optional directory to save intermediate stage pickles.
Report that a stage has completed successfully.
Report that the entire job has completed.
Inherited Members
Combines multiple progress reporters.
Useful for reporting to both HTTP and file simultaneously.
Report that a stage has started, to every configured reporter.
Report that a stage has completed, to every configured reporter.
Report that a stage has failed, to every configured reporter.
Report that the job has completed, to every configured reporter.
Report that the job has failed, to every configured reporter.
Inherited Members
A no-op reporter for when progress reporting is disabled (the default).
Do nothing.