Skip to content

Commit 5f63ce6

Browse files
authored
fix(uv): log stdout on uv pip install error (#6702)
Signed-off-by: pyranota <[email protected]>
1 parent c751a5d commit 5f63ce6

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

backend/windmill-worker/src/python_executor.rs

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1927,12 +1927,21 @@ pub async fn handle_python_reqs(
19271927
}
19281928
};
19291929

1930-
let mut stderr_buf = String::new();
1931-
let mut stderr_pipe = uv_install_proccess
1932-
.stderr()
1933-
.take()
1934-
.ok_or(anyhow!("Cannot take stderr from uv_install_proccess"))?;
1935-
let stderr_future = stderr_pipe.read_to_string(&mut stderr_buf);
1930+
let (mut stderr_buf, mut stdout_buf) = Default::default();
1931+
let (mut stderr_pipe, mut stdout_pipe) = (
1932+
uv_install_proccess
1933+
.stderr()
1934+
.take()
1935+
.ok_or(anyhow!("Cannot take stderr from uv_install_proccess"))?,
1936+
uv_install_proccess
1937+
.stdout()
1938+
.take()
1939+
.ok_or(anyhow!("Cannot take stdout from uv_install_proccess"))?
1940+
);
1941+
let (stderr_future, stdout_future) = (
1942+
stderr_pipe.read_to_string(&mut stderr_buf),
1943+
stdout_pipe.read_to_string(&mut stdout_buf)
1944+
);
19361945

19371946
if let Some(pid) = pids.lock().await.get_mut(i) {
19381947
*pid = uv_install_proccess.id();
@@ -1950,10 +1959,10 @@ pub async fn handle_python_reqs(
19501959
pids.lock().await.get_mut(i).and_then(|e| e.take());
19511960
return Err(anyhow::anyhow!("uv pip install was canceled"));
19521961
},
1953-
(_, exitstatus) = async {
1962+
(_, _, exitstatus) = async {
19541963
// See tokio::process::Child::wait_with_output() for more context
19551964
// Sometimes uv_install_proccess.wait() is not exiting if stderr is not awaited before it :/
1956-
(stderr_future.await, Box::into_pin(uv_install_proccess.wait()).await)
1965+
(stderr_future.await, stdout_future.await, Box::into_pin(uv_install_proccess.wait()).await)
19571966
} => match exitstatus {
19581967
Ok(status) => if !status.success() {
19591968
tracing::warn!(
@@ -1967,7 +1976,7 @@ pub async fn handle_python_reqs(
19671976
&job_id,
19681977
w_id,
19691978
format!(
1970-
"\nError while installing {}:\n{stderr_buf}",
1979+
"\nError while installing {}: \nStderr:\n{stderr_buf}\nStdout:\n{stdout_buf}",
19711980
&req
19721981
),
19731982
&conn,

0 commit comments

Comments
 (0)