mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-09-11 20:34:54 +00:00
Different approach, only listen on stdin when LOG_LEVEL=debug
(which
is where dropping to a debugger is important).
This commit is contained in:
parent
6d9515578f
commit
41e674eea9
@ -915,19 +915,19 @@ fn shard_manager(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
// We read stdin in another thread as it seems that lines() can block in some cases
|
// We read stdin in another thread as it seems that lines() can block in some cases
|
||||||
thread::spawn(move || {
|
if LevelFilter::current() >= tracing::Level::DEBUG {
|
||||||
let mut stdin = io::stdin(); // We get `Stdin` here.
|
thread::spawn(move || {
|
||||||
loop {
|
let mut stdin = io::stdin(); // We get `Stdin` here.
|
||||||
let mut buffer = vec![0; 4096];
|
loop {
|
||||||
if let Ok(n) = stdin.read(&mut buffer) {
|
let mut buffer = vec![0; 4096];
|
||||||
if n > 0 {
|
if let Ok(n) = stdin.read(&mut buffer) {
|
||||||
let _ = pstdin.write_all(&buffer[..n]);
|
if n > 0 {
|
||||||
} else {
|
let _ = pstdin.write_all(&buffer[..n]);
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
let mut ready = false;
|
let mut ready = false;
|
||||||
let start_time = Instant::now();
|
let start_time = Instant::now();
|
||||||
@ -1065,8 +1065,6 @@ fn log_lines<R: Sized + Read>(mut bufread: BufReader<R>) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user