From 880869ee5f01b0a15851af98643c53bd2f17743c Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Mon, 31 Oct 2011 14:13:05 +0100 Subject: [PATCH] Added bjob --- TODO | 1 - bjob | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100755 bjob diff --git a/TODO b/TODO index 7d243ba..b2a374d 100644 --- a/TODO +++ b/TODO @@ -7,4 +7,3 @@ - Detector of orphans (unused queue dirs, jobs on non-existent machines, non-queued jobs) - job failed => give a more explanatory message - write_job_status should be atomic -- bq --show diff --git a/bjob b/bjob new file mode 100755 index 0000000..0d6f468 --- /dev/null +++ b/bjob @@ -0,0 +1,34 @@ +#!/usr/bin/perl +# Batch EXecutor 2.0 -- Operations on a Job +# (c) 2011 Martin Mares + +use strict; +use warnings; +use Getopt::Long; + +use lib 'lib'; +use BEX; + +my $edit; +my $queue_name; + +GetOptions( + "e|edit!" => \$edit, + "q|queue=s" => \$queue_name, +) && @ARGV == 1 or die <] + +Options: +-e, --edit Run editor on the given job (no locking) +-q, --queue= Act on the given queue +AMEN + +my $queue = BEX::Queue->new($queue_name); +my $fn = $queue->job_file($ARGV[0]); +-f $fn or die "No such job " . $ARGV[0] . "\n"; + +if ($edit) { + system "editor", $fn; +} else { + system "cat", $fn; +} -- 2.39.2