Commit dd8ba28f authored by Leo Gordon's avatar Leo Gordon
Browse files

changed the interface of balance_semaphores() : pass in $filter_analysis_id...

changed the interface of balance_semaphores() : pass in $filter_analysis_id instead of $filter_analysis
parent 5c88e337
...@@ -697,16 +697,14 @@ sub reset_jobs_for_analysis_id { ...@@ -697,16 +697,14 @@ sub reset_jobs_for_analysis_id {
=cut =cut
sub balance_semaphores { sub balance_semaphores {
my ($self, $filter_analysis) = @_; my ($self, $filter_analysis_id) = @_;
my $analysis_id = $filter_analysis && $filter_analysis->dbID();
my $find_sql = qq{ my $find_sql = qq{
SELECT funnel.job_id, funnel.semaphore_count was, COALESCE(SUM(fan.status!='DONE'),0) should SELECT funnel.job_id, funnel.semaphore_count was, COALESCE(SUM(fan.status!='DONE'),0) should
FROM job funnel FROM job funnel
LEFT JOIN job fan ON (funnel.job_id=fan.semaphored_job_id) LEFT JOIN job fan ON (funnel.job_id=fan.semaphored_job_id)
WHERE } WHERE }
.($analysis_id ? "funnel.analysis_id=$analysis_id AND " : '') .($filter_analysis_id ? "funnel.analysis_id=$filter_analysis_id AND " : '')
.qq{ .qq{
funnel.status='SEMAPHORED' funnel.status='SEMAPHORED'
GROUP BY funnel.job_id GROUP BY funnel.job_id
......
...@@ -51,7 +51,7 @@ sub schedule_workers_resync_if_necessary { ...@@ -51,7 +51,7 @@ sub schedule_workers_resync_if_necessary {
$queen->check_for_dead_workers($valley, 1); $queen->check_for_dead_workers($valley, 1);
} }
print "Scheduler: re-balancing of semaphore_counts...\n"; print "Scheduler: re-balancing of semaphore_counts...\n";
$queen->db->get_AnalysisJobAdaptor->balance_semaphores(); $queen->db->get_AnalysisJobAdaptor->balance_semaphores($filter_analysis && $filter_analysis->dbID);
print "Scheduler: re-synchronizing the Hive...\n"; print "Scheduler: re-synchronizing the Hive...\n";
$queen->synchronize_hive($filter_analysis); $queen->synchronize_hive($filter_analysis);
......
...@@ -233,7 +233,7 @@ sub main { ...@@ -233,7 +233,7 @@ sub main {
if($all_dead) { $queen->register_all_workers_dead(); } if($all_dead) { $queen->register_all_workers_dead(); }
if($check_for_dead) { $queen->check_for_dead_workers($valley, 1); } if($check_for_dead) { $queen->check_for_dead_workers($valley, 1); }
if($balance_semaphores) { $self->{'dba'}->get_AnalysisJobAdaptor->balance_semaphores( $analysis ); } if($balance_semaphores) { $self->{'dba'}->get_AnalysisJobAdaptor->balance_semaphores( $analysis && $analysis->dbID ); }
if ($max_loops) { # positive $max_loop means limited, negative means unlimited if ($max_loops) { # positive $max_loop means limited, negative means unlimited
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment