File Coverage

blib/lib/HPC/Runner/Command/Plugin/Logger/Sqlite.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 20 100.0


line stmt bran cond sub pod time code
1             package HPC::Runner::Command::Plugin::Logger::Sqlite;
2              
3             our $VERSION = '0.0.3';
4              
5 3     3   49942 use Moose::Role;
  3         383598  
  3         19  
6              
7 3     3   14794 use HPC::Runner::Command::Plugin::Logger::Sqlite::Schema;
  3         12  
  3         94  
8 3     3   496 use Data::Dumper;
  3         4798  
  3         147  
9 3     3   19 use Cwd;
  3         6  
  3         187  
10 3     3   619 use Log::Log4perl qw(:easy);
  3         33746  
  3         34  
11              
12             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             my $self = shift;
20             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             Log::Log4perl->init( \$log_conf);
31             return get_logger();
32             }
33             );
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             my $self = shift;
55             my $schema
56             = HPC::Runner::Command::Plugin::Logger::Sqlite::Schema->connect(
57             'dbi:SQLite:' . $self->db_file );
58             return $schema;
59             },
60             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             my $cwd = getcwd();
73             return $cwd . "/hpc-runner-command-plugin-logger-sqlite.db";
74             },
75             );
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             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             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