diff --git a/backend/tests/dedicated_workers.rs b/backend/tests/dedicated_workers.rs index fc4ff77bb3..c69bcc4563 100644 --- a/backend/tests/dedicated_workers.rs +++ b/backend/tests/dedicated_workers.rs @@ -313,10 +313,10 @@ mod dedicated_worker_tests { Ok(()) } - /// Test flow runners: a squashed for-loop spawns dedicated subprocesses. + /// A squashed for-loop runs each iteration as a regular job, not in a shared subprocess. #[sqlx::test(fixtures("base", "dedicated_flows"))] #[serial] - async fn test_dedicated_flow_runners(db: Pool) -> anyhow::Result<()> { + async fn test_squashed_loop_runs_iterations_as_jobs(db: Pool) -> anyhow::Result<()> { initialize_tracing().await; // Reset dedicated_workers in WORKER_CONFIG to avoid pollution from previous tests. { @@ -355,8 +355,17 @@ mod dedicated_worker_tests { // for-loop over [1, 2, 3], each * 10 = [10, 20, 30] assert_eq!(job.json_result().unwrap(), json!([10, 20, 30])); - // Verify the loop iterations ran on dedicated worker subprocesses - assert_ran_on_dedicated_worker(&db, job.id, "bun").await; + let in_subprocess: i64 = sqlx::query_scalar( + "WITH RECURSIVE t(id) AS ( + SELECT $1::uuid UNION SELECT j.id FROM v2_job j JOIN t ON j.parent_job = t.id + ) + SELECT count(*) FROM job_logs l JOIN t ON l.job_id = t.id + WHERE l.logs LIKE '%dedicated worker%'", + ) + .bind(job.id) + .fetch_one(&db) + .await?; + assert_eq!(in_subprocess, 0); Ok(()) } @@ -732,8 +741,7 @@ mod dedicated_worker_tests { Ok(()) } - /// Test a squashed for-loop with a bash step (unsupported for flow runners). - /// The bash step can't spawn a flow runner, so each iteration falls back to normal execution. + /// Test a squashed for-loop with a bash step. #[sqlx::test(fixtures("base", "dedicated_flows"))] #[serial] async fn test_dedicated_flow_runners_unsupported_lang( diff --git a/backend/windmill-worker/src/worker_flow.rs b/backend/windmill-worker/src/worker_flow.rs index 300bbab070..28920820fd 100644 --- a/backend/windmill-worker/src/worker_flow.rs +++ b/backend/windmill-worker/src/worker_flow.rs @@ -6500,7 +6500,6 @@ async fn compute_next_flow_transform( FlowModuleValue::WhileloopFlow { modules, modules_node, - squash, skip_failures, failure_threshold, .. @@ -6536,7 +6535,7 @@ async fn compute_next_flow_transform( }; let next_loop_idx = flow_jobs.len(); - let start_runners = next_loop_idx == 0 && squash.unwrap_or(false); + let start_runners = false; next_loop_iteration( flow, status, @@ -6573,7 +6572,6 @@ async fn compute_next_flow_transform( modules_node, iterator, parallel, - squash, iteration_label, skip_failures, failure_threshold, @@ -6659,7 +6657,8 @@ async fn compute_next_flow_transform( ForLoopStatus::NextIteration(mut ns) => { ns.iteration_label = iteration_label; ns.failure_threshold = failure_threshold; - let start_runners = ns.index == 0 && squash.unwrap_or(false); + // A squashed loop runs each iteration as a regular job, like any other loop. + let start_runners = false; next_loop_iteration( flow, status,