Skip to content

Commit 225a1d4

Browse files
committed
fix varlen ci test hang
1 parent 51c197c commit 225a1d4

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

.github/workflows/integration_test_8gpu_rl.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,13 @@ jobs:
118118
# (both TP=2) run as separate torchrun invocations so each backend gets a
119119
# fresh process group and vLLM engine; nproc matches each config's
120120
# tensor_parallel_degree (the test builds ParallelDims from it).
121-
RL_TEST_DUMP_FOLDER="$RUNNER_TEMP/artifacts-to-be-uploaded" \
122-
HF_ASSETS_PATH="$MODEL_PATH" torchrun --nproc-per-node=2 -m pytest \
121+
PYTHONFAULTHANDLER=1 RL_TEST_WATCHDOG_SEC=1200 \
122+
RL_TEST_DUMP_FOLDER="$RUNNER_TEMP/artifacts-to-be-uploaded" \
123+
HF_ASSETS_PATH="$MODEL_PATH" timeout -s ABRT 1500 torchrun --nproc-per-node=2 -m pytest \
123124
torchtitan/experiments/rl/tests/test_bitwise_parity.py::TestBitwiseParityVarlen -v
124-
RL_TEST_DUMP_FOLDER="$RUNNER_TEMP/artifacts-to-be-uploaded" \
125-
HF_ASSETS_PATH="$MODEL_PATH" torchrun --nproc-per-node=2 -m pytest \
125+
PYTHONFAULTHANDLER=1 RL_TEST_WATCHDOG_SEC=1200 \
126+
RL_TEST_DUMP_FOLDER="$RUNNER_TEMP/artifacts-to-be-uploaded" \
127+
HF_ASSETS_PATH="$MODEL_PATH" timeout -s ABRT 1500 torchrun --nproc-per-node=2 -m pytest \
126128
torchtitan/experiments/rl/tests/test_bitwise_parity.py::TestBitwiseParityFlex -v
127129
128130
# Run E2E RL integration tests (up to 8 GPUs): includes the MoE TP=4 EP=4

torchtitan/experiments/rl/tests/test_bitwise_parity.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
torchtitan/experiments/rl/tests/test_bitwise_parity.py::TestBitwiseParityFlex -v
3131
"""
3232

33+
import faulthandler
3334
import gc
3435
import logging
3536
import os
@@ -606,6 +607,10 @@ class BitwiseParityTestBase(unittest.TestCase):
606607

607608
@classmethod
608609
def setUpClass(cls):
610+
watchdog_sec = os.environ.get("RL_TEST_WATCHDOG_SEC")
611+
if watchdog_sec:
612+
faulthandler.dump_traceback_later(int(watchdog_sec), exit=True)
613+
609614
world_size = (
610615
dist.get_world_size()
611616
if dist.is_initialized()
@@ -679,13 +684,19 @@ def setUpClass(cls):
679684

680685
@classmethod
681686
def tearDownClass(cls):
687+
if dist.is_initialized():
688+
dist.barrier()
682689
if hasattr(cls, "engine"):
683-
cls.engine.engine_core.shutdown()
690+
renderer = getattr(cls.engine, "renderer", None)
691+
if renderer is not None:
692+
renderer.shutdown()
684693
del cls.engine
685694
if hasattr(cls, "model"):
686695
del cls.model
687696
gc.collect()
688697
torch.cuda.empty_cache()
698+
if dist.is_initialized():
699+
dist.destroy_process_group()
689700

690701
def _assert_logprobs_equal(self, name, a, b, label_a="A", label_b="B"):
691702
"""Assert two logprob sequences are bitwise identical."""

0 commit comments

Comments
 (0)