From 0194a0964153fe648b764a619bc19a2e2f5ce0a4 Mon Sep 17 00:00:00 2001 From: Kai Jellinghaus Date: Tue, 22 Nov 2022 22:56:06 +0100 Subject: [PATCH] Fix Python flow lock (#931) --- backend/windmill-worker/src/worker.rs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/backend/windmill-worker/src/worker.rs b/backend/windmill-worker/src/worker.rs index 724bcda54d..55cde16e75 100644 --- a/backend/windmill-worker/src/worker.rs +++ b/backend/windmill-worker/src/worker.rs @@ -1861,8 +1861,20 @@ async fn handle_flow_dependency_job( new_flow_modules.push(e); continue; }; + // sync with windmill-api/scripts + let dependencies = match language { + ScriptLang::Python3 => windmill_parser_py::parse_python_imports(&content)?.join("\n"), + _ => content.clone(), + }; let new_lock = capture_dependency_job( - &job.id, &language, &content, logs, job_dir, db, timeout, envs, + &job.id, + &language, + &dependencies, + logs, + job_dir, + db, + timeout, + envs, ) .await; match new_lock { @@ -1877,8 +1889,15 @@ async fn handle_flow_dependency_job( new_flow_modules.push(e); continue; } - Err(_error) => { + Err(error) => { // TODO: Record flow raw script error lock logs + tracing::warn!( + path = path, + language = ?language, + error = ?error, + logs = ?logs, + "Failed to generate flow lock for raw script" + ); e.value = FlowModuleValue::RawScript { lock: None, path: path,