From 4ad917d47720e1ed4a814ef6348b01e7685e0654 Mon Sep 17 00:00:00 2001 From: Marcel Zwiers Date: Mon, 24 Jun 2024 14:50:00 +0200 Subject: [PATCH] Minor tweak --- bidscoin/bcoin.py | 20 ++++++++++++-------- bidscoin/bidsapps/slicereport.py | 4 ++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/bidscoin/bcoin.py b/bidscoin/bcoin.py index b604a4d8..9a6533d9 100755 --- a/bidscoin/bcoin.py +++ b/bidscoin/bcoin.py @@ -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() diff --git a/bidscoin/bidsapps/slicereport.py b/bidscoin/bidsapps/slicereport.py index b33b698b..07fd8f89 100755 --- a/bidscoin/bidsapps/slicereport.py +++ b/bidscoin/bidsapps/slicereport.py @@ -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: @@ -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}")