Skip to content

Commit 67f69e7

Browse files
committed
Fix lint: shellcheck SC2002 and PYFMT
ACTIONLINT flagged two useless 'cat file | tee' pipes; use tee's stdin redirection instead. PYFMT wanted three expressions wrapped -- applied via black + usort. Also strip() the Buildkite token and report the HTTP status on fetch failure, after the first CI run 401'd on every cluster with no indication of why.
1 parent d110187 commit 67f69e7

2 files changed

Lines changed: 26 additions & 9 deletions

File tree

.github/workflows/vllm-torch-nightly-triage.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ jobs:
8080
if: steps.report.outputs.has_report == 'true'
8181
run: |
8282
set -euo pipefail
83-
cat "${RUNNER_TEMP}/report.md"
84-
cat "${RUNNER_TEMP}/report.md" >> "${GITHUB_STEP_SUMMARY}"
83+
tee -a "${GITHUB_STEP_SUMMARY}" < "${RUNNER_TEMP}/report.md"
8584
8685
- name: No comparable build
8786
if: steps.report.outputs.has_report != 'true'
@@ -173,7 +172,7 @@ jobs:
173172
run: |
174173
set -euo pipefail
175174
if [[ -s "${RUNNER_TEMP}/findings.md" ]]; then
176-
cat "${RUNNER_TEMP}/findings.md" | tee -a "${GITHUB_STEP_SUMMARY}"
175+
tee -a "${GITHUB_STEP_SUMMARY}" < "${RUNNER_TEMP}/findings.md"
177176
else
178177
echo "Agent produced no findings file." | tee -a "${GITHUB_STEP_SUMMARY}"
179178
fi

tools/torchci/vllm_torch_nightly_triage.py

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434

3535
from torchci.clickhouse import get_clickhouse_client
3636

37-
3837
VLLM_REPO = "https://github.com/vllm-project/vllm.git"
3938
PIPELINE = "CI"
4039

@@ -97,7 +96,9 @@ def find_latest_pair(
9796
)
9897

9998
def as_dict(row: Tuple) -> Dict[str, Any]:
100-
return dict(zip(("number", "title", "commit", "created_at", "state", "url"), row))
99+
return dict(
100+
zip(("number", "title", "commit", "created_at", "state", "url"), row)
101+
)
101102

102103
parsed = [as_dict(r) for r in builds]
103104
nightlies = [b for b in parsed if b["title"].startswith(TORCH_NIGHTLY_MSG)]
@@ -228,10 +229,14 @@ def render(
228229
for key, jobs in ordered:
229230
states = sorted({j["state"] for j in jobs})
230231
exits = sorted({str(j["exit_status"]) for j in jobs})
231-
out.append(f"<details><summary><b>{key}</b> — {len(jobs)} job(s), "
232-
f"{'/'.join(states)}, exit {','.join(exits)}</summary>\n")
232+
out.append(
233+
f"<details><summary><b>{key}</b> — {len(jobs)} job(s), "
234+
f"{'/'.join(states)}, exit {','.join(exits)}</summary>\n"
235+
)
233236
for j in sorted(jobs, key=lambda x: x["name"]):
234-
out.append(f"- [{j['name']}]({j['url']}) — `{j['state']}` exit `{j['exit_status']}`")
237+
out.append(
238+
f"- [{j['name']}]({j['url']}) — `{j['state']}` exit `{j['exit_status']}`"
239+
)
235240
out.append("\n</details>")
236241

237242
out.append("\n### Infrastructure check\n")
@@ -299,6 +304,16 @@ def fetch_cluster_logs(
299304
try:
300305
with urllib.request.urlopen(req, timeout=120) as resp:
301306
body = resp.read().decode("utf-8", errors="replace")
307+
except urllib.error.HTTPError as exc:
308+
hint = ""
309+
if exc.code == 401:
310+
hint = (
311+
" (401 => token invalid for this org. Check it has read_builds "
312+
"and read_build_logs, that the vllm organization is selected, and "
313+
"that the value has no trailing newline.)"
314+
)
315+
print(f"skip {key}: HTTP {exc.code} {exc.reason}{hint}", file=sys.stderr)
316+
continue
302317
except urllib.error.URLError as exc:
303318
print(f"skip {key}: {exc}", file=sys.stderr)
304319
continue
@@ -366,7 +381,10 @@ def main() -> int:
366381
if args.logs_dir and buckets["regressed"]:
367382
import os as _os
368383

369-
token = _os.environ.get("BUILDKITE_TOKEN", "")
384+
# .strip() matters: a trailing newline in the value (easy to introduce when
385+
# pasting a token into a secret) makes the Authorization header invalid and
386+
# every request 401s.
387+
token = _os.environ.get("BUILDKITE_TOKEN", "").strip()
370388
if not token:
371389
# Not fatal: the report above is still useful without logs.
372390
print("BUILDKITE_TOKEN unset; skipping log fetch", file=sys.stderr)

0 commit comments

Comments
 (0)