[CI] Graceful teardown for the radix_cache server fixtures (#36605)

This commit is contained in:
Alison Shao
2026-08-27 16:36:04 +08:00
committed by GitHub
parent c2c3320cf0
commit a126a5fa31
11 changed files with 27 additions and 27 deletions
@@ -13,8 +13,8 @@ from sglang.test.test_utils import (
DEFAULT_URL_FOR_TEST, DEFAULT_URL_FOR_TEST,
CustomTestCase, CustomTestCase,
is_in_ci, is_in_ci,
kill_process_tree,
popen_launch_server, popen_launch_server,
terminate_and_kill_process_tree,
) )
# RadixAttention server integration tests # RadixAttention server integration tests
@@ -44,7 +44,7 @@ class TestRadixCacheFCFS(CustomTestCase):
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
kill_process_tree(cls.process.pid) terminate_and_kill_process_tree(cls.process, wait_timeout=60)
def test_radix_attention(self): def test_radix_attention(self):
run_radix_attention_test(self.base_url) run_radix_attention_test(self.base_url)
@@ -1,6 +1,5 @@
import unittest import unittest
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import ( from sglang.test.ci.ci_register import (
register_amd_ci, register_amd_ci,
register_cpu_ci, register_cpu_ci,
@@ -13,6 +12,7 @@ from sglang.test.test_utils import (
DEFAULT_URL_FOR_TEST, DEFAULT_URL_FOR_TEST,
CustomTestCase, CustomTestCase,
popen_launch_server, popen_launch_server,
terminate_and_kill_process_tree,
) )
register_cuda_ci(est_time=55, stage="base-b", runner_config="1-gpu-small") register_cuda_ci(est_time=55, stage="base-b", runner_config="1-gpu-small")
@@ -35,7 +35,7 @@ class TestRadixCacheHit(CustomTestCase):
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
kill_process_tree(cls.process.pid) terminate_and_kill_process_tree(cls.process, wait_timeout=60)
def test_multiturn_cache_hit(self): def test_multiturn_cache_hit(self):
run_multiturn_cache_hit_test( run_multiturn_cache_hit_test(
@@ -5,7 +5,6 @@ import unittest
from types import SimpleNamespace from types import SimpleNamespace
from urllib.parse import urlparse from urllib.parse import urlparse
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.kits.unified_radix_cache_kit import ( from sglang.test.kits.unified_radix_cache_kit import (
AccuracyTwoPassMixin, AccuracyTwoPassMixin,
@@ -17,6 +16,7 @@ from sglang.test.test_utils import (
DEFAULT_URL_FOR_TEST, DEFAULT_URL_FOR_TEST,
CustomTestCase, CustomTestCase,
popen_launch_server, popen_launch_server,
terminate_and_kill_process_tree,
) )
register_cuda_ci(est_time=900, stage="base-c", runner_config="4-gpu-h100") register_cuda_ci(est_time=900, stage="base-c", runner_config="4-gpu-h100")
@@ -105,7 +105,7 @@ class TestUnifiedQwen3HiCachePP(UnifiedRadixTreeTestMixin, CustomTestCase):
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
kill_process_tree(cls.process.pid) terminate_and_kill_process_tree(cls.process, wait_timeout=60)
class TestUnifiedQwen3HiCachePPL3(AccuracyTwoPassMixin, CustomTestCase): class TestUnifiedQwen3HiCachePPL3(AccuracyTwoPassMixin, CustomTestCase):
@@ -157,7 +157,7 @@ class TestUnifiedQwen3HiCachePPL3(AccuracyTwoPassMixin, CustomTestCase):
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
kill_process_tree(cls.process.pid) terminate_and_kill_process_tree(cls.process, wait_timeout=60)
if os.path.isdir(cls.hicache_dir): if os.path.isdir(cls.hicache_dir):
shutil.rmtree(cls.hicache_dir, ignore_errors=True) shutil.rmtree(cls.hicache_dir, ignore_errors=True)
@@ -1,6 +1,5 @@
import unittest import unittest
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.kits.unified_radix_cache_kit import UnifiedRadixTreeTestMixin from sglang.test.kits.unified_radix_cache_kit import UnifiedRadixTreeTestMixin
from sglang.test.kl_multiturn_utils import get_input_ids from sglang.test.kl_multiturn_utils import get_input_ids
@@ -9,6 +8,7 @@ from sglang.test.test_utils import (
DEFAULT_URL_FOR_TEST, DEFAULT_URL_FOR_TEST,
CustomTestCase, CustomTestCase,
popen_launch_server, popen_launch_server,
terminate_and_kill_process_tree,
) )
register_cuda_ci(est_time=950, stage="extra-b", runner_config="4-gpu-h100") register_cuda_ci(est_time=950, stage="extra-b", runner_config="4-gpu-h100")
@@ -69,7 +69,7 @@ class TestUnifiedQwen3HiCacheCP(UnifiedRadixTreeTestMixin, CustomTestCase):
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
kill_process_tree(cls.process.pid) terminate_and_kill_process_tree(cls.process, wait_timeout=60)
if __name__ == "__main__": if __name__ == "__main__":
@@ -10,7 +10,6 @@ Blackwell-only: the MLA DCP decode path needs ``tokenspeed_mla`` (SM100/12x).
import subprocess import subprocess
import unittest import unittest
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.kits.unified_radix_cache_kit import UnifiedRadixTreeTestMixin from sglang.test.kits.unified_radix_cache_kit import UnifiedRadixTreeTestMixin
from sglang.test.kl_multiturn_utils import ( from sglang.test.kl_multiturn_utils import (
@@ -23,6 +22,7 @@ from sglang.test.test_utils import (
DEFAULT_URL_FOR_TEST, DEFAULT_URL_FOR_TEST,
CustomTestCase, CustomTestCase,
popen_launch_server, popen_launch_server,
terminate_and_kill_process_tree,
) )
register_cuda_ci(est_time=1500, stage="extra-b", runner_config="4-gpu-b200") register_cuda_ci(est_time=1500, stage="extra-b", runner_config="4-gpu-b200")
@@ -104,7 +104,7 @@ class TestUnifiedKimiLinearDcpHiCache(UnifiedRadixTreeTestMixin, CustomTestCase)
cls.process.wait(timeout=60) cls.process.wait(timeout=60)
except subprocess.TimeoutExpired: except subprocess.TimeoutExpired:
pass pass
kill_process_tree(cls.process.pid) terminate_and_kill_process_tree(cls.process, wait_timeout=60)
if __name__ == "__main__": if __name__ == "__main__":
@@ -6,7 +6,6 @@ import unittest
import requests import requests
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.kits.unified_radix_cache_kit import ( from sglang.test.kits.unified_radix_cache_kit import (
AccuracyTwoPassMixin, AccuracyTwoPassMixin,
@@ -18,6 +17,7 @@ from sglang.test.test_utils import (
CustomTestCase, CustomTestCase,
is_in_ci, is_in_ci,
popen_launch_server, popen_launch_server,
terminate_and_kill_process_tree,
) )
DSV4_FLASH_MODEL = "sgl-project/DeepSeek-V4-Flash-FP8" DSV4_FLASH_MODEL = "sgl-project/DeepSeek-V4-Flash-FP8"
@@ -109,7 +109,7 @@ class TestUnifiedDeepSeekV4FlashHiCache(UnifiedRadixTreeTestMixin, CustomTestCas
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
kill_process_tree(cls.process.pid) terminate_and_kill_process_tree(cls.process, wait_timeout=60)
class TestUnifiedDeepSeekV4FlashHiCachePageFirstDirect( class TestUnifiedDeepSeekV4FlashHiCachePageFirstDirect(
@@ -180,7 +180,7 @@ class TestUnifiedDeepSeekV4FlashHiCacheL3(AccuracyTwoPassMixin, CustomTestCase):
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
kill_process_tree(cls.process.pid) terminate_and_kill_process_tree(cls.process, wait_timeout=60)
if os.path.isdir(cls.hicache_dir): if os.path.isdir(cls.hicache_dir):
shutil.rmtree(cls.hicache_dir, ignore_errors=True) shutil.rmtree(cls.hicache_dir, ignore_errors=True)
@@ -257,7 +257,7 @@ class TestUnifiedDeepSeekV4FlashEagleHiCacheL3(AccuracyTwoPassMixin, CustomTestC
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
kill_process_tree(cls.process.pid) terminate_and_kill_process_tree(cls.process, wait_timeout=60)
if os.path.isdir(cls.hicache_dir): if os.path.isdir(cls.hicache_dir):
shutil.rmtree(cls.hicache_dir, ignore_errors=True) shutil.rmtree(cls.hicache_dir, ignore_errors=True)
@@ -1,6 +1,5 @@
import unittest import unittest
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci
from sglang.test.kits.unified_radix_cache_kit import UnifiedRadixTreeTestMixin from sglang.test.kits.unified_radix_cache_kit import UnifiedRadixTreeTestMixin
from sglang.test.kl_multiturn_utils import get_input_ids from sglang.test.kl_multiturn_utils import get_input_ids
@@ -9,6 +8,7 @@ from sglang.test.test_utils import (
DEFAULT_URL_FOR_TEST, DEFAULT_URL_FOR_TEST,
CustomTestCase, CustomTestCase,
popen_launch_server, popen_launch_server,
terminate_and_kill_process_tree,
) )
register_cuda_ci(est_time=250, stage="base-b", runner_config="2-gpu-large") register_cuda_ci(est_time=250, stage="base-b", runner_config="2-gpu-large")
@@ -44,7 +44,7 @@ class TestUnifiedFullRadixCache(UnifiedRadixTreeTestMixin, CustomTestCase):
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
kill_process_tree(cls.process.pid) terminate_and_kill_process_tree(cls.process, wait_timeout=60)
if __name__ == "__main__": if __name__ == "__main__":
@@ -9,13 +9,13 @@ import shutil
import tempfile import tempfile
import unittest import unittest
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.kits.unified_radix_cache_kit import AccuracyTwoPassMixin from sglang.test.kits.unified_radix_cache_kit import AccuracyTwoPassMixin
from sglang.test.test_utils import ( from sglang.test.test_utils import (
DEFAULT_URL_FOR_TEST, DEFAULT_URL_FOR_TEST,
CustomTestCase, CustomTestCase,
popen_launch_server, popen_launch_server,
terminate_and_kill_process_tree,
) )
GLM5_MODEL = "zai-org/GLM-5.2-FP8" GLM5_MODEL = "zai-org/GLM-5.2-FP8"
@@ -76,7 +76,7 @@ class TestGLM5UnifiedRadixCacheL3Accuracy(AccuracyTwoPassMixin, CustomTestCase):
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
kill_process_tree(cls.process.pid) terminate_and_kill_process_tree(cls.process, wait_timeout=60)
if os.path.isdir(cls.hicache_dir): if os.path.isdir(cls.hicache_dir):
shutil.rmtree(cls.hicache_dir, ignore_errors=True) shutil.rmtree(cls.hicache_dir, ignore_errors=True)
@@ -42,7 +42,6 @@ import os
import random import random
import unittest import unittest
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.kl_multiturn_utils import ( from sglang.test.kl_multiturn_utils import (
make_mamba_decode_assert, make_mamba_decode_assert,
@@ -67,6 +66,7 @@ from sglang.test.test_utils import (
DEFAULT_URL_FOR_TEST, DEFAULT_URL_FOR_TEST,
CustomTestCase, CustomTestCase,
popen_launch_server, popen_launch_server,
terminate_and_kill_process_tree,
) )
register_cuda_ci(est_time=1150, stage="base-b", runner_config="1-gpu-large") register_cuda_ci(est_time=1150, stage="base-b", runner_config="1-gpu-large")
@@ -158,7 +158,7 @@ class TestUnifiedHybridBitExact(CustomTestCase):
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
if getattr(cls, "process", None) is not None: if getattr(cls, "process", None) is not None:
kill_process_tree(cls.process.pid) terminate_and_kill_process_tree(cls.process, wait_timeout=60)
def _run(self, helper): def _run(self, helper):
helper( helper(
@@ -270,7 +270,7 @@ class TestUnifiedHybridHiCacheBitExact(CustomTestCase):
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
if getattr(cls, "process", None) is not None: if getattr(cls, "process", None) is not None:
kill_process_tree(cls.process.pid) terminate_and_kill_process_tree(cls.process, wait_timeout=60)
def test_multiturn_decode_cache_hit_branching(self): def test_multiturn_decode_cache_hit_branching(self):
groups, branches = 3, 3 groups, branches = 3, 3
@@ -350,7 +350,7 @@ class TestUnifiedHybridMTPBitExact(CustomTestCase):
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
if getattr(cls, "process", None) is not None: if getattr(cls, "process", None) is not None:
kill_process_tree(cls.process.pid) terminate_and_kill_process_tree(cls.process, wait_timeout=60)
def _run(self, helper): def _run(self, helper):
helper( helper(
@@ -3,7 +3,6 @@
import random import random
import unittest import unittest
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.kl_test_utils import ( from sglang.test.kl_test_utils import (
_extract_output_logprobs, _extract_output_logprobs,
@@ -16,6 +15,7 @@ from sglang.test.test_utils import (
DEFAULT_URL_FOR_TEST, DEFAULT_URL_FOR_TEST,
CustomTestCase, CustomTestCase,
popen_launch_server, popen_launch_server,
terminate_and_kill_process_tree,
) )
MIMO_MODEL = "XiaomiMiMo/MiMo-V2.5" MIMO_MODEL = "XiaomiMiMo/MiMo-V2.5"
@@ -97,7 +97,7 @@ class TestUnifiedMiMoHiCacheLoadBackKL(CustomTestCase):
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
kill_process_tree(cls.process.pid) terminate_and_kill_process_tree(cls.process, wait_timeout=60)
@classmethod @classmethod
def _prompt(cls, seed: int) -> list[int]: def _prompt(cls, seed: int) -> list[int]:
@@ -1,6 +1,5 @@
import unittest import unittest
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.kits.unified_radix_cache_kit import UnifiedRadixTreeTestMixin from sglang.test.kits.unified_radix_cache_kit import UnifiedRadixTreeTestMixin
from sglang.test.kl_multiturn_utils import get_input_ids from sglang.test.kl_multiturn_utils import get_input_ids
@@ -9,6 +8,7 @@ from sglang.test.test_utils import (
DEFAULT_URL_FOR_TEST, DEFAULT_URL_FOR_TEST,
CustomTestCase, CustomTestCase,
popen_launch_server, popen_launch_server,
terminate_and_kill_process_tree,
) )
register_cuda_ci(est_time=250, stage="base-b", runner_config="2-gpu-large") register_cuda_ci(est_time=250, stage="base-b", runner_config="2-gpu-large")
@@ -43,7 +43,7 @@ class TestUnifiedSWARadixCache(UnifiedRadixTreeTestMixin, CustomTestCase):
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
kill_process_tree(cls.process.pid) terminate_and_kill_process_tree(cls.process, wait_timeout=60)
if __name__ == "__main__": if __name__ == "__main__":