Unverified Commit 8cc300f5 authored by Byron Hsu's avatar Byron Hsu Committed by GitHub
Browse files

Fix router test (#4483)

parent 452db508
...@@ -10,6 +10,7 @@ import threading ...@@ -10,6 +10,7 @@ import threading
import time import time
import unittest import unittest
from concurrent.futures import ThreadPoolExecutor from concurrent.futures import ThreadPoolExecutor
from dataclasses import dataclass
from functools import partial from functools import partial
from types import SimpleNamespace from types import SimpleNamespace
from typing import Callable, List, Optional, Tuple from typing import Callable, List, Optional, Tuple
...@@ -453,7 +454,13 @@ def run_with_timeout( ...@@ -453,7 +454,13 @@ def run_with_timeout(
return ret_value[0] return ret_value[0]
def run_unittest_files(files: List, timeout_per_file: float): @dataclass
class TestFile:
name: str
estimated_time: float = 60
def run_unittest_files(files: List[TestFile], timeout_per_file: float):
tic = time.time() tic = time.time()
success = True success = True
......
import argparse import argparse
import glob import glob
from sglang.test.test_utils import run_unittest_files from sglang.test.test_utils import TestFile, run_unittest_files
if __name__ == "__main__": if __name__ == "__main__":
arg_parser = argparse.ArgumentParser() arg_parser = argparse.ArgumentParser()
...@@ -15,5 +15,6 @@ if __name__ == "__main__": ...@@ -15,5 +15,6 @@ if __name__ == "__main__":
files = glob.glob("**/test_*.py", recursive=True) files = glob.glob("**/test_*.py", recursive=True)
exit_code = run_unittest_files(files, args.timeout_per_file) test_files = [TestFile(name=file) for file in files]
exit_code = run_unittest_files(test_files, args.timeout_per_file)
exit(exit_code) exit(exit_code)
...@@ -267,19 +267,20 @@ impl Router { ...@@ -267,19 +267,20 @@ impl Router {
match sync_client.get(&format!("{}/health", url)).send() { match sync_client.get(&format!("{}/health", url)).send() {
Ok(res) => { Ok(res) => {
if !res.status().is_success() { if !res.status().is_success() {
info!( let msg = format!(
"Worker {} health check is pending with status: {}.", "Worker heatlh check is pending with status {}",
url,
res.status() res.status()
); );
info!("{}", msg);
all_healthy = false; all_healthy = false;
unhealthy_workers.push((url, format!("Status: {}", res.status()))); unhealthy_workers.push((url, msg));
} }
} }
Err(e) => { Err(_) => {
info!("Worker {} health check is pending with error: {}", url, e); let msg = format!("Worker is not ready yet");
info!("{}", msg);
all_healthy = false; all_healthy = false;
unhealthy_workers.push((url, format!("Error: {}", e))); unhealthy_workers.push((url, msg));
} }
} }
} }
...@@ -288,7 +289,7 @@ impl Router { ...@@ -288,7 +289,7 @@ impl Router {
info!("All workers are healthy"); info!("All workers are healthy");
return Ok(()); return Ok(());
} else { } else {
info!("Unhealthy workers:"); info!("Initializing workers:");
for (url, reason) in &unhealthy_workers { for (url, reason) in &unhealthy_workers {
info!(" {} - {}", url, reason); info!(" {} - {}", url, reason);
} }
......
import argparse import argparse
import glob import glob
from dataclasses import dataclass
from sglang.test.test_utils import run_unittest_files
@dataclass
class TestFile:
name: str
estimated_time: float = 60
from sglang.test.test_utils import TestFile, run_unittest_files
suites = { suites = {
"per-commit": [ "per-commit": [
......
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