mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-09 08:03:50 +00:00
big
This commit is contained in:
@@ -37,6 +37,7 @@ use windmill_common::auth::JobPerms;
|
||||
use windmill_common::bench::BenchmarkIter;
|
||||
use windmill_common::lockfiles::is_generated_from_raw_requirements;
|
||||
use windmill_common::jobs::{JobTriggerKind, EMAIL_ERROR_HANDLER_USER_EMAIL};
|
||||
use windmill_common::triggers::TriggerInfo;
|
||||
use windmill_common::utils::{configure_client, now_from_db};
|
||||
use windmill_common::worker::{Connection, MIN_VERSION_SUPPORTS_DEBOUNCING, SCRIPT_TOKEN_EXPIRY};
|
||||
|
||||
@@ -471,7 +472,6 @@ pub async fn push_init_job<'c>(
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
)
|
||||
.await?;
|
||||
inner_tx.commit().await?;
|
||||
@@ -531,7 +531,6 @@ pub async fn push_periodic_bash_job<'c>(
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
)
|
||||
.await?;
|
||||
inner_tx.commit().await?;
|
||||
@@ -1378,7 +1377,6 @@ async fn restart_job_if_perpetual_inner(
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
)
|
||||
.await?;
|
||||
tx.commit().await?;
|
||||
@@ -1930,7 +1928,6 @@ pub async fn push_error_handler<'a, 'c, T: Serialize + Send + Sync>(
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
)
|
||||
.await?;
|
||||
tx.commit().await?;
|
||||
@@ -3871,7 +3868,7 @@ pub async fn push<'c, 'd>(
|
||||
token_prefix: Option<&str>,
|
||||
#[allow(unused_mut)]
|
||||
mut scheduled_for_o: Option<chrono::DateTime<chrono::Utc>>,
|
||||
schedule_path: Option<String>,
|
||||
schedule_path: Option<String>, //should be removed in favor of the trigger param below
|
||||
parent_job: Option<Uuid>,
|
||||
root_job: Option<Uuid>,
|
||||
flow_innermost_root_job: Option<Uuid>,
|
||||
@@ -3890,8 +3887,7 @@ pub async fn push<'c, 'd>(
|
||||
// If we know there is already a debounce job, we can use this for debouncing.
|
||||
// NOTE: Only works with dependency jobs triggered by relative imports
|
||||
debounce_job_id_o: Option<Uuid>,
|
||||
suspend_number: Option<i32>, // If provided, job will be created as suspended with this number
|
||||
trigger_kind: Option<JobTriggerKind>,
|
||||
trigger: Option<TriggerInfo>,
|
||||
) -> Result<(Uuid, Transaction<'c, Postgres>), Error> {
|
||||
#[cfg(feature = "cloud")]
|
||||
if *CLOUD_HOSTED {
|
||||
@@ -5211,6 +5207,16 @@ pub async fn push<'c, 'd>(
|
||||
}
|
||||
}
|
||||
|
||||
let (trigger_path, trigger_kind) = trigger.map_or_else(
|
||||
|| {
|
||||
schedule_path.map(|path| (Some(path), JobTriggerKind::Schedule))
|
||||
},
|
||||
|trigger| {
|
||||
Some((trigger.trigger_path, trigger.trigger_kind))
|
||||
},
|
||||
)
|
||||
.unzip();
|
||||
|
||||
if concurrent_limit.is_some() {
|
||||
insert_concurrency_key(
|
||||
workspace_id,
|
||||
@@ -5286,13 +5292,6 @@ pub async fn push<'c, 'd>(
|
||||
// tracing::error!("Could not insert job_perms for job {job_id}: {err:#}");
|
||||
// }
|
||||
|
||||
let trigger_kind = trigger_kind.or_else(|| {
|
||||
if schedule_path.is_some() {
|
||||
Some(JobTriggerKind::Schedule)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
});
|
||||
|
||||
let root_job = if root_job.is_some()
|
||||
&& (root_job == flow_innermost_root_job.or(parent_job).or(Some(job_id)))
|
||||
@@ -5324,8 +5323,8 @@ pub async fn push<'c, 'd>(
|
||||
ON CONFLICT (job_id) DO UPDATE SET email = EXCLUDED.email, username = EXCLUDED.username, is_admin = EXCLUDED.is_admin, is_operator = EXCLUDED.is_operator, folders = EXCLUDED.folders, groups = EXCLUDED.groups, workspace_id = EXCLUDED.workspace_id, end_user_email = EXCLUDED.end_user_email
|
||||
)
|
||||
INSERT INTO v2_job_queue
|
||||
(workspace_id, id, running, scheduled_for, started_at, tag, priority, suspend)
|
||||
VALUES ($2, $1, $28, COALESCE($29, now()), CASE WHEN $27 OR $40 THEN now() END, $30, $31, $42)",
|
||||
(workspace_id, id, running, scheduled_for, started_at, tag, priority)
|
||||
VALUES ($2, $1, $28, COALESCE($29, now()), CASE WHEN $27 OR $40 THEN now() END, $30, $31)",
|
||||
job_id,
|
||||
workspace_id,
|
||||
raw_code,
|
||||
@@ -5339,7 +5338,7 @@ pub async fn push<'c, 'd>(
|
||||
script_path.clone(),
|
||||
Json(args) as Json<PushArgs>,
|
||||
job_kind.clone() as JobKind,
|
||||
schedule_path,
|
||||
trigger_path.flatten(),
|
||||
language as Option<ScriptLang>,
|
||||
same_worker,
|
||||
pre_run_error.map(|e| e.to_string()),
|
||||
@@ -5371,7 +5370,6 @@ pub async fn push<'c, 'd>(
|
||||
trigger_kind as Option<JobTriggerKind>,
|
||||
running,
|
||||
end_user_email,
|
||||
suspend_number.unwrap_or(0),
|
||||
)
|
||||
.execute(&mut *tx)
|
||||
.warn_after_seconds(1)
|
||||
|
||||
@@ -21,8 +21,10 @@ use windmill_common::get_latest_flow_version_id_for_path;
|
||||
use windmill_common::get_latest_flow_version_info_for_path_from_version;
|
||||
use windmill_common::jobs::check_tag_available_for_workspace_internal;
|
||||
use windmill_common::jobs::JobPayload;
|
||||
use windmill_common::jobs::JobTriggerKind;
|
||||
use windmill_common::schedule::schedule_to_user;
|
||||
use windmill_common::scripts::ScriptHash;
|
||||
use windmill_common::triggers::TriggerInfo;
|
||||
use windmill_common::utils::WarnAfterExt;
|
||||
use windmill_common::worker::to_raw_value;
|
||||
use windmill_common::FlowVersionInfo;
|
||||
@@ -503,8 +505,10 @@ pub async fn push_scheduled_job<'c>(
|
||||
false,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
Some(windmill_common::jobs::JobTriggerKind::Schedule),
|
||||
Some(TriggerInfo::new(
|
||||
Some(schedule.path.clone()),
|
||||
JobTriggerKind::Schedule,
|
||||
)),
|
||||
)
|
||||
.warn_after_seconds_with_sql(1, "push in push_scheduled_job".to_string())
|
||||
.await?;
|
||||
|
||||
Reference in New Issue
Block a user