ci: make multi-GPU jit test hangs attributable from the CI log (#29925)

This commit is contained in:
Alison Shao
2026-07-07 19:56:32 -07:00
committed by GitHub
parent 7bc343470f
commit f3c3eea608
2 changed files with 12 additions and 1 deletions
+4
View File
@@ -168,6 +168,10 @@ def multigpu_launch(
os.environ[pid_key] = str(os.getpid())
os.environ.setdefault("OMP_NUM_THREADS", "1")
os.environ.setdefault("GLOO_SOCKET_IFNAME", "lo") # single-machine setup
# Unbuffered child stdout: when a worker is killed on timeout, pytest's
# block-buffered progress output is otherwise lost or flushed out of
# order into the CI log, making it impossible to tell which test hung.
os.environ.setdefault("PYTHONUNBUFFERED", "1")
signal.signal(signal.SIGINT, signal.default_int_handler)
runnable: List[int] = []
for N in sorted(num_gpus):
+8 -1
View File
@@ -43,7 +43,14 @@ def multigpu_pytest_main(
# CI's run_unittest_files invokes `python3 <file> -f` (legacy
# unittest failfast). Translate to pytest's `-x` so it survives.
pytest_args = ["-x" if a == "-f" else a for a in sys.argv[1:]]
return pytest.main([file] + pytest_args)
# Dump all thread stacks (every rank; stderr is not redirected) if a
# single test exceeds half the harness budget, so a hung collective
# is attributable from the CI log before the outer timeout kills the
# process group. Non-fatal: the test keeps running after the dump.
dump_after = (timeout // 2) if timeout else 300
return pytest.main(
[file, "-o", f"faulthandler_timeout={dump_after}"] + pytest_args
)
return multigpu_launch(
name,