Skip to content

Commit ba13d08

Browse files
committed
include short reason if execution of a run fails
1 parent 26f496d commit ba13d08

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

src/discord-cluster-manager/report.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,20 @@ async def _generate_test_report(thread: discord.Thread, run: RunResult):
113113
return
114114

115115

116+
def _short_fail_reason(run: RunResult):
117+
"""
118+
Translate the exit code of `run` into a short error identifier.
119+
"""
120+
if run.exit_code == consts.ExitCode.TIMEOUT_EXPIRED:
121+
return " (timeout)"
122+
elif run.exit_code == consts.ExitCode.CUDA_FAIL:
123+
return " (cuda api error)"
124+
elif run.exit_code != consts.ExitCode.VALIDATE_FAIL:
125+
return f" (internal error {run.exit_code})"
126+
else:
127+
return ""
128+
129+
116130
def make_short_report(runs: dict[str, EvalResult], full=True) -> list[str]: # noqa: C901
117131
"""
118132
Creates a minimalistic report for `runs`,
@@ -132,7 +146,7 @@ def make_short_report(runs: dict[str, EvalResult], full=True) -> list[str]: # n
132146
if "test" in runs:
133147
test_run = runs["test"].run
134148
if not test_run.success:
135-
result.append("❌ Running tests failed")
149+
result.append("❌ Running tests failed" + _short_fail_reason(test_run))
136150
return result
137151
elif not test_run.passed:
138152
result.append("❌ Testing failed")
@@ -145,7 +159,7 @@ def make_short_report(runs: dict[str, EvalResult], full=True) -> list[str]: # n
145159
if "benchmark" in runs:
146160
bench_run = runs["benchmark"].run
147161
if not bench_run.success:
148-
result.append("❌ Running benchmarks failed")
162+
result.append("❌ Running benchmarks failed" + _short_fail_reason(bench_run))
149163
return result
150164
elif not bench_run.passed:
151165
result.append("❌ Benchmarking failed")
@@ -158,7 +172,7 @@ def make_short_report(runs: dict[str, EvalResult], full=True) -> list[str]: # n
158172
if "leaderboard" in runs:
159173
lb_run = runs["leaderboard"].run
160174
if not lb_run.success:
161-
result.append("❌ Running leaderboard failed")
175+
result.append("❌ Running leaderboard failed" + _short_fail_reason(lb_run))
162176
elif not lb_run.passed:
163177
result.append("❌ Leaderboard run failed")
164178
else:

0 commit comments

Comments
 (0)