Skip to content

Commit b7879d7

Browse files
d-vogeleffigies
andauthored
ENH: Skip newline before Python call in batch submission to facilitate containerized runs (#3297)
* Avoid empty line in bash script output Remove the newline at the end of template to avoid having am empty line after joining with the node command. This allows to have the node command integrated in more complex call, such as a `singularity exec ...` call. * Rather remove the newlines than trim the last char of the template. As per @effigies suggestion. Co-authored-by: Chris Markiewicz <[email protected]> Co-authored-by: Christopher J. Markiewicz <[email protected]> Co-authored-by: Chris Markiewicz <[email protected]>
1 parent 28d76cf commit b7879d7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

nipype/pipeline/plugins/base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,9 @@ def _submit_job(self, node, updatehash=False):
543543
pyscript = create_pyscript(node, updatehash=updatehash)
544544
batch_dir, name = os.path.split(pyscript)
545545
name = ".".join(name.split(".")[:-1])
546-
batchscript = "\n".join((self._template, "%s %s" % (sys.executable, pyscript)))
546+
batchscript = "\n".join(
547+
(self._template.rstrip("\n"), "%s %s" % (sys.executable, pyscript))
548+
)
547549
batchscriptfile = os.path.join(batch_dir, "batchscript_%s.sh" % name)
548550
with open(batchscriptfile, "wt") as fp:
549551
fp.writelines(batchscript)

0 commit comments

Comments
 (0)