my ($queue, $machine, $job) = @_;
my $qf = $queue->queue_file($machine, $job->id);
if (-f $qf) {
- $queue->log($machine, $job->id, 'REQUEUE');
return 0;
}
my $fn = $queue->job_file($job->id);
my $dir = $queue->host_dir($machine);
-d $dir or mkdir $dir or die "Cannot create directory $dir: $!";
symlink '../../jobs/' . $job->id . '.job', $qf or die "Cannot create $qf: $!";
- $queue->log($machine, $job->id, 'QUEUE');
return 1;
}
my $dst = "$d/$jid.$suff";
if (-f $src) {
rename $src, $dst or die "Cannot rename $src to $dst: $!";
+ } else {
+ # Might be present from the previous incarnation of the same job
+ unlink $dst;
}
}
} else {
rename "$sf.$$", $sf or die "Cannot rename $sf.$$ to $sf: $!";
}
+sub update_job_status($$$$;$) {
+ my ($queue, $machine, $jid, $stat, $msg) = @_;
+ my $s = {
+ 'Time' => time,
+ 'Status' => $stat,
+ 'Message' => $msg,
+ };
+ $queue->write_job_status($machine, $jid, $s);
+ $queue->log($machine, $jid, $stat, $msg);
+}
+
sub lock_name($$$) {
my ($queue, $machine, $jid) = @_;
my $lock = $queue->{'Name'};