line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HPC::Runner::Command::submit_jobs::Utils::Plugin; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5214
|
use MooseX::App::Role; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
25
|
|
4
|
1
|
|
|
1
|
|
14125
|
use namespace::autoclean; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
20
|
|
5
|
1
|
|
|
1
|
|
134
|
use List::MoreUtils qw(first_index indexes uniq); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
23
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
with 'MooseX::Object::Pluggable'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head3 hpc_plugins |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Load hpc_plugins. PBS, Slurm, Web, etc. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=cut |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
option 'hpc_plugins' => ( |
16
|
|
|
|
|
|
|
is => 'rw', |
17
|
|
|
|
|
|
|
isa => 'ArrayRef[Str]', |
18
|
|
|
|
|
|
|
documentation => 'Load hpc_plugins', |
19
|
|
|
|
|
|
|
cmd_split => qr/,/, |
20
|
|
|
|
|
|
|
required => 0, |
21
|
|
|
|
|
|
|
default => sub { return ['Slurm'] }, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
option 'hpc_plugins_opts' => ( |
25
|
|
|
|
|
|
|
is => 'rw', |
26
|
|
|
|
|
|
|
isa => 'HashRef', |
27
|
|
|
|
|
|
|
documentation => 'Options for hpc_plugins', |
28
|
|
|
|
|
|
|
required => 0, |
29
|
|
|
|
|
|
|
default => sub { {} }, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head3 hpc_load_plugins |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub hpc_load_plugins { |
37
|
1
|
|
|
1
|
1
|
47
|
my $self = shift; |
38
|
|
|
|
|
|
|
|
39
|
1
|
50
|
|
|
|
64
|
return unless $self->hpc_plugins; |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
|
|
60
|
$self->app_load_plugins( $self->hpc_plugins ); |
42
|
1
|
|
|
|
|
1512
|
$self->parse_plugin_opts( $self->hpc_plugins_opts ); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
after 'hpc_load_plugins' => sub { |
46
|
|
|
|
|
|
|
my $self = shift; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
if ( $self->has_config_files ) { |
49
|
|
|
|
|
|
|
$self->load_configs; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
}; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head3 create_plugin_str |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Make sure to pass plugins to job runner |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub create_plugin_str { |
60
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
my $plugin_str = ""; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
##TODO Update this if we don't have plugin strings |
65
|
0
|
0
|
|
|
|
|
if ( $self->has_job_plugins ) { |
66
|
0
|
|
|
|
|
|
my @uniq = uniq( @{ $self->job_plugins } ); |
|
0
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
$self->job_plugins( \@uniq ); |
68
|
0
|
|
|
|
|
|
$plugin_str .= " \\\n\t"; |
69
|
0
|
|
|
|
|
|
$plugin_str .= "--job_plugins " . join( ",", @{ $self->job_plugins } ); |
|
0
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
0
|
0
|
|
|
|
|
$plugin_str .= " \\\n\t" if $self->job_plugins_opts; |
72
|
0
|
0
|
|
|
|
|
$plugin_str .= |
73
|
|
|
|
|
|
|
$self->unparse_plugin_opts( $self->job_plugins_opts, 'job_plugins' ) |
74
|
|
|
|
|
|
|
if $self->job_plugins_opts; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
0
|
0
|
|
|
|
|
if ( $self->has_plugins ) { |
78
|
0
|
|
|
|
|
|
my @uniq = uniq( @{ $self->job_plugins } ); |
|
0
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
$self->job_plugins( \@uniq ); |
80
|
0
|
|
|
|
|
|
$plugin_str .= " \\\n\t"; |
81
|
0
|
|
|
|
|
|
$plugin_str .= "--plugins " . join( ",", @{ $self->plugins } ); |
|
0
|
|
|
|
|
|
|
82
|
0
|
0
|
|
|
|
|
$plugin_str .= " \\\n\t" if $self->plugins_opts; |
83
|
0
|
0
|
|
|
|
|
$plugin_str .= |
84
|
|
|
|
|
|
|
$self->unparse_plugin_opts( $self->plugins_opts, 'plugins' ) |
85
|
|
|
|
|
|
|
if $self->plugins_opts; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
return $plugin_str; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub unparse_plugin_opts { |
92
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
93
|
0
|
|
|
|
|
|
my $opt_href = shift; |
94
|
0
|
|
|
|
|
|
my $opt_opt = shift; |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
my $opt_str = ""; |
97
|
|
|
|
|
|
|
|
98
|
0
|
0
|
|
|
|
|
return unless $opt_href; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
#Get the opts |
101
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
while ( my ( $k, $v ) = each %{$opt_href} ) { |
|
0
|
|
|
|
|
|
|
103
|
0
|
0
|
|
|
|
|
next unless $k; |
104
|
0
|
0
|
|
|
|
|
$v = "" unless $v; |
105
|
0
|
|
|
|
|
|
$opt_str .= "--$opt_opt" . "_opts " . $k . "=" . $v . " "; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
|
return $opt_str; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
1; |