Skip to content

Commit

Permalink
mxqkill: Set date_start and date_end to NOW() when cancelling jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
mariux committed Aug 19, 2015
1 parent 39ab9bf commit 004f084
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mysql/create_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ CREATE TRIGGER mxq_update_job BEFORE UPDATE ON mxq_job
group_mtime=NULL
WHERE group_id=NEW.group_id;
ELSEIF NEW.job_status = 990 AND OLD.job_status IN (0, 100, 989) THEN
SET NEW.date_start = NOW();
SET NEW.date_end = NEW.date_start;
UPDATE mxq_group SET
group_jobs_inq=group_jobs_inq-1,
group_jobs_cancelled=group_jobs_cancelled+1,
Expand Down
8 changes: 8 additions & 0 deletions mysql/fix_cancelled_job_dates.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
UPDATE mxq_job
JOIN mxq_group
ON mxq_job.group_id = mxq_group.group_id
SET mxq_job.date_start = mxq_group.group_date_end,
mxq_job.date_end = mxq_group.group_date_end
WHERE job_status = 990
AND (date_start = 0 OR date_end = 0);

0 comments on commit 004f084

Please sign in to comment.