HPC-Runner-Command
view release on metacpan or search on metacpan
lib/HPC/Runner/Command/submit_jobs/Plugin/Dummy.pm view on Meta::CPAN
EOF
print $fh $tt;
return $filename;
},
predicate => 'has_template_file',
clearer => 'clear_template_file',
documentation =>
q{Path to Slurm template file if you do not wish to use the default}
);
=head2 attributes
=cut
has 'sched_counter' => (
traits => ['Counter'],
is => 'ro',
isa => 'Num',
required => 1,
default => 1234,
handles => {
inc_sched_counter => 'inc',
dec_sched_counter => 'dec',
reset_sched_counter => 'reset',
},
);
=head2 Subroutines
=cut
=head3 submit_jobs
This is a dummy for testing - just return a value as a placeholder in job_stats
=cut
sub submit_jobs {
my $self = shift;
my $jobid = $self->sched_counter;
$ENV{DUMMY_JOB_ID} = $jobid;
# my ( $exitcode, $stdout, $stderr ) = $self->submit_to_scheduler("echo \"sbatch ". $self->slurmfile . "\"");
$self->app_log->warn( "SUBMITTING DUMMY JOB "
. $self->slurmfile
. "\n\tWith dummy jobid $jobid" );
$self->inc_sched_counter;
return $jobid;
}
=head3 update_job_deps
Update the job dependencies if using job_array (not batches)
=cut
sub update_job_deps {
my $self = shift;
return unless $self->has_array_deps;
my $array_deps_file = File::Spec->catdir( $self->logdir, 'array_deps.tsv' );
foreach my $current_task ( sort keys %{ $self->array_deps } ) {
my $v = $self->array_deps->{$current_task};
my $dep_tasks = join( ':', @$v );
my $cmd =
"scontrol update job=$current_task Dependency=afterok:$dep_tasks";
# my ( $exitcode, $stdout, $stderr ) = $self->submit_to_scheduler('echo '.$cmd);
write_file(
$array_deps_file,
{ append => 1 },
$current_task . "\t" . $dep_tasks . "\n"
);
}
}
1;
( run in 1.161 second using v1.01-cache-2.11-cpan-a49fcb8fa48 )