line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HPC::Runner::Command::submit_jobs; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 HPC::Runner::Command::submit_jobs |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Call the hpcrunner.pl submit_jobs command |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
hpcrunner.pl submit_jobs -h |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=cut |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
160203
|
use MooseX::App::Command; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
21
|
|
12
|
1
|
|
|
1
|
|
12646
|
use Moose::Util qw/apply_all_roles/; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
11
|
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
201
|
use File::Spec; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
24
|
|
15
|
1
|
|
|
1
|
|
6
|
use File::Slurp; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
86
|
|
16
|
1
|
|
|
1
|
|
10
|
use DateTime; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
463
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
extends 'HPC::Runner::Command'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
with 'HPC::Runner::Command::submit_jobs::Utils::Plugin'; |
21
|
|
|
|
|
|
|
with 'HPC::Runner::Command::execute_job::Utils::Plugin'; |
22
|
|
|
|
|
|
|
with 'HPC::Runner::Command::Logger::JSON'; |
23
|
|
|
|
|
|
|
with 'HPC::Runner::Command::Utils::Base'; |
24
|
|
|
|
|
|
|
with 'HPC::Runner::Command::Utils::Log'; |
25
|
|
|
|
|
|
|
with 'BioSAILs::Integrations::Github'; |
26
|
|
|
|
|
|
|
with 'BioSAILs::Utils::CacheUtils'; |
27
|
|
|
|
|
|
|
with 'HPC::Runner::Command::submit_jobs::Utils::Scheduler'; |
28
|
|
|
|
|
|
|
with 'HPC::Runner::Command::submit_jobs::Logger::JSON'; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
command_short_description 'Submit jobs to the HPC system'; |
31
|
|
|
|
|
|
|
command_long_description 'This job parses your input file and writes out one or |
32
|
|
|
|
|
|
|
more templates to submit to the scheduler of your choice (SLURM, PBS, etc)'; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head2 Attributes |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head2 Subroutines |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
option 'dry_run' => ( |
41
|
|
|
|
|
|
|
is => 'rw', |
42
|
|
|
|
|
|
|
isa => 'Bool', |
43
|
|
|
|
|
|
|
default => 0, |
44
|
|
|
|
|
|
|
documentation => 'Do a dry run - do not submit to the scheduler.', |
45
|
|
|
|
|
|
|
cmd_aliases => ['dr'], |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub BUILD { |
49
|
|
|
|
|
|
|
my $self = shift; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
if ( $self->dry_run ) { |
52
|
|
|
|
|
|
|
$self->hpc_plugins( ['Dummy'] ); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
$self->gen_load_plugins; |
56
|
|
|
|
|
|
|
$self->hpc_load_plugins; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
if ( $self->use_batches ) { |
59
|
|
|
|
|
|
|
apply_all_roles( $self, |
60
|
|
|
|
|
|
|
'HPC::Runner::Command::submit_jobs::Utils::Scheduler::UseBatches' ); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
else { |
63
|
|
|
|
|
|
|
apply_all_roles( $self, |
64
|
|
|
|
|
|
|
'HPC::Runner::Command::submit_jobs::Utils::Scheduler::UseArrays' ); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub execute { |
69
|
0
|
|
|
0
|
|
|
my $self = shift; |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
$self->write_cache_files; |
72
|
0
|
|
|
|
|
|
$self->git_things; |
73
|
0
|
|
|
|
|
|
$self->app_log->info('Parsing input file'); |
74
|
0
|
|
|
|
|
|
$self->parse_file_slurm; |
75
|
0
|
|
|
|
|
|
$self->create_json_submission; |
76
|
0
|
|
|
|
|
|
$self->app_log->info('Submitting jobs'); |
77
|
0
|
|
|
|
|
|
$self->iterate_schedule; |
78
|
0
|
|
|
|
|
|
$self->update_json_submission; |
79
|
0
|
|
|
|
|
|
$self->app_log->info('Your jobs have been submitted.'); |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
##Rolling this back until a future release |
82
|
0
|
|
|
|
|
|
$self->app_log->info('Experimental! For status updates please run:'); |
83
|
0
|
|
|
|
|
|
$self->app_log->info('hpcrunner.pl stats'); |
84
|
0
|
|
|
|
|
|
$self->app_log->info( |
85
|
|
|
|
|
|
|
'To get status updates for only this submission please run:'); |
86
|
0
|
|
|
|
|
|
$self->app_log->info( 'hpcrunner.pl stats --data_dir ' . $self->data_dir ); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
##TODO Combine this with the BioX cache file functions |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub write_cache_files { |
92
|
0
|
|
|
0
|
|
|
my $self = shift; |
93
|
0
|
|
|
|
|
|
my $cmd_line_opts = $self->print_cmd_line_opts; |
94
|
0
|
|
|
|
|
|
my $config_data = $self->print_config_data; |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
my $dt = DateTime->now( time_zone => 'local' ); |
97
|
0
|
|
|
|
|
|
$dt = "$dt"; |
98
|
0
|
|
|
|
|
|
$dt =~ s/:/-/g; |
99
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
my $cache_base = $self->infile->basename; |
101
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
$self->cache_file( |
103
|
|
|
|
|
|
|
File::Spec->catdir( |
104
|
|
|
|
|
|
|
$self->cache_dir, '.hpcrunner-cache', |
105
|
|
|
|
|
|
|
$cache_base . '--' . $dt . '.cache' |
106
|
|
|
|
|
|
|
) |
107
|
|
|
|
|
|
|
); |
108
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
write_file($self->cache_file, $cmd_line_opts); |
110
|
0
|
|
|
|
|
|
write_file($self->cache_file, {append => 1}, $config_data); |
111
|
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
|
my $data = read_file($self->infile); |
113
|
0
|
|
|
|
|
|
write_file($self->cache_file, {append => 1}, $data); |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
1; |