<queue>/jobs/<job-id>.job All jobs issued on this queue, including those which
are no longer queued for any machine
+<queue>/history/<hostname>/ Successfully completed jobs (their .job, .stat and .log files)
+ are moved here if the keep_history config switch is set.
+
<queue>/log Log of actions on this queue. Lines look this way:
YYYY-MM-DD HH:MM:SS <host> <job-id> <status> [<msg>]
<status> and <msg> correspond to "Status" and "Message"
- ssh options
- Detector of orphans (unused queue dirs, jobs on non-existent machines, non-queued jobs)
- job failed => give a more explanatory message
+- configurable hostnames of hosts
# A file whose contents should be appended to the job
our $job_epilog = 'epilog';
+# Keep history of successfully completed jobs
+our $keep_history = 1;
+
# Various utility functions
sub parse_machine_list(@);
package BEX::Queue;
use IO::File;
+use File::Path;
use POSIX ();
sub new($;$) {
sub remove($$) {
my ($queue, $machine, $jid) = @_;
- unlink $queue->queue_file($machine, $jid);
- unlink $queue->status_file($machine, $jid);
+ if ($BEX::Config::keep_history) {
+ my $s = $queue->{'Name'} . '/hosts/' . $machine;
+ my $d = $queue->{'Name'} . '/history/' . $machine;
+ File::Path::make_path($d);
+ for my $suff ('job', 'stat', 'log') {
+ my $src = "$s/$jid.$suff";
+ my $dst = "$d/$jid.$suff";
+ if (-f $src) {
+ rename $src, $dst or die "Cannot rename $src to $dst: $!";
+ }
+ }
+ } else {
+ unlink $queue->queue_file($machine, $jid);
+ unlink $queue->status_file($machine, $jid);
+ unlink $queue->log_file($machine, $jid);
+ }
unlink $queue->temp_file($machine, $jid);
- unlink $queue->log_file($machine, $jid);
}
sub job_metadata($$) {