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
996cdc68
Commit
996cdc68
authored
11 years ago
by
Leo Gordon
Browse files
Options
Downloads
Patches
Plain Diff
introduced a new -balance option for beekeeper.pl so that semaphore_counts could be force-balanced
parent
243ac805
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
modules/Bio/EnsEMBL/Hive/DBSQL/AnalysisJobAdaptor.pm
+38
-0
38 additions, 0 deletions
modules/Bio/EnsEMBL/Hive/DBSQL/AnalysisJobAdaptor.pm
scripts/beekeeper.pl
+7
-2
7 additions, 2 deletions
scripts/beekeeper.pl
with
45 additions
and
2 deletions
modules/Bio/EnsEMBL/Hive/DBSQL/AnalysisJobAdaptor.pm
+
38
−
0
View file @
996cdc68
...
...
@@ -690,5 +690,43 @@ sub reset_jobs_for_analysis_id {
}
=head2 balance_semaphores
Description: Reset all semaphore_counts to the numbers of unDONE semaphoring jobs.
=cut
sub
balance_semaphores
{
my
(
$self
)
=
@_
;
my
$find_sql
=
qq{
SELECT funnel.job_id, funnel.semaphore_count was, COALESCE(SUM(fan.status!='DONE'),0) should
FROM job funnel
LEFT JOIN job fan ON (funnel.job_id=fan.semaphored_job_id)
WHERE funnel.status='SEMAPHORED'
GROUP BY funnel.job_id
HAVING was<>should OR should=0
}
;
my
$update_sql
=
"
UPDATE job SET
"
.
"
semaphore_count=? ,
"
.
(
(
$self
->
dbc
->
driver
eq
'
pgsql
')
?
"
status = CAST(CASE WHEN semaphore_count>0 THEN 'SEMAPHORED' ELSE 'READY' END AS jw_status)
"
:
"
status = CASE WHEN semaphore_count>0 THEN 'SEMAPHORED' ELSE 'READY' END
"
)
.
"
WHERE job_id=? AND status='SEMAPHORED'
";
my
$find_sth
=
$self
->
prepare
(
$find_sql
);
my
$update_sth
=
$self
->
prepare
(
$update_sql
);
$find_sth
->
execute
();
while
(
my
(
$job_id
,
$was
,
$should
)
=
$find_sth
->
fetchrow_array
())
{
warn
"
Balancing semaphore: job_id=
$job_id
(
$was
->
$should
)
\n
";
$update_sth
->
execute
(
$should
,
$job_id
);
}
$find_sth
->
finish
;
$update_sth
->
finish
;
}
1
;
This diff is collapsed.
Click to expand it.
scripts/beekeeper.pl
+
7
−
2
View file @
996cdc68
...
...
@@ -48,6 +48,7 @@ sub main {
my
$keep_alive
=
0
;
# ==1 means run even when there is nothing to do
my
$check_for_dead
=
0
;
my
$all_dead
=
0
;
my
$balance_semaphores
=
0
;
my
$job_id_for_output
=
0
;
my
$show_worker_stats
=
0
;
my
$kill_worker_id
=
0
;
...
...
@@ -104,6 +105,7 @@ sub main {
'
dead
'
=>
\
$check_for_dead
,
'
killworker=i
'
=>
\
$kill_worker_id
,
'
alldead
'
=>
\
$all_dead
,
'
balance_semaphores
'
=>
\
$balance_semaphores
,
'
no_analysis_stats
'
=>
\
$self
->
{'
no_analysis_stats
'},
'
worker_stats
'
=>
\
$show_worker_stats
,
'
failed_jobs
'
=>
\
$show_failed_jobs
,
...
...
@@ -202,6 +204,8 @@ sub main {
if
(
$all_dead
)
{
$queen
->
register_all_workers_dead
();
}
if
(
$check_for_dead
)
{
$queen
->
check_for_dead_workers
(
$valley
,
1
);
}
if
(
$balance_semaphores
)
{
$self
->
{'
dba
'}
->
get_AnalysisJobAdaptor
->
balance_semaphores
();
}
if
(
$kill_worker_id
)
{
my
$kill_worker
=
$queen
->
fetch_by_dbID
(
$kill_worker_id
);
...
...
@@ -466,8 +470,9 @@ __DATA__
=head2 Other commands/options
-help : print this help
-dead : clean dead jobs for resubmission
-alldead : all outstanding workers
-dead : detect all unaccounted dead workers and reset their jobs for resubmission
-alldead : tell the database all workers are dead (no checks are performed in this mode, so be very careful!)
-balance_semaphores : set all semaphore_counts to the numbers of unDONE fan jobs (emergency use only)
-no_analysis_stats : don't show status of each analysis
-worker_stats : show status of each running worker
-failed_jobs : show all failed jobs
...
...
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