line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package LSF::Hosts; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
31992
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
43
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
33
|
|
5
|
1
|
|
|
1
|
|
6
|
use base qw( LSF ); |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
2015
|
|
6
|
1
|
|
|
1
|
|
1520
|
use IPC::Run qw( run ); |
|
1
|
|
|
|
|
83640
|
|
|
1
|
|
|
|
|
395
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub import |
10
|
|
|
|
|
|
|
{ |
11
|
1
|
|
|
1
|
|
10
|
my ( $self, %p ) = @_; |
12
|
1
|
|
50
|
|
|
7
|
$p{RaiseError} ||= 1; |
13
|
1
|
|
50
|
|
|
5
|
$p{PrintOutput} ||= 1; |
14
|
1
|
|
50
|
|
|
5
|
$p{PrintError} ||= 1; |
15
|
1
|
50
|
|
|
|
82
|
$self->PrintOutput( $p{PrintOutput} ) if exists $p{PrintOutput}; |
16
|
0
|
0
|
|
|
|
0
|
$self->PrintError( $p{PrintError} ) if exists $p{PrintError}; |
17
|
0
|
0
|
|
|
|
0
|
$self->RaiseError( $p{RaiseError} ) if exists $p{RaiseError}; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new |
21
|
|
|
|
|
|
|
{ |
22
|
1
|
|
|
1
|
1
|
809
|
my ( $class, @params ) = @_; |
23
|
1
|
|
|
|
|
234
|
my @output = $class->do_it( 'bhosts', '-l' ); |
24
|
0
|
0
|
|
|
|
|
return unless @output; |
25
|
0
|
|
|
|
|
|
my @hosts; |
26
|
|
|
|
|
|
|
my $host; |
27
|
0
|
|
|
|
|
|
my @keys = qw(STATUS CPUF JL/U MAX NJOBS RUN SSUSP USUSP RSV DISPATCH_WINDOW); |
28
|
0
|
|
|
|
|
|
foreach ( split( /\n/, $output[0] ) ) { |
29
|
0
|
0
|
|
|
|
|
if ( /HOST/ .. /^\s*$/ ) { |
30
|
0
|
|
|
|
|
|
my $hostline = $_; |
31
|
0
|
0
|
|
|
|
|
if (/HOST\s+(\S+)/) { |
32
|
0
|
|
|
|
|
|
$host = {}; |
33
|
0
|
|
|
|
|
|
$host->{HOST_NAME} = $1; |
34
|
|
|
|
|
|
|
} |
35
|
0
|
0
|
0
|
|
|
|
if ( !( /HOST/ || /STATUS/ || /^\s*$/ ) ) { |
|
|
|
0
|
|
|
|
|
36
|
0
|
|
|
|
|
|
my @values = split /\s+/, $hostline; |
37
|
0
|
|
|
|
|
|
for ( 0 .. @keys - 1 ) { $host->{ $keys[$_] } = $values[$_]; } |
|
0
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
bless $host, $class; |
39
|
0
|
|
|
|
|
|
push @hosts, $host; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
0
|
|
|
|
|
|
return @hosts; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__END__ |