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 an Association |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Slurm::Sacctmgr::Association; |
7
|
56
|
|
|
56
|
|
23001
|
use strict; |
|
56
|
|
|
|
|
74
|
|
|
56
|
|
|
|
|
1335
|
|
8
|
56
|
|
|
56
|
|
168
|
use warnings; |
|
56
|
|
|
|
|
85
|
|
|
56
|
|
|
|
|
1149
|
|
9
|
56
|
|
|
56
|
|
130
|
use base qw(Slurm::Sacctmgr::EntityBaseListable); |
|
56
|
|
|
|
|
56
|
|
|
56
|
|
|
|
|
18564
|
|
10
|
56
|
|
|
56
|
|
223
|
use Carp qw(carp croak); |
|
56
|
|
|
|
|
56
|
|
|
56
|
|
|
|
|
15261
|
|
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
|
|
|
|
|
|
|
account |
23
|
|
|
|
|
|
|
cluster |
24
|
|
|
|
|
|
|
defaultqos |
25
|
|
|
|
|
|
|
fairshare |
26
|
|
|
|
|
|
|
grpjobs |
27
|
|
|
|
|
|
|
grpsubmitjobs |
28
|
|
|
|
|
|
|
grpwall |
29
|
|
|
|
|
|
|
id |
30
|
|
|
|
|
|
|
lft |
31
|
|
|
|
|
|
|
maxjobs |
32
|
|
|
|
|
|
|
maxsubmitjobs |
33
|
|
|
|
|
|
|
maxwall |
34
|
|
|
|
|
|
|
parentid |
35
|
|
|
|
|
|
|
parentname |
36
|
|
|
|
|
|
|
partition |
37
|
|
|
|
|
|
|
qos |
38
|
|
|
|
|
|
|
rgt |
39
|
|
|
|
|
|
|
user |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
#Accessors in pre-TRES (< 15.x.y) versions of Slurm |
43
|
|
|
|
|
|
|
my @preTRES_accessors = qw( |
44
|
|
|
|
|
|
|
grpcpumins |
45
|
|
|
|
|
|
|
grpcpurunmins |
46
|
|
|
|
|
|
|
grpcpus |
47
|
|
|
|
|
|
|
grpnodes |
48
|
|
|
|
|
|
|
maxcpumins |
49
|
|
|
|
|
|
|
maxcpus |
50
|
|
|
|
|
|
|
maxnodes |
51
|
|
|
|
|
|
|
); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
#Accessors in post-TRES versions of Slurm |
54
|
|
|
|
|
|
|
my @postTRES_accessors = qw( |
55
|
|
|
|
|
|
|
grptresmins |
56
|
|
|
|
|
|
|
grptresrunmins |
57
|
|
|
|
|
|
|
grptres |
58
|
|
|
|
|
|
|
maxtresmins |
59
|
|
|
|
|
|
|
maxtres |
60
|
|
|
|
|
|
|
maxtrespernode |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
my @all_accessors = ( |
64
|
|
|
|
|
|
|
@common_accessors, |
65
|
|
|
|
|
|
|
@preTRES_accessors, |
66
|
|
|
|
|
|
|
@postTRES_accessors, |
67
|
|
|
|
|
|
|
); |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
my @simple_accessors = ( @common_accessors ); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(@simple_accessors); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
#------------- Special accessors; handle TRES and non-TRES fields |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
__PACKAGE__->mk_tres_nontres_accessors('grptres', 'grpcpus' => 'cpu', 'grpnodes' => 'node' ); |
77
|
|
|
|
|
|
|
__PACKAGE__->mk_tres_nontres_accessors('grptresmins', 'grpcpumins' => 'cpu' ); |
78
|
|
|
|
|
|
|
__PACKAGE__->mk_tres_nontres_accessors('grptresrunmins', 'grpcpurunmins' => 'cpu' ); |
79
|
|
|
|
|
|
|
__PACKAGE__->mk_tres_nontres_accessors('maxtres', 'maxcpus' => 'cpu', 'maxnodes' => 'node' ); |
80
|
|
|
|
|
|
|
__PACKAGE__->mk_tres_nontres_accessors('maxtresmins', 'maxcpumins' => 'cpu' ); |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
84
|
|
|
|
|
|
|
# Overloaded methods |
85
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub _rw_fields($) |
88
|
2694
|
|
|
2694
|
|
2288
|
{ my $class = shift; |
89
|
2694
|
|
|
|
|
11168
|
return [ @all_accessors ]; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
#Do NOT overload this, should never get used. |
93
|
|
|
|
|
|
|
#Associations cannot be specified with one single field |
94
|
|
|
|
|
|
|
#sub _sacctmgr_name_field($) |
95
|
|
|
|
|
|
|
#{ my $class = shift; |
96
|
|
|
|
|
|
|
# return 'account'; |
97
|
|
|
|
|
|
|
#} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub _sacctmgr_fields_in_order($$) |
100
|
1524
|
|
|
1524
|
|
2026
|
{ my $class = shift; |
101
|
1524
|
|
|
|
|
1253
|
my $sacctmgr = shift; |
102
|
1524
|
|
|
|
|
10511
|
my @fields = @common_accessors; |
103
|
1524
|
100
|
|
|
|
4215
|
if ( $sacctmgr->sacctmgr_cmd_supports('trackable_resources') ) |
104
|
422
|
|
|
|
|
980
|
{ push @fields, @postTRES_accessors; |
105
|
|
|
|
|
|
|
} else |
106
|
1102
|
|
|
|
|
2910
|
{ push @fields, @preTRES_accessors; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
1524
|
|
|
|
|
7737
|
return [ @fields ]; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub _my_sacctmgr_where_clause($) |
113
|
|
|
|
|
|
|
#OVerloaded to match on cluster, account, user, and partition |
114
|
|
|
|
|
|
|
#Returns a where clause hash that should return the current entity. |
115
|
152
|
|
|
152
|
|
202
|
{ my $obj = shift; |
116
|
152
|
50
|
33
|
|
|
780
|
croak "Must be called as an instance method at " |
117
|
|
|
|
|
|
|
unless $obj && ref($obj); |
118
|
|
|
|
|
|
|
|
119
|
152
|
|
|
|
|
422
|
my @fields = qw(cluster account user partition); |
120
|
152
|
|
|
|
|
175
|
my ($fld, $val, $meth); |
121
|
152
|
|
|
|
|
192
|
my $where = {}; |
122
|
152
|
|
|
|
|
307
|
foreach $fld (@fields) |
123
|
608
|
|
|
|
|
426
|
{ $meth = $fld; |
124
|
608
|
|
|
|
|
990
|
$val = $obj->$meth; |
125
|
608
|
100
|
|
|
|
3275
|
$val = '' unless defined $val; |
126
|
608
|
|
|
|
|
937
|
$where->{$fld} = $val; |
127
|
|
|
|
|
|
|
} |
128
|
152
|
|
|
|
|
354
|
return $where; |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
132
|
|
|
|
|
|
|
# Constructors, etc |
133
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
#All inherited |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
1; |
138
|
|
|
|
|
|
|
__END__ |