Skip to content

Commit

Permalink
fixup! poc
Browse files Browse the repository at this point in the history
  • Loading branch information
uael committed Feb 3, 2025
1 parent 10d84fb commit d709ed9
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 17 deletions.
1 change: 0 additions & 1 deletion backend/migrations/20250201124345_v2_job_status.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ CREATE TABLE IF NOT EXISTS v2_job_status (
-- Flow status fields:
flow_status JSONB,
flow_leaf_jobs JSONB,
flow_preprocessed_args JSONB,
-- Workflow as code fields:
workflow_as_code_status JSONB
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ BEGIN
NEW.__priority := job.priority;
-- 1. `preprocessed_args` -> `flow_status._metadata.preprocessed_args`
IF NEW.preprocessed_args IS NOT NULL AND (NEW.flow_status IS NULL OR jsonb_typeof(NEW.flow_status) = 'object') THEN
NEW.__args = NEW.preprocessed_args;
NEW.flow_status := jsonb_set(
coalesce(NEW.flow_status, '{}'::JSONB),
'{_metadata}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SELECT
q.running,
j.runnable_id AS script_hash,
j.runnable_path AS script_path,
COALESCE(s.flow_preprocessed_args, j.args) AS args,
j.args AS args,
j.raw_code,
q.canceled_by IS NOT NULL AS canceled,
q.canceled_by,
Expand Down
2 changes: 1 addition & 1 deletion backend/windmill-queue/src/jobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ pub async fn add_completed_job<T: Serialize + Send + Sync + ValidableJson>(
WHEN $10::BOOL THEN 'skipped'::job_status
WHEN $4::BOOL THEN 'success'::job_status
ELSE 'failure'::job_status END,
COALESCE($14, (SELECT flow_preprocessed_args FROM v2_job_status WHERE id = $2)))
COALESCE($14, (SELECT result FROM v2_job_completed WHERE id = (($9::JSONB)->'preprocessor_module'->>'job')::UUID)))
ON CONFLICT (id) DO UPDATE SET status = EXCLUDED.status, result = $5 RETURNING duration_ms AS \"duration_ms!\"",
/* $1 */ queued_job.workspace_id,
/* $2 */ queued_job.id,
Expand Down
14 changes: 0 additions & 14 deletions backend/windmill-worker/src/worker_flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,20 +407,6 @@ pub async fn update_flow_status_after_job_completion_internal(
};

if matches!(module_step, Step::PreprocessorStep) {
sqlx::query!(
"UPDATE v2_job_status SET flow_preprocessed_args = (SELECT result FROM v2_job_completed WHERE id = $1)
WHERE id = $2",
job_id_for_status,
flow
)
.execute(db)
.await
.map_err(|e| {
Error::InternalErr(format!(
"error while updating args in preprocessing step: {e:#}"
))
})?;

sqlx::query!(
r#"UPDATE v2_job SET args = '{"reason":"PREPROCESSOR_ARGS_ARE_DISCARDED"}'::jsonb WHERE id = $1"#,
job_id_for_status
Expand Down

0 comments on commit d709ed9

Please sign in to comment.