Skip to content

Commit df22839

Browse files
authored
Try harder to handle amd-smi invalid json (#52)
We see more cases of this issue, I think the case is more fatal than before so now we just error but at least print the invalid json when we hit it. Warnings are still ignored ROCm/amdsmi#114
1 parent 1d3ff3d commit df22839

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mojo/mojo_host_platform.bzl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,10 @@ def _impl(rctx):
162162
if line.startswith("WARNING:"):
163163
continue
164164
json_lines.append(line)
165-
blob = json.decode("\n".join(json_lines))
165+
failure_sentinel = {"DECODE": "FAILED"}
166+
blob = json.decode("\n".join(json_lines), default = failure_sentinel)
167+
if blob == failure_sentinel:
168+
fail("amd-smi output was not valid json, please report this issue: {}".format(result.stdout))
166169
if len(blob) == 0:
167170
fail("amd-smi succeeded but didn't actually have any GPUs, please report this issue")
168171

0 commit comments

Comments
 (0)