Skip to content

Commit 04aac60

Browse files
committed
Dont put #no_uv in requirements.in
Instead postfix hash for requirements.in with `-no_uv`
1 parent 49821d3 commit 04aac60

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

backend/windmill-worker/src/python_executor.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ pub async fn uv_pip_compile(
114114
let mut logs = String::new();
115115
logs.push_str(&format!("\nresolving dependencies..."));
116116
logs.push_str(&format!("\ncontent of requirements:\n{}\n", requirements));
117-
let mut requirements = if let Some(pip_local_dependencies) =
117+
let requirements = if let Some(pip_local_dependencies) =
118118
WORKER_CONFIG.read().await.pip_local_dependencies.as_ref()
119119
{
120120
let deps = pip_local_dependencies.clone();
@@ -144,17 +144,20 @@ pub async fn uv_pip_compile(
144144
};
145145

146146
#[cfg(feature = "enterprise")]
147-
{
148-
requirements = replace_pip_secret(db, w_id, &requirements, worker_name, job_id).await?;
149-
}
147+
let requirements = replace_pip_secret(db, w_id, &requirements, worker_name, job_id).await?;
148+
149+
let mut req_hash = format!("py-{}", calculate_hash(&requirements));
150150

151151
if no_uv || *USE_PIP_COMPILE {
152+
// Set no_uv if not setted
152153
no_uv = true;
153-
// We want to make sure that when we specify `no_uv` lockfile will be resolved again
154-
requirements.push_str("\n#no_uv");
154+
// Make sure that if we put #no_uv (switch to pip-compile) to python code or used `USE_PIP_COMPILE=true` variable.
155+
// Windmill will recalculate lockfile using pip-compile and dont take potentially broken lockfile (generated by uv) from cache (our db).
156+
// It will recalculate lockfile even if inputs have not been changed.
157+
req_hash.push_str("-no_uv");
158+
// Will be in format:
159+
// py-000..000-no_uv
155160
}
156-
157-
let req_hash = format!("py-{}", calculate_hash(&requirements));
158161
if !no_cache {
159162
if let Some(cached) = sqlx::query_scalar!(
160163
"SELECT lockfile FROM pip_resolution_cache WHERE hash = $1",

0 commit comments

Comments
 (0)