blib/lib/HPC/Runner/Command/Plugin/Logger/Sqlite.pm

filter: Statementstmt 70.9% 22 / 31 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 62.5% 5 / 8 Podpod n/a totaltotal 69.2% 27 / 39 SCAR 0.2
CC
1
Cov
71%
__ANON__
2.0
__ANON__
2.0
__ANON__
2.0
CRAP 1.0
« blib/lib/HPC/Runner/Command/submit_jobs/Plugin/Logger/Sqlite.pm ↑ Summary Build »
1 package HPC::Runner::Command::Plugin::Logger::Sqlite;
2  
3 2 our $VERSION = '0.01';
4  
5 2 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 ▶use HPC::Runner::Command::Plugin::Logger::Sqlite::Schema;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use Cwd;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use Log::Log4perl qw(:easy);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 2 with 'HPC::Runner::Command::Plugin::Logger::Sqlite::Deploy';
13  
14 ##Application log
15 has 'app_log' => (
16 is => 'rw',
17 lazy => 1,
18 default => sub {
19 0 ▶ my $self = shift;
Subroutine __ANON__: not called CC=1 SCAR=6.9
20 0 my $log_conf = q(
21 log4perl.category = DEBUG, Screen
22 log4perl.appender.Screen = \
23 Log::Log4perl::Appender::ScreenColoredLevels
24 log4perl.appender.Screen.layout = \
25 Log::Log4perl::Layout::PatternLayout
26 log4perl.appender.Screen.layout.ConversionPattern = \
27 [%d] %m %n
28 );
29  
30 0 Log::Log4perl->init( \$log_conf);
31 0 return get_logger();
32 }
33 2 );
34  
35 =head1 HPC::Runner::Command::Plugin::Logger::Sqlite;
36  
37 Base class for HPC::Runner::Command::submit_jobs::Plugin::Logger::Sqlite and HPC::Runner::Command::execute_job::Plugin::Sqlite
38  
39 =cut
40  
41 =head2 Attributes
42  
43 =cut
44  
45 =head3 schema
46  
47 Sqlite3 Schema Object
48  
49 =cut
50  
51 has 'schema' => (
52 is => 'rw',
53 default => sub {
54 0 ▶ my $self = shift;
Subroutine __ANON__: not called CC=1 SCAR=6.9
55 0 my $schema
56 = HPC::Runner::Command::Plugin::Logger::Sqlite::Schema->connect(
57 'dbi:SQLite:' . $self->db_file );
58 0 return $schema;
59 },
60 2 lazy => 1,
61 );
62  
63 =head3 db_file
64  
65 Path to sqlite3 db file. If the file doesn't exist sqlite3 will create it.
66  
67 =cut
68  
69 has 'db_file' => (
70 is => 'rw',
71 default => sub {
72 0 ▶ my $cwd = getcwd();
Subroutine __ANON__: not called CC=1 SCAR=6.9
73 0 return $cwd . "/hpc-runner-command-plugin-logger-sqlite.db";
74 },
75 2 );
76  
77 =head3 submission_id
78  
79 This is the ID for the entire hpcrunner.pl submit_jobs submission, not the individual scheduler IDs
80  
81 =cut
82  
83 2 has 'submission_id' => (
84 is => 'rw',
85 isa => 'Str|Int',
86 lazy => 1,
87 default => '',
88 predicate => 'has_submission_id',
89 clearer => 'clear_submission_id'
90 );
91  
92 =head2 Subroutines
93  
94 =cut
95  
96 2 1;
97  
98 __END__
99  
100 =encoding utf-8
101  
102 =head1 NAME
103  
104 HPC::Runner::Command::Plugin::Sqlite - Log HPC::Runner workflows to a sqlite DB.
105  
106 =head1 SYNOPSIS
107  
108 To submit jobs to a cluster
109  
110 hpcrunner.pl submit_jobs --hpc_plugins Logger::Sqlite
111  
112 To execute jobs on a single node
113  
114 hpcrunner.pl execute_jobs --job_plugins Logger::Sqlite
115  
116 Generate a summary report
117  
118 hpcrunner.pl stats
119 hpcrunner.pl stats --jobname gatk
120 hpcrunner.pl stats --project Sequencing1
121 hpcrunner.pl stats --project Sequencing1 --jobname gatk_haplotypecaller
122  
123 Generate a longer report
124  
125 hpcrunner.pl stats
126 hpcrunner.pl stats --long/-l --jobname gatk
127 hpcrunner.pl stats --long/-l --project Sequencing1
128 hpcrunner.pl stats --long/-l --project Sequencing1 --jobname gatk_haplotypecaller
129  
130  
131 =head1 DESCRIPTION
132  
133 HPC::Runner::Command::Plugin::Sqlite - Log HPC::Runner workflows to a sqlite DB.
134  
135 This plugin requires sqlite3 in the path.
136  
137 =head1 AUTHOR
138  
139 Jillian Rowe E<lt>jillian.e.rowe@gmail.comE<gt>
140  
141 =head1 COPYRIGHT
142  
143 Copyright 2016- Jillian Rowe
144  
145 =head1 LICENSE
146  
147 This library is free software; you can redistribute it and/or modify
148 it under the same terms as Perl itself.
149  
150 =head1 SEE ALSO
151  
152 =cut
« blib/lib/HPC/Runner/Command/submit_jobs/Plugin/Logger/Sqlite.pm ↑ Summary Build »