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 Transaction |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Slurm::Sacctmgr::Transaction; |
7
|
40
|
|
|
40
|
|
16305
|
use strict; |
|
40
|
|
|
|
|
40
|
|
|
40
|
|
|
|
|
1219
|
|
8
|
40
|
|
|
40
|
|
142
|
use warnings; |
|
40
|
|
|
|
|
40
|
|
|
40
|
|
|
|
|
909
|
|
9
|
40
|
|
|
40
|
|
103
|
use base qw(Slurm::Sacctmgr::EntityBaseListable); |
|
40
|
|
|
|
|
40
|
|
|
40
|
|
|
|
|
13405
|
|
10
|
40
|
|
|
40
|
|
151
|
use Carp qw(carp croak); |
|
40
|
|
|
|
|
40
|
|
|
40
|
|
|
|
|
6646
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
13
|
|
|
|
|
|
|
# Globals |
14
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
17
|
|
|
|
|
|
|
# Accessors |
18
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#Fields common to all versions of slurm |
21
|
|
|
|
|
|
|
my @common_accessors = qw( |
22
|
|
|
|
|
|
|
action |
23
|
|
|
|
|
|
|
actor |
24
|
|
|
|
|
|
|
info |
25
|
|
|
|
|
|
|
timestamp |
26
|
|
|
|
|
|
|
where |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my @all_accessors = @common_accessors; |
30
|
|
|
|
|
|
|
my @simple_accessors = @common_accessors; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(@simple_accessors); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
35
|
|
|
|
|
|
|
# Overloaded methods |
36
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub _rw_fields($) |
39
|
928
|
|
|
928
|
|
737
|
{ my $class = shift; |
40
|
928
|
|
|
|
|
2578
|
return [ @all_accessors ]; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
#Do NOT overload this, should never get used |
44
|
|
|
|
|
|
|
#Transactions cannot be specified with a single field |
45
|
|
|
|
|
|
|
#sub _sacctmgr_name_field($) |
46
|
|
|
|
|
|
|
#{ my $class = shift; |
47
|
|
|
|
|
|
|
# die "This needs work"; |
48
|
|
|
|
|
|
|
# return 'transaction'; |
49
|
|
|
|
|
|
|
#} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub _sacctmgr_fields_in_order($$) |
52
|
656
|
|
|
656
|
|
742
|
{ my $class = shift; |
53
|
656
|
|
|
|
|
621
|
my $sacctmgr = shift; |
54
|
656
|
|
|
|
|
2437
|
return [ @common_accessors ]; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub _my_sacctmgr_where_clause($) |
58
|
|
|
|
|
|
|
#Overloaded to match on action, actor, timestamp, info and where |
59
|
|
|
|
|
|
|
#Sort of pointless; as must match everything. |
60
|
90
|
|
|
90
|
|
112
|
{ my $obj = shift; |
61
|
90
|
50
|
33
|
|
|
453
|
croak "Must be called as an instance method at " |
62
|
|
|
|
|
|
|
unless $obj && ref($obj); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
#Do everythin, because I don't think anything else is necessarily unique |
65
|
90
|
|
|
|
|
240
|
my @fields = @all_accessors; |
66
|
90
|
|
|
|
|
206
|
my ($fld, $val, $meth); |
67
|
90
|
|
|
|
|
136
|
my $where = {}; |
68
|
90
|
|
|
|
|
223
|
foreach $fld (@fields) |
69
|
450
|
|
|
|
|
328
|
{ $meth = $fld; |
70
|
450
|
|
|
|
|
710
|
$val = $obj->$meth; |
71
|
450
|
50
|
|
|
|
2215
|
$val = '' unless defined $val; |
72
|
450
|
|
|
|
|
529
|
$where->{$fld} = $val; |
73
|
|
|
|
|
|
|
} |
74
|
90
|
|
|
|
|
394
|
return $where; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
79
|
|
|
|
|
|
|
# Constructors, etc |
80
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
#All inherited |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |
85
|
|
|
|
|
|
|
__END__ |