Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1diff --git a/windmill-worker/src/python_executor.rs b/windmill-worker/src/python_executor.rs 2index 1180652d3..7b4ccf6cf 100644 3--- a/windmill-worker/src/python_executor.rs 4+++ b/windmill-worker/src/python_executor.rs 5@@ -290,70 +290,8 @@ impl PyVersion { 6 occupancy_metrics: &mut Option<&mut OccupancyMetrics>, 7 ) -> error::Result<()> { 8 let v = self.to_string_with_dot(); 9- append_logs(job_id, w_id, format!("\nINSTALLING PYTHON ({})", v), db).await; 10- // Create dirs for newly installed python 11- // If we dont do this, NSJAIL will not be able to mount cache 12- // For the default version directory created during startup (main.rs) 13- DirBuilder::new() 14- .recursive(true) 15- .create(self.to_cache_dir()) 16- .await 17- .expect("could not create initial worker dir"); 18- 19- let logs = String::new(); 20- 21- #[cfg(windows)] 22- let uv_cmd = "uv"; 23- 24- #[cfg(unix)] 25- let uv_cmd = UV_PATH.as_str(); 26- 27- let mut child_cmd = Command::new(uv_cmd); 28- child_cmd 29- .env_clear() 30- .env("HOME", HOME_ENV.to_string()) 31- .env("PATH", PATH_ENV.to_string()) 32- .envs(PROXY_ENVS.clone()) 33- .args(["python", "install", v, "--python-preference=only-managed"]) 34- // TODO: Do we need these? 35- .envs([("UV_PYTHON_INSTALL_DIR", PY_INSTALL_DIR)]) 36- .stdout(Stdio::piped()) 37- .stderr(Stdio::piped()); 38- 39- #[cfg(windows)] 40- { 41- child_cmd 42- .env("SystemRoot", SYSTEM_ROOT.as_str()) 43- .env("USERPROFILE", crate::USERPROFILE_ENV.as_str()) 44- .env( 45- "TMP", 46- std::env::var("TMP").unwrap_or_else(|_| String::from("/tmp")), 47- ) 48- .env( 49- "LOCALAPPDATA", 50- std::env::var("LOCALAPPDATA") 51- .unwrap_or_else(|_| format!("{}\\AppData\\Local", HOME_ENV.as_str())), 52- ); 53- } 54- 55- let child_process = start_child_process(child_cmd, "uv").await?; 56- 57- append_logs(&job_id, &w_id, logs, db).await; 58- handle_child( 59- job_id, 60- db, 61- mem_peak, 62- &mut None, 63- child_process, 64- false, 65- worker_name, 66- &w_id, 67- "uv", 68- None, 69- false, 70- occupancy_metrics, 71- ) 72- .await 73+ append_logs(job_id, w_id, format!("\nREQUESTED PYTHON INSTALL IGNORED ({})", v), db).await; 74+ Err(error::Error::BadConfig(format!("Python is managed through the NixOS system configuration. Change the Windmill instance setting to version 'unknown_system_python_version'"))) 75 } 76 async fn find_python(self) -> error::Result<Option<String>> { 77 #[cfg(windows)] 78@@ -391,11 +329,11 @@ impl PyVersion { 79 "find", 80 self.to_string_with_dot(), 81 "--system", 82- "--python-preference=only-managed", 83+ "--python-preference=only-system", 84 ]) 85 .envs([ 86 ("UV_PYTHON_INSTALL_DIR", PY_INSTALL_DIR), 87- ("UV_PYTHON_PREFERENCE", "only-managed"), 88+ ("UV_PYTHON_PREFERENCE", "only-system"), 89 ]) 90 // .stdout(Stdio::piped()) 91 .stderr(Stdio::piped()) 92@@ -561,7 +499,7 @@ pub async fn uv_pip_compile( 93 "-p", 94 &py_version.to_string_with_dot(), 95 "--python-preference", 96- "only-managed", 97+ "only-system", 98 ]); 99 100 if no_cache {