Unverified Commit d4fc1a70 authored by Lianmin Zheng's avatar Lianmin Zheng Committed by GitHub
Browse files

Crash the server correctly during error (#2231)

parent db674e3d
import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_child_process
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_TEST,
......@@ -25,7 +25,7 @@ class TestEvalAccuracyLargeChunkedPrefill(unittest.TestCase):
@classmethod
def tearDownClass(cls):
kill_child_process(cls.process.pid, include_self=True)
kill_process_tree(cls.process.pid)
def test_mmlu(self):
args = SimpleNamespace(
......
import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_child_process
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_TEST,
......@@ -31,7 +31,7 @@ class TestEvalAccuracyLargeChunkedPrefill(unittest.TestCase):
@classmethod
def tearDownClass(cls):
kill_child_process(cls.process.pid, include_self=True)
kill_process_tree(cls.process.pid)
def test_mmlu(self):
args = SimpleNamespace(
......
import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_child_process
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_TEST,
......@@ -22,7 +22,7 @@ class TestEvalAccuracyMini(unittest.TestCase):
@classmethod
def tearDownClass(cls):
kill_child_process(cls.process.pid, include_self=True)
kill_process_tree(cls.process.pid)
def test_mmlu(self):
args = SimpleNamespace(
......
......@@ -4,7 +4,7 @@ import unittest
import requests
from transformers import AutoModelForCausalLM, AutoTokenizer
from sglang.srt.utils import kill_child_process
from sglang.srt.utils import kill_process_tree
from sglang.test.test_utils import (
DEFAULT_SMALL_MODEL_NAME_FOR_TEST,
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
......@@ -107,7 +107,7 @@ class TestInputEmbeds(unittest.TestCase):
@classmethod
def tearDownClass(cls):
kill_child_process(cls.process.pid, include_self=True)
kill_process_tree(cls.process.pid)
if __name__ == "__main__":
......
......@@ -9,7 +9,7 @@ from concurrent.futures import ThreadPoolExecutor
import openai
import requests
from sglang.srt.utils import kill_child_process
from sglang.srt.utils import kill_process_tree
from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_TEST,
DEFAULT_URL_FOR_TEST,
......@@ -46,7 +46,7 @@ class TestJSONConstrainedOutlinesBackend(unittest.TestCase):
@classmethod
def tearDownClass(cls):
kill_child_process(cls.process.pid, include_self=True)
kill_process_tree(cls.process.pid)
def run_decode(self, json_schema, return_logprob=False, top_logprobs_num=0, n=1):
response = requests.post(
......
......@@ -10,7 +10,7 @@ from concurrent.futures import ThreadPoolExecutor
import openai
from sglang.srt.hf_transformers_utils import get_tokenizer
from sglang.srt.utils import kill_child_process
from sglang.srt.utils import kill_process_tree
from sglang.test.test_utils import (
DEFAULT_SMALL_MODEL_NAME_FOR_TEST,
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
......@@ -52,7 +52,7 @@ class TestLargeMaxNewTokens(unittest.TestCase):
@classmethod
def tearDownClass(cls):
kill_child_process(cls.process.pid, include_self=True)
kill_process_tree(cls.process.pid)
cls.stdout.close()
cls.stderr.close()
os.remove(STDOUT_FILENAME)
......
......@@ -3,7 +3,7 @@ import unittest
import requests
from sglang.srt.utils import kill_child_process
from sglang.srt.utils import kill_process_tree
from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_TEST,
DEFAULT_URL_FOR_TEST,
......@@ -32,7 +32,7 @@ class TestMatchedStop(unittest.TestCase):
@classmethod
def tearDownClass(cls):
kill_child_process(cls.process.pid, include_self=True)
kill_process_tree(cls.process.pid)
def run_completions_generation(
self,
......
......@@ -2,7 +2,7 @@ import unittest
import requests
from sglang.srt.utils import kill_child_process
from sglang.srt.utils import kill_process_tree
from sglang.test.test_utils import (
DEFAULT_SMALL_MODEL_NAME_FOR_TEST,
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
......@@ -75,7 +75,7 @@ class TestEnableMetrics(unittest.TestCase):
self.assertIn("_bucket{", metrics_content)
finally:
kill_child_process(process.pid, include_self=True)
kill_process_tree(process.pid)
if __name__ == "__main__":
......
import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_child_process
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_MLA_MODEL_NAME_FOR_TEST,
......@@ -25,7 +25,7 @@ class TestMLA(unittest.TestCase):
@classmethod
def tearDownClass(cls):
kill_child_process(cls.process.pid, include_self=True)
kill_process_tree(cls.process.pid)
def test_mmlu(self):
args = SimpleNamespace(
......
import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_child_process
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_MLA_FP8_MODEL_NAME_FOR_TEST,
......@@ -31,7 +31,7 @@ class TestMLA(unittest.TestCase):
@classmethod
def tearDownClass(cls):
kill_child_process(cls.process.pid, include_self=True)
kill_process_tree(cls.process.pid)
def test_mgsm_en(self):
args = SimpleNamespace(
......
......@@ -6,7 +6,7 @@ python -m unittest test_moe_eval_accuracy_large.TestMoEEvalAccuracyLarge.test_mm
import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_child_process
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_MOE_MODEL_NAME_FOR_TEST,
......@@ -35,7 +35,7 @@ class TestMoEEvalAccuracyLarge(unittest.TestCase):
@classmethod
def tearDownClass(cls):
kill_child_process(cls.process.pid, include_self=True)
kill_process_tree(cls.process.pid)
def test_mmlu(self):
args = SimpleNamespace(
......
......@@ -6,7 +6,7 @@ import warnings
from datetime import datetime
from types import SimpleNamespace
from sglang.srt.utils import kill_child_process
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_NIGHTLY_EVAL_FP8_TP1,
......@@ -132,7 +132,7 @@ class TestEvalAccuracyLarge(unittest.TestCase):
def tearDown(self):
if self.process:
kill_child_process(self.process.pid, include_self=True)
kill_process_tree(self.process.pid)
def test_mgsm_en_all_models(self):
warnings.filterwarnings(
......
......@@ -6,7 +6,7 @@ import unittest
from test_nightly_gsm8k_eval import launch_server, parse_models
from sglang.srt.utils import kill_child_process
from sglang.srt.utils import kill_process_tree
from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_NIGHTLY_EVAL_FP8_TP1,
DEFAULT_MODEL_NAME_FOR_NIGHTLY_EVAL_FP8_TP2,
......@@ -32,9 +32,9 @@ class TestEvalAccuracyLarge(unittest.TestCase):
@classmethod
def tearDownClass(cls):
if cls.process:
kill_child_process(cls.process.pid)
kill_process_tree(cls.process.pid)
if cls.eval_process:
kill_child_process(cls.eval_process.pid)
kill_process_tree(cls.eval_process.pid)
def run_evalplus(self, model):
print("Delete evalplus results")
......
......@@ -11,7 +11,7 @@ import unittest
import openai
from sglang.srt.hf_transformers_utils import get_tokenizer
from sglang.srt.utils import kill_child_process
from sglang.srt.utils import kill_process_tree
from sglang.test.test_utils import (
DEFAULT_SMALL_MODEL_NAME_FOR_TEST,
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
......@@ -37,7 +37,7 @@ class TestOpenAIServer(unittest.TestCase):
@classmethod
def tearDownClass(cls):
kill_child_process(cls.process.pid, include_self=True)
kill_process_tree(cls.process.pid)
def run_completion(
self, echo, logprobs, use_list_input, parallel_sample_num, token_input
......
......@@ -3,7 +3,7 @@ from types import SimpleNamespace
import requests
from sglang.srt.utils import kill_child_process
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_TEST,
......@@ -27,7 +27,7 @@ class TestPyTorchSamplingBackend(unittest.TestCase):
@classmethod
def tearDownClass(cls):
kill_child_process(cls.process.pid, include_self=True)
kill_process_tree(cls.process.pid)
def test_mmlu(self):
args = SimpleNamespace(
......
......@@ -8,7 +8,7 @@ from sglang.test.test_utils import (
DEFAULT_SMALL_MODEL_NAME_FOR_TEST,
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
kill_child_process,
kill_process_tree,
popen_launch_server,
)
......@@ -80,7 +80,7 @@ class TestRadixCacheFCFS(unittest.TestCase):
@classmethod
def tearDownClass(cls):
kill_child_process(cls.process.pid, include_self=True)
kill_process_tree(cls.process.pid)
def test_radix_attention(self):
nodes = gen_radix_tree()
......
import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_child_process
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_TEST,
......@@ -22,7 +22,7 @@ class TestRetractDecode(unittest.TestCase):
@classmethod
def tearDownClass(cls):
kill_child_process(cls.process.pid, include_self=True)
kill_process_tree(cls.process.pid)
def test_mmlu(self):
args = SimpleNamespace(
......
......@@ -9,7 +9,7 @@ import unittest
import requests
from sglang.srt.hf_transformers_utils import get_tokenizer
from sglang.srt.utils import kill_child_process
from sglang.srt.utils import kill_process_tree
from sglang.test.test_utils import (
DEFAULT_SMALL_MODEL_NAME_FOR_TEST,
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
......@@ -29,7 +29,7 @@ class TestSessionControl(unittest.TestCase):
@classmethod
def tearDownClass(cls):
kill_child_process(cls.process.pid, include_self=True)
kill_process_tree(cls.process.pid)
def test_session_control(self):
chunks = [
......@@ -191,7 +191,7 @@ class TestSessionControlVision(unittest.TestCase):
@classmethod
def tearDownClass(cls):
kill_child_process(cls.process.pid, include_self=True)
kill_process_tree(cls.process.pid)
def test_session_control(self):
text_chunks = [
......
......@@ -7,7 +7,7 @@ import unittest
import requests
from sglang.srt.utils import kill_child_process
from sglang.srt.utils import kill_process_tree
from sglang.test.test_utils import (
DEFAULT_SMALL_MODEL_NAME_FOR_TEST,
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
......@@ -30,7 +30,7 @@ class TestSkipTokenizerInit(unittest.TestCase):
@classmethod
def tearDownClass(cls):
kill_child_process(cls.process.pid, include_self=True)
kill_process_tree(cls.process.pid)
def run_decode(self, return_logprob=False, top_logprobs_num=0, n=1):
max_new_tokens = 32
......
......@@ -9,7 +9,7 @@ import unittest
import numpy as np
import requests
from sglang.srt.utils import kill_child_process
from sglang.srt.utils import kill_process_tree
from sglang.test.test_utils import (
DEFAULT_SMALL_MODEL_NAME_FOR_TEST,
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
......@@ -29,7 +29,7 @@ class TestSRTEndpoint(unittest.TestCase):
@classmethod
def tearDownClass(cls):
kill_child_process(cls.process.pid, include_self=True)
kill_process_tree(cls.process.pid)
def run_decode(
self,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment