Skip to content

Commit

Permalink
Minor tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelzwiers committed Jun 24, 2024
1 parent 77718b6 commit 4ad917d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
20 changes: 12 additions & 8 deletions bidscoin/bcoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,18 @@ def drmaa_nativespec(specs: str, session) -> str:
:return: The converted native specifications
"""

jobmanager = session.drmaaImplementation

if 'Slurm' in jobmanager and '-l ' in specs:
specs = (specs.replace('-l ', '')
.replace(',', ' ')
.replace('walltime', '--time')
.replace('mem', '--mem')
.replace('gb','000'))
jobmanager: str = session.drmaaImplementation

if '-l ' in specs and 'torque' not in jobmanager.lower():

if 'slurm' in jobmanager.lower():
specs = (specs.replace('-l ', '')
.replace(',', ' ')
.replace('walltime', '--time')
.replace('mem', '--mem')
.replace('gb','000'))
else:
LOGGER.warning(f"Default native specifications not (yet) provided for {jobmanager}")

return specs.strip()

Expand Down
4 changes: 2 additions & 2 deletions bidscoin/bidsapps/slicereport.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def slicer_append(inputimage: Path, operations: str, outlineimage: Path, mainopt
f"slicer {'mathsimg' if mathsimg else inputimage} {outlineimage if outlineimage.name else ''} {mainopts} {outputopts}\n" \
f"pngappend {sliceroutput} {montage.name}\n" \
f"mv {montage.name} {montage.parent}\n" \
+ (f"rm -r {workdir}" if not DEBUG else '')
+ (f"cd {workdir.parent}; rm -r {workdir}" if not DEBUG else '')

# Run the command on the HPC cluster or directly in the shell
if cluster:
Expand All @@ -129,7 +129,7 @@ def slicer_append(inputimage: Path, operations: str, outlineimage: Path, mainopt
jt.outputPath = f"{os.getenv('HOSTNAME')}:{workdir if DEBUG else tempfile.gettempdir()}/{jt.jobName}.out"
jobid = pbatch.runJob(jt)
pbatch.deleteJobTemplate(jt)
LOGGER.info(f"Your slicereport job has been submitted with ID: {jobid}")
LOGGER.verbose(f"Your slicereport job has been submitted with ID: {jobid}")

else:
LOGGER.bcdebug(f"Command: {command}")
Expand Down

0 comments on commit 4ad917d

Please sign in to comment.