"unicore/git@developer.sourcefind.cn:OpenDAS/Uni-Core.git" did not exist on "49c9895b675dad5702200f46f77cf43eca74175e"
Commit 10682826 authored by Kiv Chen's avatar Kiv Chen Committed by GitHub
Browse files

fix: sglang worker log extraction error (#447)

parent 5beba233
...@@ -51,7 +51,8 @@ use crate::protocols::TokenIdType; ...@@ -51,7 +51,8 @@ use crate::protocols::TokenIdType;
const SGLANG_STOP_TIMEOUT: Duration = Duration::from_millis(1500); const SGLANG_STOP_TIMEOUT: Duration = Duration::from_millis(1500);
/// Match sglang python log entries, e.g "[2025-01-30 11:23:16] Some text we want" /// Match sglang python log entries, e.g "[2025-01-30 11:23:16] Some text we want"
const SGLANG_LOG_RE: &str = r"(\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\] )?(.*)"; const SGLANG_LOG_RE: &str =
r"(?<timestamp>\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\] )?(?<message>.*)";
/// Identify sglang log entries with this prefix /// Identify sglang log entries with this prefix
const LOG_PREFIX: &str = "SGLANG"; const LOG_PREFIX: &str = "SGLANG";
...@@ -506,18 +507,15 @@ async fn start_sglang( ...@@ -506,18 +507,15 @@ async fn start_sglang(
let line_re = Regex::new(SGLANG_LOG_RE).unwrap(); let line_re = Regex::new(SGLANG_LOG_RE).unwrap();
let mut lines = stderr.lines(); let mut lines = stderr.lines();
while let Ok(Some(line)) = lines.next_line().await { while let Ok(Some(line)) = lines.next_line().await {
if let Some(cap) = line_re.captures(&line) { if let Some(caps) = line_re.captures(&line) {
match cap.len() { match caps.name("timestamp") {
2 => { Some(_) => {
// No date/time, these are usually errors // Skip Python's date/time. Should be normal log
tracing::warn!("{LOG_PREFIX}{tp_rank} {line}"); tracing::debug!("{LOG_PREFIX}{tp_rank} {}", &caps["message"]);
}
3 => {
// Normal log line. Skip Python's date/time
tracing::debug!("{LOG_PREFIX}{tp_rank} {}", &cap[2]);
} }
x => { None => {
unreachable!("sglang log re only has two capture groups, so {x} entries is impossible"); // No date/time. Usually errors
tracing::warn!("{LOG_PREFIX}{tp_rank} {line}");
} }
} }
} }
......
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