Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ensembl-hive
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
7
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
ensembl-hive
Commits
ac793670
Commit
ac793670
authored
13 years ago
by
Leo Gordon
Browse files
Options
Downloads
Patches
Plain Diff
an optimization: do not touch analysis_stats when job.status or job.analysis is not changing
parent
759a38f1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sql/triggers.mysql
+17
-14
17 additions, 14 deletions
sql/triggers.mysql
with
17 additions
and
14 deletions
sql/triggers.mysql
+
17
−
14
View file @
ac793670
...
...
@@ -9,6 +9,7 @@ FOR EACH ROW
status = (CASE WHEN status!='BLOCKED' THEN 'LOADING' ELSE 'BLOCKED' END)
WHERE analysis_id = NEW.analysis_id;
CREATE TRIGGER delete_job AFTER DELETE ON job
FOR EACH ROW
UPDATE analysis_stats SET
...
...
@@ -22,20 +23,22 @@ DELIMITER $$
CREATE TRIGGER update_job AFTER UPDATE ON job
FOR EACH ROW
BEGIN
UPDATE analysis_stats SET
total_job_count = total_job_count - 1,
unclaimed_job_count = unclaimed_job_count - (CASE WHEN (OLD.status = 'READY' AND OLD.semaphore_count <= 0) THEN 1 ELSE 0 END),
done_job_count = done_job_count - (CASE OLD.status WHEN 'DONE' THEN 1 WHEN 'PASSED_ON' THEN 1 ELSE 0 END),
failed_job_count = failed_job_count - (CASE OLD.status WHEN 'FAILED' THEN 1 ELSE 0 END)
WHERE analysis_id = OLD.analysis_id;
UPDATE analysis_stats SET
total_job_count = total_job_count + 1,
unclaimed_job_count = unclaimed_job_count + (CASE WHEN (NEW.status = 'READY' AND NEW.semaphore_count <= 0) THEN 1 ELSE 0 END),
done_job_count = done_job_count + (CASE NEW.status WHEN 'DONE' THEN 1 WHEN 'PASSED_ON' THEN 1 ELSE 0 END),
failed_job_count = failed_job_count + (CASE NEW.status WHEN 'FAILED' THEN 1 ELSE 0 END)
WHERE analysis_id = NEW.analysis_id;
END$$
CASE WHEN (OLD.status<>NEW.status OR OLD.analysis_id<>NEW.analysis_id) THEN
BEGIN
UPDATE analysis_stats SET
total_job_count = total_job_count - 1,
unclaimed_job_count = unclaimed_job_count - (CASE WHEN (OLD.status = 'READY' AND OLD.semaphore_count <= 0) THEN 1 ELSE 0 END),
done_job_count = done_job_count - (CASE OLD.status WHEN 'DONE' THEN 1 WHEN 'PASSED_ON' THEN 1 ELSE 0 END),
failed_job_count = failed_job_count - (CASE OLD.status WHEN 'FAILED' THEN 1 ELSE 0 END)
WHERE analysis_id = OLD.analysis_id;
UPDATE analysis_stats SET
total_job_count = total_job_count + 1,
unclaimed_job_count = unclaimed_job_count + (CASE WHEN (NEW.status = 'READY' AND NEW.semaphore_count <= 0) THEN 1 ELSE 0 END),
done_job_count = done_job_count + (CASE NEW.status WHEN 'DONE' THEN 1 WHEN 'PASSED_ON' THEN 1 ELSE 0 END),
failed_job_count = failed_job_count + (CASE NEW.status WHEN 'FAILED' THEN 1 ELSE 0 END)
WHERE analysis_id = NEW.analysis_id;
END;
END CASE$$
DELIMITER ;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment