feat: Add toggle to optionally mute error handler for cancelled jobs (#2567)

* fix: Fix canceled flag in completed_job table

* Add toggle to workspace settings
This commit is contained in:
Guillaume Bouvignies
2023-11-06 18:24:51 +01:00
committed by GitHub
parent 1ed52ab4c9
commit 83f9ef34e6
33 changed files with 245 additions and 112 deletions
@@ -17,6 +17,7 @@ use windmill_common::{
worker::WORKER_CONFIG,
DB,
};
use windmill_queue::CanceledBy;
lazy_static::lazy_static! {
static ref PYTHON_PATH: String =
@@ -67,6 +68,7 @@ pub async fn pip_compile(
requirements: &str,
logs: &mut String,
mem_peak: &mut i32,
canceled_by: &mut Option<CanceledBy>,
job_dir: &str,
db: &Pool<Postgres>,
worker_name: &str,
@@ -132,6 +134,7 @@ pub async fn pip_compile(
db,
logs,
mem_peak,
canceled_by,
child_process,
false,
worker_name,
@@ -169,6 +172,7 @@ pub async fn handle_python_job(
job: &QueuedJob,
logs: &mut String,
mem_peak: &mut i32,
canceled_by: &mut Option<CanceledBy>,
db: &sqlx::Pool<sqlx::Postgres>,
client: &AuthedClientBackgroundTask,
inner_content: &String,
@@ -189,6 +193,7 @@ pub async fn handle_python_job(
worker_dir,
logs,
mem_peak,
canceled_by,
)
.await?;
@@ -352,6 +357,7 @@ mount {{
db,
logs,
mem_peak,
canceled_by,
child,
!*DISABLE_NSJAIL,
worker_name,
@@ -502,6 +508,7 @@ async fn handle_python_deps(
worker_dir: &str,
logs: &mut String,
mem_peak: &mut i32,
canceled_by: &mut Option<CanceledBy>,
) -> error::Result<Vec<String>> {
create_dependencies_dir(job_dir).await;
@@ -532,6 +539,7 @@ async fn handle_python_deps(
&requirements,
logs,
mem_peak,
canceled_by,
job_dir,
db,
worker_name,
@@ -555,6 +563,7 @@ async fn handle_python_deps(
w_id,
logs,
mem_peak,
canceled_by,
db,
worker_name,
job_dir,
@@ -571,6 +580,7 @@ pub async fn handle_python_reqs(
w_id: &str,
logs: &mut String,
mem_peak: &mut i32,
canceled_by: &mut Option<CanceledBy>,
db: &sqlx::Pool<sqlx::Postgres>,
worker_name: &str,
job_dir: &str,
@@ -721,6 +731,7 @@ pub async fn handle_python_reqs(
db,
logs,
mem_peak,
canceled_by,
child,
false,
worker_name,
@@ -780,6 +791,7 @@ pub async fn start_worker(
) -> error::Result<()> {
let mut logs = "".to_string();
let mut mem_peak: i32 = 0;
let mut canceled_by: Option<CanceledBy> = None;
let context = variables::get_reserved_variables(
w_id,
&token,
@@ -809,6 +821,7 @@ pub async fn start_worker(
job_dir,
&mut logs,
&mut mem_peak,
&mut canceled_by,
)
.await?;