Skip to content

Commit

Permalink
Add shebang to fix slurm support
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelzwiers committed Oct 27, 2023
1 parent ee9b932 commit 3a84008
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions bidscoin/bidsapps/skullstrip.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ def skullstrip(bidsdir: str, pattern: str, subjects: list, masked: str, output:
maskimg.parent.mkdir(parents=True, exist_ok=True)
command = f"mri_synthstrip -i {srcimg} -o {outputimg} -m {maskimg} {args}"
if cluster == 'torque':
command = f"qsub -l walltime=0:05:00,mem=8gb -N skullstrip_{subid}_{sesid} << EOF\n{command}\nEOF"
command = f"qsub -l walltime=0:05:00,mem=8gb -N skullstrip_{subid}_{sesid} << EOF\n#!/bin/bash\n{command}\nEOF"
elif cluster == 'slurm':
command = f"sbatch --time=0:05:00 --mem=8G --job-name=skullstrip_{subid}_{sesid} << EOF\n{command}\nEOF"
command = f"sbatch --time=0:05:00 --mem=8G --job-name=skullstrip_{subid}_{sesid} << EOF\n#!/bin/bash\n{command}\nEOF"
elif cluster:
LOGGER.error(f"Invalid cluster manager `{cluster}`")
exit(1)
Expand Down
4 changes: 2 additions & 2 deletions bidscoin/bidsapps/slicereport.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ def slicer_append(inputimage: Path, outlineimage: Path, mainopts: str, outputopt
# Wrap the command
mem = '8' if inputimage.stat().st_size > 50 * 1024**2 else '1' # Ask for more resources if we have a large (e.g. 4D) input image
if cluster == 'torque':
command = f"qsub -l walltime=0:02:00,mem={mem}gb -N slicereport -e {tempfile.gettempdir()} -o {tempfile.gettempdir()} << EOF\n{command}\nEOF"
command = f"qsub -l walltime=0:02:00,mem={mem}gb -N slicereport -e {tempfile.gettempdir()} -o {tempfile.gettempdir()} << EOF\n#!/bin/bash\n{command}\nEOF"
elif cluster == 'slurm':
command = f"sbatch --time=0:02:00 --mem={mem}G --job-name slicereport -o {tempfile.gettempdir()}/slurm-%j.out << EOF\n{command}\nEOF"
command = f"sbatch --time=0:02:00 --mem={mem}G --job-name slicereport -o {tempfile.gettempdir()}/slurm-%j.out << EOF\n#!/bin/bash\n{command}\nEOF"
elif cluster:
LOGGER.error(f"Invalid cluster manager `{cluster}`")
exit(1)
Expand Down

0 comments on commit 3a84008

Please sign in to comment.