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 Event |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Slurm::Sacctmgr::Event; |
7
|
52
|
|
|
52
|
|
21199
|
use strict; |
|
52
|
|
|
|
|
65
|
|
|
52
|
|
|
|
|
1186
|
|
8
|
52
|
|
|
52
|
|
173
|
use warnings; |
|
52
|
|
|
|
|
51
|
|
|
52
|
|
|
|
|
1074
|
|
9
|
52
|
|
|
52
|
|
117
|
use base qw(Slurm::Sacctmgr::EntityBaseListable); |
|
52
|
|
|
|
|
69
|
|
|
52
|
|
|
|
|
18092
|
|
10
|
52
|
|
|
52
|
|
226
|
use Carp qw(carp croak); |
|
52
|
|
|
|
|
69
|
|
|
52
|
|
|
|
|
11212
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
13
|
|
|
|
|
|
|
# Globals |
14
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
17
|
|
|
|
|
|
|
# Accessors |
18
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#Fields common to all slurm versions |
21
|
|
|
|
|
|
|
my @common_accessors = qw( |
22
|
|
|
|
|
|
|
cluster |
23
|
|
|
|
|
|
|
clusternodes |
24
|
|
|
|
|
|
|
duration |
25
|
|
|
|
|
|
|
end |
26
|
|
|
|
|
|
|
event |
27
|
|
|
|
|
|
|
eventraw |
28
|
|
|
|
|
|
|
nodename |
29
|
|
|
|
|
|
|
reason |
30
|
|
|
|
|
|
|
start |
31
|
|
|
|
|
|
|
state |
32
|
|
|
|
|
|
|
stateraw |
33
|
|
|
|
|
|
|
user |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
#Fields from pre-TRES Slurms |
37
|
|
|
|
|
|
|
my @preTRES_accessors = qw( |
38
|
|
|
|
|
|
|
cpus |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
#Fields from post-TRES Slurms |
42
|
|
|
|
|
|
|
my @postTRES_accessors = qw( |
43
|
|
|
|
|
|
|
tres |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
my @all_accessors = ( |
47
|
|
|
|
|
|
|
@common_accessors, |
48
|
|
|
|
|
|
|
@preTRES_accessors, |
49
|
|
|
|
|
|
|
@postTRES_accessors, |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
my @simple_accessors = @common_accessors; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(@simple_accessors); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
#Handle the TRES/nonTRES variants |
57
|
|
|
|
|
|
|
__PACKAGE__->mk_tres_nontres_accessors('tres', 'cpus' => 'cpu' ); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
61
|
|
|
|
|
|
|
# Overloaded methods |
62
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub _rw_fields($) |
65
|
932
|
|
|
932
|
|
914
|
{ my $class = shift; |
66
|
932
|
|
|
|
|
3697
|
return [ @all_accessors ]; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
#Do NOT overload this, should never get used |
70
|
|
|
|
|
|
|
#Events cannot be identified by a singlle field |
71
|
|
|
|
|
|
|
#sub _sacctmgr_name_field($) |
72
|
|
|
|
|
|
|
#{ my $class = shift; |
73
|
|
|
|
|
|
|
# die "This needs work"; |
74
|
|
|
|
|
|
|
# return 'event'; |
75
|
|
|
|
|
|
|
#} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub _sacctmgr_fields_in_order($$) |
78
|
1140
|
|
|
1140
|
|
1153
|
{ my $class = shift; |
79
|
1140
|
|
|
|
|
1104
|
my $sacctmgr = shift; |
80
|
1140
|
|
|
|
|
5885
|
my @fields = @common_accessors; |
81
|
1140
|
100
|
|
|
|
3168
|
if ( $sacctmgr->sacctmgr_cmd_supports('trackable_resources') ) |
82
|
318
|
|
|
|
|
614
|
{ push @fields, @postTRES_accessors; |
83
|
|
|
|
|
|
|
} else |
84
|
822
|
|
|
|
|
1466
|
{ push @fields, @preTRES_accessors; |
85
|
|
|
|
|
|
|
} |
86
|
1140
|
|
|
|
|
4237
|
return [ @fields ]; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub _my_sacctmgr_where_clause($) |
90
|
|
|
|
|
|
|
#Overload to match on enough fields to make the event unique |
91
|
|
|
|
|
|
|
#Not like this will get used, but for completeness (and regression tests) |
92
|
90
|
|
|
90
|
|
111
|
{ my $obj = shift; |
93
|
90
|
50
|
33
|
|
|
467
|
croak "Must be called as an instance method at " |
94
|
|
|
|
|
|
|
unless $obj && ref($obj); |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
#Is this enough to uniquely identify an event? |
97
|
90
|
|
|
|
|
406
|
my @fields = qw(cluster clusternodes end event nodename start state user); |
98
|
90
|
|
|
|
|
87
|
my ($fld, $val, $meth); |
99
|
90
|
|
|
|
|
103
|
my $where = {}; |
100
|
90
|
|
|
|
|
173
|
foreach $fld (@fields) |
101
|
720
|
|
|
|
|
454
|
{ $meth = $fld; |
102
|
720
|
|
|
|
|
1194
|
$val = $obj->$meth; |
103
|
720
|
100
|
|
|
|
3561
|
$val = '' unless defined $val; |
104
|
720
|
|
|
|
|
973
|
$where->{$fld} = $val; |
105
|
|
|
|
|
|
|
} |
106
|
90
|
|
|
|
|
230
|
return $where; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
112
|
|
|
|
|
|
|
# Constructors, etc |
113
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
#All inherited |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
1; |
118
|
|
|
|
|
|
|
__END__ |