option
'infile'
=> (
is
=>
'rw'
,
required
=> 1,
documentation
=>
q{File of commands separated by newline. The command 'wait' indicates all previous commands should finish before starting the next one.}
,
isa
=> AbsFile,
coerce
=> 1,
cmd_aliases
=> [
'i'
],
);
option
'outdir'
=> (
is
=>
'rw'
,
isa
=> AbsPath,
lazy
=> 1,
coerce
=> 1,
required
=> 1,
default
=> \
&set_outdir
,
documentation
=>
q{Directory to write out files.}
,
trigger
=> \
&_make_the_dirs
,
predicate
=>
'has_outdir'
,
);
option
'procs'
=> (
is
=>
'rw'
,
isa
=>
'Int'
,
default
=> 1,
required
=> 0,
documentation
=>
q{Total number of concurrently running jobs allowed at any time.}
);
option
'poll_time'
=> (
is
=>
'rw'
,
isa
=>
'Num'
,
documentation
=>
'Time in seconds to poll the process for memory profiling.'
,
default
=> 5,
cmd_aliases
=> [
'pt'
],
);
option
'memory_diff'
=> (
is
=>
'rw'
,
isa
=>
'Num'
,
documentation
=>
'Difference from last memory profile in order to record.'
,
default
=> 0.10,
cmd_aliases
=> [
'md'
],
);
has
'cmd'
=> (
traits
=> [
'String'
],
is
=>
'rw'
,
isa
=>
'Str'
,
required
=> 0,
handles
=> {
add_cmd
=>
'append'
,
match_cmd
=>
'match'
,
},
predicate
=>
'has_cmd'
,
clearer
=>
'clear_cmd'
,
);
sub
set_outdir {
my
$self
=
shift
;
if
(
$self
->has_outdir ) {
$self
->_make_the_dirs(
$self
->outdir );
return
;
}
my
$outdir
;
if
(
$self
->has_version &&
$self
->has_git ) {
if
(
$self
->has_project ) {
$outdir
=
File::Spec->catdir(
'hpc-runner'
,
$self
->project,
$self
->version,
'scratch'
);
}
else
{
$outdir
=
File::Spec->catdir(
'hpc-runner'
,
$self
->version,
'scratch'
);
}
}
else
{
if
(
$self
->has_project ) {
$outdir
=
File::Spec->catdir(
'hpc-runner'
,
$self
->project,
'scratch'
);
}
else
{
$outdir
= File::Spec->catdir(
'hpc-runner'
,
'scratch'
);
}
}
$self
->_make_the_dirs(
$outdir
);
return
$outdir
;
}
sub
_make_the_dirs {
my
(
$self
,
$outdir
) =
@_
;
make_path(
$outdir
)
unless
-d
$outdir
;
}
sub
datetime_now {
my
$self
=
shift
;
my
$dt
= DateTime->now(
time_zone
=>
'local'
);
my
$ymd
=
$dt
->ymd();
my
$hms
=
$dt
->hms();
return
(
$dt
,
$ymd
,
$hms
);
}
sub
git_things {
my
$self
=
shift
;
$self
->init_git;
$self
->dirty_run;
$self
->git_info;
return
unless
$self
->has_git;
return
unless
$self
->has_version;
if
(
$self
->tags ) {
push
( @{
$self
->tags },
"$self->{version}"
)
if
$self
->has_version;
}
else
{
$self
->tags( [
$self
->version ] );
}
my
@tmp
= uniq( @{
$self
->tags } );
$self
->tags( \
@tmp
);
}
1;