Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
Avoid breaking command line length limit when there is a large hold_j…
Browse files Browse the repository at this point in the history
…id dependency list
  • Loading branch information
Sam Brightman committed Jan 18, 2017
1 parent 026dafb commit 1c64d66
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
11 changes: 9 additions & 2 deletions inc/qsub
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
#!/usr/bin/env bash

function main() {
function parse_options() {
local i
for ((i = 1; i <= $#; i++)); do
if [[ "${@:$i:1}" == "-N" ]]; then
local name="${*:$i+1:1}"
echo "${*:$i+1:1}"
return
fi
if [[ "${@:$i:1}" == "-@" ]]; then
parse_options $(cat "${*:$i+1:1}")
fi
done
}

function main() {
local name=$(parse_options "$@")
echo "Your job $$ (\"${name}\") has been submitted"

local me=$(basename "$0")
Expand Down
8 changes: 7 additions & 1 deletion lib/HMF/Pipeline/Job.pm
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ sub submit {
my $stdout = catfile($dirs->{log}, "${job_name}.out");
my $stderr = catfile($dirs->{log}, "${job_name}.err");
my $hold_jid = hold_jid($hold_jids);
system "$qsub -o $stdout -e $stderr -N $job_id $hold_jid $bash_file";

my $option_file = File::Temp->new();
open my $fh, ">", $option_file;
say $fh "-o $stdout -e $stderr -N $job_id $hold_jid";
close $fh;
system "$qsub -@ $option_file $bash_file";

return;
}

Expand Down

0 comments on commit 1c64d66

Please sign in to comment.