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
import time
import unittest
from concurrent.futures import ThreadPoolExecutor
from dataclasses import dataclass
from functools import partial
from types import SimpleNamespace
from typing import Callable, List, Optional, Tuple
......@@ -453,7 +454,13 @@ def run_with_timeout(
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()
success = True
......
import argparse
import glob
from sglang.test.test_utils import run_unittest_files
from sglang.test.test_utils import TestFile, run_unittest_files
if __name__ == "__main__":
arg_parser = argparse.ArgumentParser()
......@@ -15,5 +15,6 @@ if __name__ == "__main__":
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)
......@@ -267,19 +267,20 @@ impl Router {
match sync_client.get(&format!("{}/health", url)).send() {
Ok(res) => {
if !res.status().is_success() {
info!(
"Worker {} health check is pending with status: {}.",
url,
let msg = format!(
"Worker heatlh check is pending with status {}",
res.status()
);
info!("{}", msg);
all_healthy = false;
unhealthy_workers.push((url, format!("Status: {}", res.status())));
unhealthy_workers.push((url, msg));
}
}
Err(e) => {
info!("Worker {} health check is pending with error: {}", url, e);
Err(_) => {
let msg = format!("Worker is not ready yet");
info!("{}", msg);
all_healthy = false;
unhealthy_workers.push((url, format!("Error: {}", e)));
unhealthy_workers.push((url, msg));
}
}
}
......@@ -288,7 +289,7 @@ impl Router {
info!("All workers are healthy");
return Ok(());
} else {
info!("Unhealthy workers:");
info!("Initializing workers:");
for (url, reason) in &unhealthy_workers {
info!(" {} - {}", url, reason);
}
......
import argparse
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 = {
"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