Skip to content

Commit

Permalink
Fix flock and windows
Browse files Browse the repository at this point in the history
  • Loading branch information
pyranota committed Oct 29, 2024
1 parent 1459824 commit 7b72b0c
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions backend/windmill-worker/src/python_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,7 @@ pub async fn handle_python_reqs(

for (req, venv_p) in req_with_penv {
let mut logs1 = String::new();
logs1.push_str("\n\n--- PIP INSTALL ---\n");
logs1.push_str("\n\n--- UV PIP INSTALL ---\n");
logs1.push_str(&format!("\n{req} is being installed for the first time.\n It will be cached for all ulterior uses."));
append_logs(&job_id, w_id, logs1, db).await;

Expand Down Expand Up @@ -1265,7 +1265,7 @@ pub async fn handle_python_reqs(

envs.push(("HOME", HOME_ENV.as_str()));

tracing::debug!("pip install command: {:?}", command_args);
tracing::debug!("uv pip install command: {:?}", command_args);

#[cfg(unix)]
{
Expand All @@ -1275,7 +1275,12 @@ pub async fn handle_python_reqs(
.envs(envs)
.args([
"-x",
&format!("{}/pip-{}.lock", LOCK_CACHE_DIR, fssafe_req),
&format!(
"{}/{}-{}.lock",
LOCK_CACHE_DIR,
if no_uv_install { "pip" } else { "py311" },
fssafe_req
),
"--command",
&command_args.join(" "),
])
Expand All @@ -1286,15 +1291,16 @@ pub async fn handle_python_reqs(

#[cfg(windows)]
{
let mut pip_cmd = Command::new(PYTHON_PATH.as_str());
let python_path = &command_args[0];
let mut cmd = Command::new(&python_path);
pip_cmd
.env_clear()
.envs(envs)
.env("SystemRoot", SYSTEM_ROOT.as_str())
.args(&command_args[1..])
.stdout(Stdio::piped())
.stderr(Stdio::piped());
start_child_process(pip_cmd, PYTHON_PATH.as_str()).await?
start_child_process(cmd, python_path).await?
}
};

Expand All @@ -1307,7 +1313,7 @@ pub async fn handle_python_reqs(
false,
worker_name,
&w_id,
&format!("pip install {req}"),
&format!("uv pip install {req}"),
None,
false,
occupancy_metrics,
Expand Down

0 comments on commit 7b72b0c

Please sign in to comment.