]> git.donarmstrong.com Git - uiuc_igb_scripts.git/commitdiff
automatically specify a job name (no more STDIN)
authorDon Armstrong <don@donarmstrong.com>
Wed, 5 Aug 2015 20:15:35 +0000 (13:15 -0700)
committerDon Armstrong <don@donarmstrong.com>
Wed, 5 Aug 2015 20:15:35 +0000 (13:15 -0700)
dqsub

diff --git a/dqsub b/dqsub
index 7fe5f9afd7949fd0d991321c97aec7b36b4b826c..89578d0dd003f0a89c25f836bc9e0e4d29b9b1a3 100755 (executable)
--- a/dqsub
+++ b/dqsub
@@ -31,6 +31,7 @@ dqsub [options]
    --ppn processors per node to use
    --mem memory to request
    --dir Directory to run the script in (default current directory)
+   --name, -N Name of the job
    --debug, -d debugging level (Default 0)
    --help, -h display this help
    --man, -m display manual
@@ -82,6 +83,7 @@ dqsub
 use IO::File;
 use Cwd qw(getcwd abs_path);
 use POSIX qw(ceil);
+use List::Util qw(min);
 use vars qw($DEBUG);
 
 my %options = (nodes           => 1,
@@ -106,6 +108,7 @@ GetOptions(\%options,
            'ppn|processors-per-node=i',
            'mem|memory=s',
            'dir=s',
+           'name=s',
            'debug|d+','help|h|?','man|m');
 
 # pod2usage() if $options{help};
@@ -132,7 +135,7 @@ if ($options{interactive} and @ARGV) {
 print STDERR join("\n",@USAGE_ERRORS) and exit 1 if @USAGE_ERRORS;
 
 # OK. Generate the options to qsub which we'll be using
-my @qsub_options = generate_qsub_options(\%options);
+my @qsub_options = generate_qsub_options(\%options,\@ARGV);
 
 if ($options{interactive}) {
     print STDERR 'running: qsub '.join(' ',@qsub_options) if $DEBUG;
@@ -155,7 +158,7 @@ if ($options{interactive}) {
 }
 
 sub generate_qsub_options{
-    my ($options) = @_;
+    my ($options,$args) = @_;
     my @qo;
     if (defined $options->{queue} and length $options->{queue}) {
         push @qo,'-q',$options->{queue};
@@ -178,6 +181,11 @@ sub generate_qsub_options{
     if ($options->{interactive}) {
         push @qo,'-I';
     }
+    if ($options->{name}) {
+        push @qo,'-N',$options->{name};
+    } else {
+        push @qo,'-N',join('_',@{$args}[0..min($#{$args},2)]);
+    }
     return @qo;
 }