worker: simplify cancelation

The cancellation informations where moved from bottom to top where the
infromations are already set within the queue table.
This commit is contained in:
Abel Lucas
2024-12-16 14:42:56 +01:00
parent eac92e4230
commit 90ad56d582
24 changed files with 44 additions and 229 deletions
+1 -13
View File
@@ -32,7 +32,7 @@ use windmill_common::{
#[cfg(feature = "enterprise")]
use windmill_common::variables::get_secret_value_as_admin;
use windmill_queue::{append_logs, CanceledBy};
use windmill_queue::append_logs;
lazy_static::lazy_static! {
static ref PYTHON_PATH: String =
@@ -124,7 +124,6 @@ pub async fn uv_pip_compile(
job_id: &Uuid,
requirements: &str,
mem_peak: &mut i32,
canceled_by: &mut Option<CanceledBy>,
job_dir: &str,
db: &Pool<Postgres>,
worker_name: &str,
@@ -256,7 +255,6 @@ pub async fn uv_pip_compile(
job_id,
db,
mem_peak,
canceled_by,
child_process,
false,
worker_name,
@@ -341,7 +339,6 @@ pub async fn uv_pip_compile(
job_id,
db,
mem_peak,
canceled_by,
child_process,
false,
worker_name,
@@ -514,7 +511,6 @@ pub async fn handle_python_job(
worker_name: &str,
job: &QueuedJob,
mem_peak: &mut i32,
canceled_by: &mut Option<CanceledBy>,
db: &sqlx::Pool<sqlx::Postgres>,
client: &AuthedClientBackgroundTask,
inner_content: &String,
@@ -536,7 +532,6 @@ pub async fn handle_python_job(
worker_name,
worker_dir,
mem_peak,
canceled_by,
&mut Some(occupancy_metrics),
)
.await?;
@@ -782,7 +777,6 @@ mount {{
&job.id,
db,
mem_peak,
canceled_by,
child,
!*DISABLE_NSJAIL,
worker_name,
@@ -1058,7 +1052,6 @@ async fn handle_python_deps(
worker_name: &str,
worker_dir: &str,
mem_peak: &mut i32,
canceled_by: &mut Option<CanceledBy>,
occupancy_metrics: &mut Option<&mut OccupancyMetrics>,
) -> error::Result<Vec<String>> {
create_dependencies_dir(job_dir).await;
@@ -1092,7 +1085,6 @@ async fn handle_python_deps(
job_id,
&requirements,
mem_peak,
canceled_by,
job_dir,
db,
worker_name,
@@ -1119,7 +1111,6 @@ async fn handle_python_deps(
job_id,
w_id,
mem_peak,
canceled_by,
db,
worker_name,
job_dir,
@@ -1331,7 +1322,6 @@ pub async fn handle_python_reqs(
job_id: &Uuid,
w_id: &str,
mem_peak: &mut i32,
_canceled_by: &mut Option<CanceledBy>,
db: &sqlx::Pool<sqlx::Postgres>,
_worker_name: &str,
job_dir: &str,
@@ -1914,7 +1904,6 @@ pub async fn start_worker(
killpill_rx: tokio::sync::broadcast::Receiver<()>,
) -> error::Result<()> {
let mut mem_peak: i32 = 0;
let mut canceled_by: Option<CanceledBy> = None;
let context = variables::get_reserved_variables(
db,
w_id,
@@ -1947,7 +1936,6 @@ pub async fn start_worker(
worker_name,
job_dir,
&mut mem_peak,
&mut canceled_by,
&mut None,
)
.await?;