Skip to content

Commit db8bcf7

Browse files
committed
Merge pull request #414 from BRAINSia/bug/FixSGEGraph
ENH: Respect user supplied -o -e flags in qsub_args
2 parents b34ebc0 + 10bc559 commit db8bcf7

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

nipype/pipeline/plugins/sgegraph.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,22 @@ def _submit_graph(self, pyfiles, dependencies):
6565
if 'job' in values:
6666
values = values.rstrip(',')
6767
deps = '-hold_jid%s' % values
68-
fp.writelines('job%05d=`qsub -o %s -e %s' +
69-
' %s %s -N job%05d %s`\n' % (
70-
idx,
71-
batchscriptoutfile,
72-
batchscripterrfile,
73-
self._qsub_args, deps,
74-
idx,
75-
batchscriptfile))
68+
jobname = 'job%05d' % ( idx )
69+
## Do not use default output locations if they are set in self._qsub_args
70+
stderrFile = ''
71+
if self._qsub_args.count('-e ') == 0:
72+
stderrFile='-e {errFile}'.format(errFile=batchscripterrfile)
73+
stdoutFile = ''
74+
if self._qsub_args.count('-o ') == 0:
75+
stdoutFile='-o {outFile}'.format(outFile=batchscriptoutfile)
76+
full_line = '{jobNm}=$(qsub {outFileOption} {errFileOption} {extraQSubArgs} {dependantIndex} -N {jobNm} {batchscript})\n'.format(
77+
jobNm=jobname,
78+
outFileOption=stdoutFile,
79+
errFileOption=stderrFile,
80+
extraQSubArgs=self._qsub_args,
81+
dependantIndex=deps,
82+
batchscript=batchscriptfile)
83+
fp.writelines( full_line )
7684

7785
cmd = CommandLine('bash', environ=os.environ.data)
7886
cmd.inputs.args = '%s' % submitjobsfile

0 commit comments

Comments
 (0)