line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HPC::Runner::Command::Logger::JSON; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
969
|
use MooseX::App::Role; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
4
|
1
|
|
|
1
|
|
5956
|
use MooseX::Types::Path::Tiny qw/File Path Paths AbsPath AbsFile/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
5
|
1
|
|
|
1
|
|
3038
|
use File::Spec; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
6
|
1
|
|
|
1
|
|
290
|
use Data::UUID; |
|
1
|
|
|
|
|
497
|
|
|
1
|
|
|
|
|
52
|
|
7
|
1
|
|
|
1
|
|
6
|
use DateTime; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
24
|
|
8
|
1
|
|
|
1
|
|
5
|
use File::Path qw(make_path remove_tree); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
9
|
1
|
|
|
1
|
|
296
|
use HPC::Runner::Command::Logger::JSON::Archive; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
396
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
with 'BioSAILs::Utils::Files::CacheDir'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
option 'data_dir' => ( |
14
|
|
|
|
|
|
|
is => 'rw', |
15
|
|
|
|
|
|
|
isa => AbsPath, |
16
|
|
|
|
|
|
|
lazy => 1, |
17
|
|
|
|
|
|
|
coerce => 1, |
18
|
|
|
|
|
|
|
required => 1, |
19
|
|
|
|
|
|
|
documentation => q{Data directory for hpcrunner}, |
20
|
|
|
|
|
|
|
predicate => 'has_data_dir', |
21
|
|
|
|
|
|
|
default => sub { |
22
|
|
|
|
|
|
|
my $self = shift; |
23
|
|
|
|
|
|
|
my $path = $self->create_data_dir; |
24
|
|
|
|
|
|
|
$ENV{HPC_DATA_DIR} = $path; |
25
|
|
|
|
|
|
|
return $path; |
26
|
|
|
|
|
|
|
}, |
27
|
|
|
|
|
|
|
trigger => sub { |
28
|
|
|
|
|
|
|
my $self = shift; |
29
|
|
|
|
|
|
|
make_path( $self->data_dir ); |
30
|
|
|
|
|
|
|
$ENV{HPC_DATA_DIR} = $self->data_dir->stringify; |
31
|
|
|
|
|
|
|
}, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub create_data_dir { |
35
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
36
|
|
|
|
|
|
|
|
37
|
0
|
0
|
|
|
|
|
if ( $self->has_data_dir ) { |
38
|
0
|
|
|
|
|
|
make_path( $self->data_dir); |
39
|
0
|
|
|
|
|
|
return; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
my $data_dir = File::Spec->catdir( $self->cache_dir, '.hpcrunner-data' ); |
43
|
0
|
|
|
|
|
|
my $project = "NULL_PROJECT"; |
44
|
0
|
0
|
|
|
|
|
$project = $self->project if $self->has_project; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
##Create initial document |
47
|
0
|
|
|
|
|
|
my $dt = DateTime->now( time_zone => 'local' ); |
48
|
0
|
|
|
|
|
|
$dt = "$dt"; |
49
|
0
|
|
|
|
|
|
$dt =~ s/:/-/g; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
my $ug = Data::UUID->new; |
52
|
0
|
|
|
|
|
|
my $uuid = $ug->create(); |
53
|
0
|
|
|
|
|
|
$uuid = $ug->to_string($uuid); |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
$self->submission_uuid($uuid); |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
my $path = File::Spec->catdir( $data_dir, $project ); |
58
|
0
|
|
|
|
|
|
make_path($path); |
59
|
|
|
|
|
|
|
|
60
|
0
|
0
|
|
|
|
|
if ( $self->has_project ) { |
61
|
0
|
|
|
|
|
|
$path = |
62
|
|
|
|
|
|
|
File::Spec->catdir( $data_dir, $project, |
63
|
|
|
|
|
|
|
$dt . '__PR_' . $project . '__UID_' . $uuid ); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
else { |
66
|
0
|
|
|
|
|
|
$path = |
67
|
|
|
|
|
|
|
File::Spec->catdir( $data_dir, $project, $dt . '__UID_' . $uuid ); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
return $path; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |