line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/local/bin/perl |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
#Part of Slurm::Sacctmgr: Perl wrapper for Slurm's sacctmgr cmd |
4
|
|
|
|
|
|
|
#Represents a Cluster |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Slurm::Sacctmgr::Cluster; |
7
|
88
|
|
|
88
|
|
38609
|
use strict; |
|
88
|
|
|
|
|
111
|
|
|
88
|
|
|
|
|
2099
|
|
8
|
88
|
|
|
88
|
|
264
|
use warnings; |
|
88
|
|
|
|
|
71
|
|
|
88
|
|
|
|
|
1907
|
|
9
|
88
|
|
|
88
|
|
264
|
use base qw(Slurm::Sacctmgr::EntityBaseRW); |
|
88
|
|
|
|
|
88
|
|
|
88
|
|
|
|
|
31410
|
|
10
|
88
|
|
|
88
|
|
351
|
use Carp qw(carp croak); |
|
88
|
|
|
|
|
135
|
|
|
88
|
|
|
|
|
58085
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
13
|
|
|
|
|
|
|
# Globals |
14
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
17
|
|
|
|
|
|
|
# Accessors |
18
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#Accessors common to all versions of slurm |
21
|
|
|
|
|
|
|
my @common_accessors = qw( |
22
|
|
|
|
|
|
|
classification |
23
|
|
|
|
|
|
|
cluster |
24
|
|
|
|
|
|
|
controlhost |
25
|
|
|
|
|
|
|
controlport |
26
|
|
|
|
|
|
|
flags |
27
|
|
|
|
|
|
|
nodenames |
28
|
|
|
|
|
|
|
pluginidselect |
29
|
|
|
|
|
|
|
rpc |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
#Accessors in pre-TRES (< 15.x.y ) versions of slurm |
33
|
|
|
|
|
|
|
my @preTRES_accessors = qw( |
34
|
|
|
|
|
|
|
cpucount |
35
|
|
|
|
|
|
|
nodecount |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
#Accessors in post-TRES ( 15.x.y or higher ) versions of slurm |
39
|
|
|
|
|
|
|
my @postTRES_accessors = qw( |
40
|
|
|
|
|
|
|
tres |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my @all_accessors = ( |
44
|
|
|
|
|
|
|
@common_accessors, |
45
|
|
|
|
|
|
|
@preTRES_accessors, |
46
|
|
|
|
|
|
|
@postTRES_accessors, |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my @simple_accessors = ( @common_accessors ); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(@simple_accessors); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
#Special accessors: handle TRES and non-TRES fields |
54
|
|
|
|
|
|
|
__PACKAGE__->mk_tres_nontres_accessors('tres', |
55
|
|
|
|
|
|
|
'cpucount' => 'cpu', |
56
|
|
|
|
|
|
|
'nodecount' => 'node', |
57
|
|
|
|
|
|
|
); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
60
|
|
|
|
|
|
|
# Overloaded methods |
61
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub _rw_fields($) |
64
|
2246
|
|
|
2246
|
|
2349
|
{ my $class = shift; |
65
|
2246
|
|
|
|
|
10128
|
return [ @all_accessors ]; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub _sacctmgr_name_field($) |
69
|
1420
|
|
|
1420
|
|
2462
|
{ my $class = shift; |
70
|
1420
|
|
|
|
|
3967
|
return 'cluster'; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub _sacctmgr_fields($) |
74
|
|
|
|
|
|
|
#All fields, all versions of slurm |
75
|
294
|
|
|
294
|
|
335
|
{ my $class = shift; |
76
|
294
|
|
|
|
|
1026
|
my $fields = [ @common_accessors, |
77
|
|
|
|
|
|
|
@preTRES_accessors, |
78
|
|
|
|
|
|
|
@postTRES_accessors, |
79
|
|
|
|
|
|
|
]; |
80
|
294
|
|
|
|
|
512
|
return $fields; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub _sacctmgr_fields_in_order($$) |
84
|
1704
|
|
|
1704
|
|
2638
|
{ my $class = shift; |
85
|
1704
|
|
|
|
|
1895
|
my $sacctmgr = shift; |
86
|
1704
|
|
|
|
|
8655
|
my @fields = @common_accessors; |
87
|
1704
|
100
|
|
|
|
5612
|
if ( $sacctmgr->sacctmgr_cmd_supports('trackable_resources') ) |
88
|
423
|
|
|
|
|
1116
|
{ push @fields, @postTRES_accessors; |
89
|
|
|
|
|
|
|
} else |
90
|
1281
|
|
|
|
|
3305
|
{ push @fields, @preTRES_accessors; |
91
|
|
|
|
|
|
|
} |
92
|
1704
|
|
|
|
|
7128
|
return [ @fields ]; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub _sacctmgr_fields_addable($$) |
96
|
472
|
|
|
472
|
|
829
|
{ my $class = shift; |
97
|
472
|
|
|
|
|
726
|
my $sacctmgr = shift; |
98
|
472
|
|
|
|
|
1836
|
my @fields = @common_accessors; |
99
|
472
|
100
|
|
|
|
1412
|
if ( $sacctmgr->sacctmgr_cmd_supports('trackable_resources') ) |
100
|
92
|
|
|
|
|
406
|
{ push @fields, @postTRES_accessors; |
101
|
|
|
|
|
|
|
} else |
102
|
380
|
|
|
|
|
969
|
{ push @fields, @preTRES_accessors; |
103
|
|
|
|
|
|
|
} |
104
|
472
|
|
|
|
|
2011
|
return [ @fields ]; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub _sacctmgr_fields_updatable($$) |
109
|
282
|
|
|
282
|
|
370
|
{ my $class = shift; |
110
|
282
|
|
|
|
|
338
|
my $sacctmgr = shift; |
111
|
282
|
|
|
|
|
615
|
return $class->_sacctmgr_fields_addable($sacctmgr); |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
117
|
|
|
|
|
|
|
# Constructors, etc |
118
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
#All inherited |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
1; |
123
|
|
|
|
|
|
|
__END__ |