• one's avatar
    [hytop] Tolerate noisy hy-smi output and return parse error reasons (#7) · 99d8079a
    one authored
    - Add `_decode_json_object_with_noise` to best-effort decode a JSON object from noisy text by trying `json.loads` first and then scanning for a leading `{` and using `JSONDecoder.raw_decode`.
    - Change `parse_hy_smi_output` to strip ANSI, use the new decoder, and return a `(samples, error_reason)` pair where `error_reason` is one of `None`, `"empty output"`, `"invalid json output"`, or `"no card rows in payload"`.
    - Update `collect_node` to unpack the new return shape and include the parse reason in the `NodeResult.error` message when no GPUs were parsed.
    - Update and extend tests in `projects/hytop/tests/test_parser.py` and `projects/hytop/tests/test_service.py` to cover noise-tolerant parsing, specific error reasons, and the service behavior with noisy/invalid output.
    99d8079a
test_parser.py 6.9 KB