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

finally implemented LSF's version of count_running_workers() and a Valley...

finally implemented LSF's version of count_running_workers() and a Valley aggregator for all visible meadows
parent 51c81756
......@@ -55,6 +55,19 @@ sub count_pending_workers_by_rc_name {
}
sub count_running_workers {
my ($self) = @_;
my $jnp = $self->job_name_prefix();
my $cmd = "bjobs -w -J '${jnp}*' -u all 2>/dev/null | grep RUN | wc -l";
my $run_count = qx/$cmd/;
chomp($run_count);
return $run_count;
}
sub status_of_all_our_workers { # returns a hashref
my ($self) = @_;
......
......@@ -700,10 +700,10 @@ sub count_running_workers {
my $sth = $self->prepare($sql);
$sth->execute();
(my $running_workers_count)=$sth->fetchrow_array();
(my $queen_running_workers)=$sth->fetchrow_array();
$sth->finish();
return $running_workers_count || 0;
return $queen_running_workers || 0;
}
......
......@@ -163,10 +163,11 @@ sub get_meadow_capacity_hash_by_meadow_type {
my %meadow_capacity_hash = ();
foreach my $meadow (@{ $self->get_available_meadow_list }) {
my $available_worker_slots = undef;
if( $meadow->can('count_running_workers') and defined($meadow->config_get('TotalRunningWorkersMax'))) {
$available_worker_slots = $meadow->config_get('TotalRunningWorkersMax') - $meadow->count_running_workers;
}
my $available_worker_slots = defined($meadow->config_get('TotalRunningWorkersMax'))
? $meadow->config_get('TotalRunningWorkersMax') - $meadow->count_running_workers
: undef;
# so the hash will contain limiters for every meadow_type, but not all of them active:
$meadow_capacity_hash{ $meadow->type } = Bio::EnsEMBL::Hive::Limiter->new( $available_worker_slots );
}
......@@ -175,5 +176,18 @@ sub get_meadow_capacity_hash_by_meadow_type {
}
sub count_running_workers { # just an aggregator
my $self = shift @_;
my $valley_running_workers = 0;
foreach my $meadow (@{ $self->get_available_meadow_list }) {
$valley_running_workers += $meadow->count_running_workers;
}
return $valley_running_workers;
}
1;
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