From f140d10f08bccde22600f7bdc214c299b1e5d6ec Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Sun, 13 Aug 2023 17:19:10 +0200 Subject: [PATCH] fix tests --- backend/tests/worker.rs | 14 +++++++++++--- backend/windmill-worker/src/worker.rs | 10 +++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/backend/tests/worker.rs b/backend/tests/worker.rs index 935f4c2f1d..a89a27e8c5 100644 --- a/backend/tests/worker.rs +++ b/backend/tests/worker.rs @@ -924,11 +924,19 @@ fn spawn_test_worker( tokio::sync::broadcast::Sender<()>, tokio::task::JoinHandle<()>, ) { + for x in [windmill_worker::LOCK_CACHE_DIR] { + std::fs::DirBuilder::new() + .recursive(true) + .create(x) + .expect("could not create initial worker dir"); + } + let (tx, rx) = tokio::sync::broadcast::channel(1); let db = db.to_owned(); let worker_instance: &str = "test worker instance"; let worker_name: String = next_worker_name(); let ip: &str = Default::default(); + let future = async move { let base_internal_url = format!("http://localhost:{}", port); windmill_worker::run_worker::( @@ -2519,15 +2527,15 @@ async fn test_flow_lock_all(db: Pool) { let listen_first_job = str.next(); in_test_worker(&db, listen_first_job, port).await; - client + let modules = client .get_flow_by_path("test-workspace", "g/all/flow_lock_all") .await .unwrap() .into_inner() .subtype_0 .value - .modules - .into_iter() + .modules; + modules.into_iter() .for_each(|m| { assert!(matches!( m.value, diff --git a/backend/windmill-worker/src/worker.rs b/backend/windmill-worker/src/worker.rs index e112e4717c..8fec2d31ce 100644 --- a/backend/windmill-worker/src/worker.rs +++ b/backend/windmill-worker/src/worker.rs @@ -2169,10 +2169,10 @@ async fn capture_dependency_job( match job_language { ScriptLang::Python3 => { create_dependencies_dir(job_dir).await; - let req = pip_compile(job_id, job_raw_code, logs, job_dir, db, worker_name, w_id).await; + let req: std::result::Result = pip_compile(job_id, job_raw_code, logs, job_dir, db, worker_name, w_id).await; // install the dependencies to pre-fill the cache if let Ok(req) = req.as_ref() { - handle_python_reqs( + let r = handle_python_reqs( req .split("\n") .filter(|x| !x.starts_with("--")) @@ -2185,7 +2185,11 @@ async fn capture_dependency_job( job_dir, worker_dir, ) - .await?; + .await; + + if let Err(e) = r { + tracing::error!("Failed to install python dependencies to prefill the cache: {:?} \n{}", e, logs); + } } req }