--ppn processors per node to use
--mem memory to request
--dir Directory to run the script in (default current directory)
+ --account, -A Account name to use
+ --join, -J join error and output streams (default)
--name, -N Name of the job
--debug, -d debugging level (Default 0)
--help, -h display this help
File to read array arguments from. If not provided, and B<--array> is
given, arguments will be read from STDIN.
+=item B<--account, -A>
+
+Account name to use
+
+=item B<--join, J>
+
+Whether to join STDOUT and STDERR. On by default; disable with
+C<--nojoin>.
+
=item B<--debug, -d>
Debug verbosity. (Default 0)
man => 0,
interactive => 0,
array_per_job => 1,
+ join => 1,
);
GetOptions(\%options,
'array_slot_limit|array-slot-limit=i',
'array_all_in_one_job|array-all-in-one-job!',
'ppn|processors-per-node=i',
+ 'account|A=s',
+ 'join|J!',
'mem|memory=s',
+ 'time|walltime=s','cputime|cput=s','host=s',
+ 'pmem|process_mem|process-mem=s',
+ 'pvmem|process_virtual_mem|process-virtiual-mem=s',
+ 'max_file|max-file|file=s',
'dir=s',
'name=s',
'debug|d+','help|h|?','man|m');
}
# pod2usage(join("\n",@USAGE_ERRORS)) if @USAGE_ERRORS;
-print STDERR join("\n",@USAGE_ERRORS) and exit 1 if @USAGE_ERRORS;
+if (@USAGE_ERRORS) {
+ print STDERR map {"$_\n"} @USAGE_ERRORS;
+ exit 1;
+}
# OK. Generate the options to qsub which we'll be using
my @qsub_options = generate_qsub_options(\%options,\@ARGV);
if (defined $options->{ppn}) {
$l[$#l] .= ':ppn='.$options->{ppn};
}
- if ($options->{mem}) {
- push @l,'mem='.$options->{mem};
+ if (defined $options->{account}) {
+ push @qo,'-A',$options->{account};
+ }
+ my %l_options =
+ (mem => 'vmem',
+ time => 'walltime',
+ cputime => 'cput',
+ host => 'host',
+ pmem => 'pmem',
+ pvmem => 'pvmem',
+ max_file => 'file',
+ );
+ for my $k (keys %l_options) {
+ if ($options->{$k}) {
+ push @l,$l_options{$k}.'='.$options{$k};
+ }
}
push @qo,'-l',join(',',@l) if @l;
if ($options->{interactive}) {
if ($options->{name}) {
push @qo,'-N',$options->{name};
} else {
- push @qo,'-N',join('_',@{$args}[0..min($#{$args},2)]);
+ push @qo,'-N',join('_',
+ map {my $a = $_; $a =~ s/[^a-zA-Z0-9]*//g; $a;}
+ @{$args}[0..min($#{$args},2)]);
+ }
+ # join error and output streams
+ if ($options->{join}) {
+ push @qo,'-j','oe';
}
return @qo;
}
my ($opt,$arg,$array) = @_;
my $script = "#!/bin/bash\n";
- my $command = join(' ',map {qq('$_')} @{$arg});
+ my $command = join(' ',map {$_ =~ /\s/?qq('$_'):$_} @{$arg});
$script .= <<EOF;
# this script was written by dqsub
EOF