stormlog.diagnose_report
Build the stormlog.report envelope for diagnose bundles.
The PyTorch, TensorFlow and JAX diagnose commands produce the same
diagnostic_summary.json shape (risk_flags, suggestions and a few
memory counters), so one builder turns that summary into findings with
evidence pointers back into the bundle.
Functions
|
Return the report dict for one diagnose bundle. |
|
Reject an |
|
Best-effort fallback after a write failure inside |
|
Build and write |
Exceptions
The diagnose request cannot be served as asked. |
- exception stormlog.diagnose_report.DiagnoseUsageError[source]
Bases:
ValueErrorThe diagnose request cannot be served as asked.
Raised for an invalid option, a runtime that does not support the requested feature, or an output path that is not a directory. The CLIs map it to
ExitCode.USAGE; any other exception from a diagnose run is anERROR.
- stormlog.diagnose_report.build_diagnose_report(*, tool_name, summary, exit_code, session_id, files, thresholds=None, tool_version=None, error=None)[source]
Return the report dict for one diagnose bundle.
thresholdsmaps a risk flag to the threshold the command applied, so the finding can show the observed value next to it.errormarks an incomplete bundle: the verdict summary names the failure and no findings are claimed, because the summary may never have been written.- Parameters:
tool_name (str)
summary (Mapping[str, Any])
exit_code (int)
session_id (str)
files (Sequence[str])
thresholds (Mapping[str, float] | None)
tool_version (str | None)
error (str | None)
- Return type:
dict[str, Any]
- stormlog.diagnose_report.validate_output_directory(output)[source]
Reject an
--outputthat is, or sits under, an existing non-directory.- Raises:
DiagnoseUsageError – when the nearest existing ancestor of
outputis not a directory.- Parameters:
output (str | None)
- Return type:
None
- stormlog.diagnose_report.write_incomplete_bundle(artifact_dir, *, tool_name, summary, session_id, files_written, error, thresholds, write_manifest)[source]
Best-effort fallback after a write failure inside
run_diagnose.Rewrites
report.jsonwith anERRORverdict so it never contradicts the exit code the process returns, then writes the manifest throughwrite_manifestwith the final file list. A stale report that cannot be rewritten is removed rather than left claiming a completed verdict.- Parameters:
artifact_dir (Path)
tool_name (str)
summary (Mapping[str, Any])
session_id (str)
files_written (Sequence[str])
error (str)
thresholds (Mapping[str, float] | None)
write_manifest (Callable[[list[str]], None])
- Return type:
None
- stormlog.diagnose_report.write_verdict_report(artifact_dir, *, tool_name, summary, exit_code, session_id, files, thresholds=None, error=None)[source]
Build and write
report.jsonfor one diagnose bundle.- Parameters:
artifact_dir (Path)
tool_name (str)
summary (Mapping[str, Any])
exit_code (int)
session_id (str)
files (Sequence[str])
thresholds (Mapping[str, float] | None)
error (str | None)
- Return type:
None