Simplify flush_cache: reject concurrent requests, remove client-side retry (#21490)

This commit is contained in:
Liangsheng Yin
2026-03-26 16:31:04 -07:00
committed by GitHub
parent 9dc266adb4
commit 8a4cdcd538
9 changed files with 108 additions and 108 deletions
@@ -1,7 +1,6 @@
import os
import random
import tempfile
import time
import unittest
from typing import Dict
@@ -14,7 +13,6 @@ from sglang.test.server_fixtures.disaggregation_fixture import (
from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_TEST,
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
flush_cache_with_retry,
popen_launch_pd_server,
)
@@ -116,8 +114,12 @@ class DisaggregationHiCacheBase(PDDisaggregationServerBase):
self.send_request(self.gen_prompt(1), max_tokens=150)
# Flush device cache to force remote storage access.
time.sleep(2)
flush_cache_with_retry(self.prefill_url)
res = requests.post(
f"{self.prefill_url}/flush_cache",
params={"timeout": 30},
timeout=40,
)
res.raise_for_status()
class TestDisaggregationPrefillWithHiCache(DisaggregationHiCacheBase):
+8 -5
View File
@@ -18,7 +18,6 @@ from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_TEST,
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
find_available_port,
flush_cache_with_retry,
popen_launch_server,
)
@@ -180,8 +179,13 @@ class TestPPWithHiCache(unittest.TestCase):
return False
def flush_cache(self) -> bool:
return flush_cache_with_retry(self.base_url)
def flush_cache(self):
res = requests.post(
f"{self.base_url}/flush_cache",
params={"timeout": 30},
timeout=40,
)
res.raise_for_status()
def test_eval_accuracy(self):
args = SimpleNamespace(
@@ -197,8 +201,7 @@ class TestPPWithHiCache(unittest.TestCase):
metrics_initial = run_eval_few_shot_gsm8k(args)
self.assertGreater(metrics_initial["accuracy"], 0.6)
self.assertTrue(self.flush_cache())
time.sleep(2)
self.flush_cache()
metrics_cached = run_eval_few_shot_gsm8k(args)
self.assertGreater(metrics_cached["accuracy"], 0.6)