Commit af273c18 authored by Jessica Severin's avatar Jessica Severin
Browse files

added method AnalysisStatsAdaptor::increment_needed_workers

called when worker dies to replace itself in the needed_workers count since
it's decremented when it's born, and it's counted as living (and subtracted)
as long as it's running.  This gunarantees that another worker will quickly
be created after this one dies (and not need to wait for a synch to happen)
parent 9828df41
......@@ -203,12 +203,22 @@ sub decrement_needed_workers
my $self = shift;
my $analysis_id = shift;
my $sql = "UPDATE analysis_stats SET num_required_workers=num_required_workers-1 ";
$sql .= " WHERE analysis_id='$analysis_id' ";
my $sql = "UPDATE analysis_stats SET num_required_workers=num_required_workers-1 ".
"WHERE analysis_id='$analysis_id' ";
my $sth = $self->prepare($sql);
sub increment_needed_workers
my $self = shift;
my $analysis_id = shift;
my $sql = "UPDATE analysis_stats SET num_required_workers=num_required_workers+1 ".
"WHERE analysis_id='$analysis_id' ";
......@@ -174,8 +174,13 @@ sub register_worker_death {
# re-sync the analysis_stats when a worker dies
# re-sync the analysis_stats when a worker dies as part of dynamic sync system
if($self->synchronize_AnalysisStats($worker->analysis->stats)->status ne 'DONE') {
# since I'm dying I should make sure there is someone to take my place after I'm gone ...
# above synch still sees me as a 'living worker' so I need to compensate for that
......@@ -256,7 +261,7 @@ sub synchronize_AnalysisStats {
return $analysisStats unless($analysisStats);
return $analysisStats unless($analysisStats->analysis_id);
return $analysisStats if(($analysisStats->status eq 'WORKING') and
($analysisStats->seconds_since_last_update < 5*60));
($analysisStats->seconds_since_last_update < 3*60));
return $analysisStats if(($analysisStats->status eq 'SYNCHING') and
($analysisStats->seconds_since_last_update < 10*60));
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