Skip to content

Commit

Permalink
Fixes a bug in srun_fastsurfer that processed the partition argument …
Browse files Browse the repository at this point in the history
…wrong.

Partition was read, but passed to sbatch as "-p <partition>" instead of as "-p" "<partition>"

srun_fastsurfer.sh
- Fix the variable assignments of slurm_partition
- Use first_non_empty instead of first_non_empty_partition

stools.sh
- Remove the first_non_empty_partition function.
  • Loading branch information
dkuegler committed Sep 27, 2024
1 parent 1c297e8 commit b9e8b0c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 25 deletions.
12 changes: 6 additions & 6 deletions srun_fastsurfer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,8 @@ debug "SLURM options:"
debug "submit jobs and perform operations: $submit_jobs"
debug "perform the cleanup step: $do_cleanup"
debug "seg/surf running on slurm partition:" \
"$(first_non_empty_arg "$partition_seg" "$partition")" "/" \
"$(first_non_empty_arg "$partition_surf" "$partition")"
"$(first_non_empty_arg "$partition_seg" "$partition" "<default partition>")" "/" \
"$(first_non_empty_arg "$partition_surf" "$partition" "<default partition>")"
debug "num_cpus_per_task/max. num_cases_per_task: $num_cpus_per_task/$num_cases_per_task"
debug "segmentation on cpu only: $cpu_only"
debug "Data options:"
Expand Down Expand Up @@ -572,8 +572,8 @@ then
seg_cmd_file=$(mktemp)
fi # END OF NEW

slurm_part_=$(first_non_empty_partition "$partition_seg" "$partition")
if [[ -z "$slurm_part_" ]] ; then slurm_partition=() ; else slurm_partition=("$slurm_part_") ; fi
slurm_part_=$(first_non_empty "$partition_seg" "$partition")
if [[ -z "$slurm_part_" ]] ; then slurm_partition=() ; else slurm_partition=(-p "$slurm_part_") ; fi
{
echo "#!/bin/bash"
echo "module load singularity"
Expand Down Expand Up @@ -669,8 +669,8 @@ then
if [[ "$mem_surf" -gt "$((mem_per_core * cores_per_task))" ]]; then
mem_per_core=$((mem_per_core+1))
fi
slurm_part_=$(first_non_empty_partition "$partition_surf" "$partition")
if [[ -z "$slurm_part_" ]] ; then slurm_partition=() ; else slurm_partition=("$slurm_part_") ; fi
slurm_part_=$(first_non_empty "$partition_surf" "$partition")
if [[ -z "$slurm_part_" ]] ; then slurm_partition=() ; else slurm_partition=(-p "$slurm_part_") ; fi
{
echo "#!/bin/bash"
echo "module load singularity"
Expand Down
21 changes: 2 additions & 19 deletions stools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -388,27 +388,10 @@ function make_copy_job ()
fi
}

function first_non_empty_partition ()
{
for i in "$@"
do
if [[ -n "$i" ]]
then
echo "-p $i"
break
fi
done
}
function first_non_empty_arg ()
{
for i in "$@"
do
if [[ -n "$i" ]]
then
echo "$i"
break
fi
done
# returns the first argument to the function that was not empty
for i in "$@" ; do if [[ -n "$i" ]] ; then echo "$i" ; break ; fi ; done
}
function print_status ()
{
Expand Down

0 comments on commit b9e8b0c

Please sign in to comment.