Skip to content

Commit

Permalink
mysql/trigger: Add trigger for LOADED -> INQ transition
Browse files Browse the repository at this point in the history
Add group maintenace for new job LOADED -> INQ tansition. This is the
reverse of the maintenace for the ASSIGNED -> LOADED transition.
  • Loading branch information
donald committed Jan 29, 2020
1 parent 41ac436 commit 88579ac
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions mysql/create_trigger.sql
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,16 @@ CREATE TRIGGER mxq_update_job BEFORE UPDATE ON mxq_job
stats_total_real_sec_finished = stats_total_real_sec_finished + NEW.stats_real_sec
WHERE group_id = NEW.group_id;

-- LOADED (150) -> INQ(0)
ELSEIF NEW.job_status = 0 AND OLD.job_status IN (150) THEN

UPDATE mxq_group SET
group_sum_starttime = group_sum_starttime - UNIX_TIMESTAMP(OLD.date_start) * NEW.host_slots,
group_jobs_inq = group_jobs_inq + 1,
group_jobs_running = group_jobs_running - 1,
group_slots_running = group_slots_running - OLD.host_slots
WHERE group_id = NEW.group_id;

-- * -> NOT IN [ CANCELLING(989) | CANCELLED(990) ]
ELSEIF NEW.job_status NOT IN (989, 990) THEN

Expand Down

0 comments on commit 88579ac

Please sign in to comment.