line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HPC::Runner::Command::submit_jobs::Plugin::Logger::Sqlite; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
7660618
|
use Moose::Role; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
24
|
|
4
|
2
|
|
|
2
|
|
10170
|
use JSON::XS; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
180
|
|
5
|
2
|
|
|
2
|
|
16
|
use Data::Dumper; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
104
|
|
6
|
2
|
|
|
2
|
|
18
|
use DateTime; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
590
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
with 'HPC::Runner::Command::Plugin::Logger::Sqlite'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 HPC::Runner::Command::submit_jobs::Plugin::Logger::Sqlite; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=cut |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head2 Attributes |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head2 Subroutines |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
around 'execute' => sub { |
23
|
|
|
|
|
|
|
my $orig = shift; |
24
|
|
|
|
|
|
|
my $self = shift; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
$self->deploy_schema; |
27
|
|
|
|
|
|
|
my $dt1 = DateTime->now( time_zone => 'local' ); |
28
|
|
|
|
|
|
|
my $ymd = $dt1->ymd(); |
29
|
|
|
|
|
|
|
my $hms = $dt1->hms(); |
30
|
|
|
|
|
|
|
my $start_time = "$ymd $hms"; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my $res = $self->schema->resultset('Submission') |
33
|
|
|
|
|
|
|
->create( { total_processes => 0, total_batches => 0, submission_time => $start_time } ); |
34
|
|
|
|
|
|
|
my $id = $res->submission_pi; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
$self->app_log->info("Saving to sqlite db as submission id : $id"); |
37
|
|
|
|
|
|
|
$self->submission_id($id); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
$self->$orig(@_); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $obj = {}; |
42
|
|
|
|
|
|
|
$obj->{batches} = $self->job_stats->batches; |
43
|
|
|
|
|
|
|
$obj->{jobnames} = $self->job_stats->jobnames; |
44
|
|
|
|
|
|
|
my $json_text = encode_json $obj; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
$res->update( |
47
|
|
|
|
|
|
|
{ |
48
|
|
|
|
|
|
|
submission_meta => $json_text, |
49
|
|
|
|
|
|
|
total_processes => $self->job_stats->total_processes, |
50
|
|
|
|
|
|
|
total_batches => $self->job_stats->total_batches, |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
$res->update({ project => $self->project }) if $self->project; |
55
|
|
|
|
|
|
|
}; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
around 'create_plugin_str' => sub { |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
my $orig = shift; |
60
|
|
|
|
|
|
|
my $self = shift; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
$self->job_plugins( [] ) unless $self->job_plugins; |
63
|
|
|
|
|
|
|
$self->job_plugins_opts( {} ) unless $self->job_plugins_opts; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
push( @{ $self->job_plugins }, 'Logger::Sqlite' ); |
66
|
|
|
|
|
|
|
$self->job_plugins_opts->{submission_id} = $self->submission_id; |
67
|
|
|
|
|
|
|
my $val = $self->$orig(@_); |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
return $val; |
70
|
|
|
|
|
|
|
}; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |