Commit 460a122d authored by Brandon Walts's avatar Brandon Walts

Merge branch 'version/2.4' into version/2.5

* version/2.4:
  Check that LSF detection works as expected
  bugfix: keep the modified $PATH local to the test, otherwise it will bleed into the other tests
  Make sure this is a real LSF (or openlava) and exclude Slurm clusters that ship "lsid"
  Don't use the enhanced mode as it messes up most analysis names
parents e3d76c6d 5e18e801
......@@ -77,12 +77,16 @@ our $VERSION = '5.2'; # Semantic version of the Meadow interface:
=cut
sub name {
my $mcni = 'My cluster name is';
my $re_lsf_names = qr/(IBM Spectrum LSF|Platform LSF|openlava project)/;
my $re_cluster_name = qr/^My cluster name is\s+(\S+)/;
my @lsid_out = `lsid 2>/dev/null`;
my $is_lsf = 0;
foreach my $lsid_line (@lsid_out) {
if ($lsid_line =~ /^$mcni\s+(\S+)/) {
return $1;
if ($lsid_line =~ $re_lsf_names) {
$is_lsf = 1;
} elsif ($lsid_line =~ $re_cluster_name) {
return $1 if $is_lsf;
}
}
}
......
......@@ -128,13 +128,13 @@ sub main {
my @palette = qw(#E41A1C #377EB8 #4DAF4A #984EA3 #FF7F00 #FFFF33 #A65628 #F781BF #999999 #8DD3C7 #BEBADA #FB8072 #80B1D3 #FDB462 #B3DE69 #FCCDE5 #D9D9D9 #BC80BD #CCEBC5 #FFED6F #2F4F4F);
my %terminal_mapping = (
'emf' => 'emf',
'png' => 'png',
'svg' => 'svg',
'jpg' => 'jpeg',
'gif' => 'gif',
'ps' => 'postscript eps enhanced colour',
'pdf' => 'pdf colour enhanced',
'emf' => 'emf noenhanced',
'png' => 'png noenhanced',
'svg' => 'svg noenhanced',
'jpg' => 'jpeg noenhanced',
'gif' => 'gif noenhanced',
'ps' => 'postscript eps noenhanced colour',
'pdf' => 'pdf colour noenhanced',
);
my $gnuplot_terminal = undef;
if ($output and $output =~ /\.(\w+)$/) {
......
......@@ -15,5 +15,6 @@
# limitations under the License.
echo "Platform LSF"
echo 'My cluster name is test_clUster'
......@@ -21,13 +21,14 @@ use warnings;
use Cwd;
use File::Basename;
use Test::More tests => 23;
use Test::More tests => 25;
use Test::Exception;
use Bio::EnsEMBL::Hive::Utils::Config;
BEGIN {
use_ok( 'Bio::EnsEMBL::Hive::Valley' );
use_ok( 'Bio::EnsEMBL::Hive::Meadow::LSF' );
}
# Need EHIVE_ROOT_DIR to access the default config file
......@@ -39,9 +40,12 @@ throws_ok {
my $valley = Bio::EnsEMBL::Hive::Valley->new($config, 'LSF');
} qr/Meadow 'LSF' does not seem to be available on this machine, please investigate at/, 'No LSF meadow if "lsid" is not present (or does not behave well';
my $ini_path = $ENV{'PATH'};
# WARNING: the data in this script must be in sync with what the fake
# binaries output
local $ENV{'PATH'} = $ENV{'EHIVE_ROOT_DIR'}.'/t/04.meadow/fake_bin:'.$ENV{'PATH'};
{ # begin local $ENV{'PATH'}
$ENV{'PATH'} = $ENV{'EHIVE_ROOT_DIR'}.'/t/04.meadow/fake_bin:'.$ini_path;
my $test_pipeline_name = 'tracking_homo_sapiens_funcgen_81_38_hive';
my $test_meadow_name = 'test_clUster';
......@@ -229,5 +233,25 @@ lives_and( sub {
is_deeply($h, {}, 'No bacct output when accounting disabled');
}, 'Suppressed bacct when AccountingDisabled when checking a date range');
} # end local $ENV{'PATH'}
subtest "Cluster detection", sub {
my $lsf_detection_root_dir = $ENV{'EHIVE_ROOT_DIR'}.'/t/04.meadow/lsf_detection';
opendir( my $dir_fh, $lsf_detection_root_dir) || die "Can't opendir $lsf_detection_root_dir: $!";
foreach my $subdir ( readdir($dir_fh) ) {
next unless -d "$lsf_detection_root_dir/$subdir";
local $ENV{'PATH'} = "$lsf_detection_root_dir/$subdir:$ini_path";
if ($subdir =~ /^ok_(.*)$/) {
my $detected_name = Bio::EnsEMBL::Hive::Meadow::LSF::name();
ok($detected_name, "Detects $subdir");
is($detected_name, $1, "Correct cluster name");
} elsif ($subdir =~ /^no/) {
my $detected_name = Bio::EnsEMBL::Hive::Meadow::LSF::name();
ok(!$detected_name, "Does not detect $subdir");
}
}
closedir($dir_fh);
};
done_testing();
#!/bin/sh
exec cat <<EOF
Slurm 20.02.3, Feb 1 2020
Copyright SchedMD LLC, 2010-2017.
My cluster name is g2
My master name is g2-controller
EOF
#!/bin/sh
# LSF EBI "noah" farm
exec cat <<EOF
IBM Spectrum LSF Standard 10.1.0.6, May 25 2018
Copyright International Business Machines Corp. 1992, 2016.
US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
My cluster name is EBI
My master name is ebi-master-001
EOF
#!/bin/sh
# LSF EBI "yoda" farm
exec cat <<EOF
IBM Spectrum LSF Standard 10.1.0.0, Jul 08 2016
Copyright International Business Machines Corp. 1992, 2016.
US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
My cluster name is YODA
My master name is hh-yoda-02-02.ebi.ac.uk
EOF
#!/bin/sh
# Old LSF version (7.*)
# http://sunray2.mit.edu/kits/platform-lsf/7.0.6/1/guides/kit_lsf_guide_source/admin/cluster_ops.html
exec cat <<EOF
Platform LSF 7 Update 6 May 6 2009
Copyright 1992-2009 Platform Computing Corporation
My cluster name is cluster1
My master name is hostA
EOF
#!/bin/sh
# Old LSF version (9.*)
# https://www.bsc.es/support/LSF/9.1.2/lsf_admin/index.htm?cluster_info_viewing_lsf.html~main
exec cat <<EOF
IBM Platform LSF Standard 9.1.2, May 5 2013
© Copyright IBM Corporation 1992, 2013.
US Governmant Users Restricted Rights - Use, duplication or disclosure restricted
by GSA ADP Schedule Contract with IBM Corp.
My cluster name is lsf91_bw3
My master name is delpe04.lsf.ibm.com
EOF
#!/bin/sh
# openlava
# https://jensd.be/404/linux/install-and-use-the-openlava-job-scheduler-and-openlava-web-gui-on-centos
exec cat <<EOF
openlava project 2.2, Nov 6 2014
My cluster name is openlava
My master name is node01
EOF
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