Commit 394ad647 authored by Leo Gordon's avatar Leo Gordon
Browse files

reuse the meadow->name() method to check for availability [cleanup]

parent 37e63c93
......@@ -8,13 +8,7 @@ use Sys::Hostname;
use base ('Bio::EnsEMBL::Hive::Meadow');
sub available { # always invoked as a class method
return 1; # for the moment assume LOCAL meadow is always available
}
sub name {
sub name { # also called to check for availability; for the moment assume LOCAL meadow is always available
return hostname();
}
......
......@@ -7,15 +7,10 @@ use strict;
use base ('Bio::EnsEMBL::Hive::Meadow');
sub available { # always invoked as a class method
return `which bjobs 2>/dev/null`;
}
sub name {
sub name { # also called to check for availability; assume LSF is available if LSF cluster_name can be established
my $mcni = 'My cluster name is';
if(my $name = `lsid | grep '$mcni'`) {
if(my $name = `lsid 2>/dev/null | grep '$mcni' `) {
$name=~/^$mcni\s+(\w+)/;
return $1;
}
......@@ -39,6 +34,7 @@ sub get_current_worker_process_id {
}
}
sub count_pending_workers_by_rc_id {
my ($self) = @_;
......@@ -56,6 +52,7 @@ sub count_pending_workers_by_rc_id {
return \%pending_by_rc_id;
}
sub status_of_all_our_workers { # returns a hashref
my ($self) = @_;
......@@ -76,6 +73,7 @@ sub status_of_all_our_workers { # returns a hashref
return \%status_hash;
}
sub check_worker_is_alive_and_mine {
my ($self, $worker) = @_;
......@@ -87,6 +85,7 @@ sub check_worker_is_alive_and_mine {
return $is_alive_and_mine;
}
sub kill_worker {
my $worker = pop @_;
......@@ -94,6 +93,7 @@ sub kill_worker {
system($cmd);
}
sub find_out_causes {
my $self = shift @_;
......@@ -118,6 +118,7 @@ sub find_out_causes {
return \%cod;
}
sub submit_workers {
my ($self, $iteration, $worker_cmd, $worker_count, $rc_id, $rc_parameters) = @_;
......
......@@ -43,7 +43,7 @@ sub new {
# make sure modules are loaded and available ones are checked prior to setting the current one
foreach my $meadow_class (@{ find_submodules( $self->meadow_class_path ) }) {
eval "require $meadow_class";
if($meadow_class->available) {
if($meadow_class->name) {
$amch->{$meadow_class->type} = $meadow_class->new();
}
}
......
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