Commit 37e63c93 authored by Leo Gordon's avatar Leo Gordon
Browse files

pass in a Valley instead of the current_meadow (preparatory)

parent 21c06220
......@@ -286,11 +286,13 @@ sub register_worker_death {
}
sub check_for_dead_workers { # a bit counter-intuitively only looks for current meadow's workers, not all of the dead workers.
my ($self, $meadow, $check_buried_in_haste) = @_;
my ($self, $valley, $check_buried_in_haste) = @_;
my $worker_status_hash = $meadow->status_of_all_our_workers();
my %worker_status_summary = ();
my $queen_worker_list = $self->fetch_overdue_workers(0); # maybe it should return a {meadow->worker_count} hash instead?
my $meadow = $valley->get_current_meadow();
my $worker_status_hash = $meadow->status_of_all_our_workers();
my %worker_status_summary = ();
my $queen_worker_list = $self->fetch_overdue_workers(0); # maybe it should return a {meadow->worker_count} hash instead?
print "====== Live workers according to Queen:".scalar(@$queen_worker_list).", Meadow:".scalar(keys %$worker_status_hash)."\n";
......@@ -739,7 +741,9 @@ sub schedule_workers {
sub schedule_workers_resync_if_necessary {
my ($self, $meadow, $analysis) = @_;
my ($self, $valley, $analysis) = @_;
my $meadow = $valley->get_current_meadow();
my $pending_by_rc_id = ($meadow->can('count_pending_workers_by_rc_id') and $meadow->pending_adjust()) ? $meadow->count_pending_workers_by_rc_id() : {};
my $submit_limit = $meadow->submit_workers_max();
......@@ -754,7 +758,7 @@ sub schedule_workers_resync_if_necessary {
unless( keys %$workers_to_run_by_rc_id or $self->get_hive_current_load() or $self->count_running_workers() ) {
print "*** nothing is running and nothing to do (according to analysis_stats) => perform a hard resync\n" ;
$self->check_for_dead_workers($meadow, 1);
$self->check_for_dead_workers($valley, 1);
$self->synchronize_hive($analysis);
$workers_to_run_by_rc_id = $self->schedule_workers($analysis, $pending_by_rc_id, $available_submit_limit);
......
......@@ -200,7 +200,7 @@ sub main {
if($remove_analysis_id) { remove_analysis_id($self, $remove_analysis_id); }
if($all_dead) { $queen->register_all_workers_dead(); }
if($check_for_dead) { $queen->check_for_dead_workers($current_meadow, 1); }
if($check_for_dead) { $queen->check_for_dead_workers($valley, 1); }
if ($kill_worker_id) {
my $worker = $queen->fetch_by_dbID($kill_worker_id);
......@@ -232,7 +232,7 @@ sub main {
if ($max_loops) { # positive $max_loop means limited, negative means unlimited
run_autonomously($self, $max_loops, $keep_alive, $queen, $current_meadow, $analysis);
run_autonomously($self, $max_loops, $keep_alive, $queen, $valley, $analysis);
} else {
# the output of several methods will look differently depending on $analysis being [un]defined
......@@ -344,13 +344,14 @@ sub generate_worker_cmd {
}
sub run_autonomously {
my ($self, $max_loops, $keep_alive, $queen, $current_meadow, $this_analysis) = @_;
my ($self, $max_loops, $keep_alive, $queen, $valley, $this_analysis) = @_;
unless(`runWorker.pl`) {
print("can't find runWorker.pl script. Please make sure it's in your path\n");
exit(1);
}
my $current_meadow = $valley->get_current_meadow();
my $worker_cmd = generate_worker_cmd($self);
# pre-hash the resource_class xparams for future use:
......@@ -369,7 +370,7 @@ sub run_autonomously {
print("\n======= beekeeper loop ** $iteration **==========\n");
$queen->check_for_dead_workers($current_meadow, 0);
$queen->check_for_dead_workers($valley, 0);
$queen->print_analysis_status unless($self->{'no_analysis_stats'});
$queen->print_running_worker_status;
......
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