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
72a90997
Commit
72a90997
authored
13 years ago
by
Leo Gordon
Browse files
Options
Downloads
Patches
Plain Diff
experimental: do the job counting immediately by SQL triggers rather than periodically by Perl code
parent
0f477f14
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sql/triggers.mysql
+28
-0
28 additions, 0 deletions
sql/triggers.mysql
sql/triggers.sqlite
+34
-0
34 additions, 0 deletions
sql/triggers.sqlite
with
62 additions
and
0 deletions
sql/triggers.mysql
0 → 100644
+
28
−
0
View file @
72a90997
CREATE TRIGGER add_job AFTER INSERT ON job
FOR EACH ROW
UPDATE analysis_stats SET
total_job_count = total_job_count + 1,
unclaimed_job_count = unclaimed_job_count + (CASE NEW.status WHEN 'READY' 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),
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
total_job_count = total_job_count - 1,
unclaimed_job_count = unclaimed_job_count - (CASE OLD.status WHEN 'READY' 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;
CREATE TRIGGER update_job AFTER UPDATE ON job
FOR EACH ROW
UPDATE analysis_stats SET
unclaimed_job_count = unclaimed_job_count + (CASE NEW.status WHEN 'READY' THEN 1 WHEN 'CLAIMED' 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;
This diff is collapsed.
Click to expand it.
sql/triggers.sqlite
0 → 100644
+
34
−
0
View file @
72a90997
CREATE TRIGGER add_job AFTER INSERT ON job
FOR EACH ROW
BEGIN
UPDATE analysis_stats SET
total_job_count = total_job_count + 1,
unclaimed_job_count = unclaimed_job_count + (CASE NEW.status WHEN 'READY' 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),
status = (CASE WHEN status!='BLOCKED' THEN 'LOADING' ELSE 'BLOCKED' END)
WHERE analysis_id = NEW.analysis_id;
END;
CREATE TRIGGER delete_job AFTER DELETE ON job
FOR EACH ROW
BEGIN
UPDATE analysis_stats SET
total_job_count = total_job_count - 1,
unclaimed_job_count = unclaimed_job_count - (CASE OLD.status WHEN 'READY' 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;
END;
CREATE TRIGGER update_job AFTER UPDATE ON job
FOR EACH ROW
BEGIN
UPDATE analysis_stats SET
unclaimed_job_count = unclaimed_job_count + (CASE NEW.status WHEN 'READY' THEN 1 WHEN 'CLAIMED' 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;
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