| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package HPC::Runner::Command::stats::Logger::JSON::Summary; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
573
|
use Moose::Role; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
8
|
|
|
4
|
1
|
|
|
1
|
|
4750
|
use namespace::autoclean; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
68
|
use JSON; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
8
|
|
|
7
|
1
|
|
|
1
|
|
109
|
use Try::Tiny; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
54
|
|
|
8
|
1
|
|
|
1
|
|
7
|
use File::Slurp; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
622
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
##This is probably mostly the same across plugins |
|
11
|
|
|
|
|
|
|
sub iter_tasks_summary { |
|
12
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
13
|
0
|
|
|
|
|
|
my $submission_id = shift; |
|
14
|
0
|
|
|
|
|
|
my $jobname = shift; |
|
15
|
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
my $running = $self->count_running_tasks( $submission_id, $jobname ); |
|
17
|
0
|
|
|
|
|
|
my $success = $self->count_successful_tasks( $submission_id, $jobname ); |
|
18
|
0
|
|
|
|
|
|
my $fail = $self->count_failed_tasks( $submission_id, $jobname ); |
|
19
|
0
|
|
|
|
|
|
my $complete = $success + $fail; |
|
20
|
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
$self->task_data->{$jobname} = { |
|
22
|
|
|
|
|
|
|
complete => $complete, |
|
23
|
|
|
|
|
|
|
success => $success, |
|
24
|
|
|
|
|
|
|
fail => $fail, |
|
25
|
|
|
|
|
|
|
running => $running |
|
26
|
|
|
|
|
|
|
}; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub count_running_tasks { |
|
30
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
31
|
0
|
|
|
|
|
|
my $submission_id = shift; |
|
32
|
0
|
|
|
|
|
|
my $jobname = shift; |
|
33
|
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
my $running_file = |
|
35
|
|
|
|
|
|
|
File::Spec->catdir( $self->data_dir, $jobname, 'running.json' ); |
|
36
|
|
|
|
|
|
|
|
|
37
|
0
|
0
|
|
|
|
|
if ( -e $running_file ) { |
|
38
|
0
|
|
|
|
|
|
my $running_json = read_file($running_file); |
|
39
|
|
|
|
|
|
|
##TODO Add in some error checking |
|
40
|
0
|
|
|
|
|
|
my $running; |
|
41
|
|
|
|
|
|
|
try { |
|
42
|
0
|
|
|
0
|
|
|
$running = decode_json($running_json); |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
catch { |
|
45
|
0
|
|
|
0
|
|
|
$running = {}; |
|
46
|
0
|
|
|
|
|
|
}; |
|
47
|
0
|
|
|
|
|
|
my @keys = keys %{$running}; |
|
|
0
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
return scalar @keys; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
else { |
|
51
|
0
|
|
|
|
|
|
return 0; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub get_running_tasks { |
|
56
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
57
|
0
|
|
|
|
|
|
my $submission_id = shift; |
|
58
|
0
|
|
|
|
|
|
my $jobname = shift; |
|
59
|
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
my $running_file = |
|
61
|
|
|
|
|
|
|
File::Spec->catdir( $self->data_dir, $jobname, 'running.json' ); |
|
62
|
|
|
|
|
|
|
|
|
63
|
0
|
0
|
|
|
|
|
if ( -e $running_file ) { |
|
64
|
0
|
|
|
|
|
|
my $running_json = read_file($running_file); |
|
65
|
|
|
|
|
|
|
##TODO Add in some error checking |
|
66
|
0
|
|
|
|
|
|
my $running = decode_json($running_json); |
|
67
|
0
|
|
|
|
|
|
return $running; |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
else { |
|
70
|
0
|
|
|
|
|
|
return {}; |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub get_completed_tasks { |
|
76
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
77
|
0
|
|
|
|
|
|
my $submission_id = shift; |
|
78
|
0
|
|
|
|
|
|
my $jobname = shift; |
|
79
|
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
my $complete_file = |
|
81
|
|
|
|
|
|
|
File::Spec->catdir( $self->data_dir, $jobname, 'complete.json' ); |
|
82
|
|
|
|
|
|
|
|
|
83
|
0
|
0
|
|
|
|
|
if ( -e $complete_file ) { |
|
84
|
0
|
|
|
|
|
|
my $complete_json = read_file($complete_file); |
|
85
|
|
|
|
|
|
|
##TODO Add in some error checking |
|
86
|
0
|
|
|
|
|
|
my $complete = decode_json($complete_json); |
|
87
|
0
|
|
|
|
|
|
return $complete; |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
else { |
|
90
|
0
|
|
|
|
|
|
return {}; |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub count_successful_tasks { |
|
96
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
97
|
0
|
|
|
|
|
|
my $submission_id = shift; |
|
98
|
0
|
|
|
|
|
|
my $jobname = shift; |
|
99
|
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
return $self->search_complete( $jobname, 1 ); |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub count_failed_tasks { |
|
104
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
105
|
0
|
|
|
|
|
|
my $submission_id = shift; |
|
106
|
0
|
|
|
|
|
|
my $jobname = shift; |
|
107
|
|
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
|
return $self->search_complete( $jobname, 0 ); |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head3 search_complete |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
See which jobs completed successfully |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub search_complete { |
|
118
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
119
|
0
|
|
|
|
|
|
my $jobname = shift; |
|
120
|
0
|
|
|
|
|
|
my $success = shift; |
|
121
|
|
|
|
|
|
|
|
|
122
|
0
|
|
|
|
|
|
my $complete_file = |
|
123
|
|
|
|
|
|
|
File::Spec->catdir( $self->data_dir, $jobname, 'complete.json' ); |
|
124
|
|
|
|
|
|
|
|
|
125
|
0
|
0
|
|
|
|
|
if ( -e $complete_file ) { |
|
126
|
0
|
|
|
|
|
|
my $complete_json = read_file($complete_file); |
|
127
|
0
|
|
|
|
|
|
my $complete; |
|
128
|
|
|
|
|
|
|
try { |
|
129
|
0
|
|
|
0
|
|
|
$complete = decode_json($complete_json); |
|
130
|
|
|
|
|
|
|
} |
|
131
|
|
|
|
|
|
|
catch { |
|
132
|
0
|
|
|
0
|
|
|
$complete = {}; |
|
133
|
0
|
|
|
|
|
|
}; |
|
134
|
|
|
|
|
|
|
##TODO Add in some error checking |
|
135
|
0
|
|
|
|
|
|
return $self->look_for_exit_code( $complete, $success ); |
|
136
|
|
|
|
|
|
|
} |
|
137
|
|
|
|
|
|
|
else { |
|
138
|
0
|
|
|
|
|
|
return 0; |
|
139
|
|
|
|
|
|
|
} |
|
140
|
|
|
|
|
|
|
} |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub look_for_exit_code { |
|
143
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
144
|
0
|
|
|
|
|
|
my $complete = shift; |
|
145
|
0
|
|
|
|
|
|
my $success = shift; |
|
146
|
|
|
|
|
|
|
|
|
147
|
0
|
|
|
|
|
|
my $task_count = 0; |
|
148
|
0
|
|
|
|
|
|
foreach my $task ( keys %{$complete} ) { |
|
|
0
|
|
|
|
|
|
|
|
149
|
0
|
|
|
|
|
|
my $task_data = $complete->{$task}; |
|
150
|
|
|
|
|
|
|
|
|
151
|
0
|
0
|
0
|
|
|
|
if ( $success && $task_data->{exit_code} == 0 ) { |
|
|
|
0
|
0
|
|
|
|
|
|
152
|
0
|
|
|
|
|
|
$task_count++; |
|
153
|
|
|
|
|
|
|
} |
|
154
|
|
|
|
|
|
|
elsif ( !$success && $task_data->{exit_code} != 0 ) { |
|
155
|
0
|
|
|
|
|
|
$task_count++; |
|
156
|
|
|
|
|
|
|
} |
|
157
|
|
|
|
|
|
|
} |
|
158
|
|
|
|
|
|
|
|
|
159
|
0
|
|
|
|
|
|
return $task_count; |
|
160
|
|
|
|
|
|
|
} |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
1; |