From 8a7311f56b94ffa87e32474eb2c7944e687d1986 Mon Sep 17 00:00:00 2001 From: Frederic Tessier Date: Fri, 26 Mar 2021 08:01:21 -0400 Subject: [PATCH] Strip non-alphanumeric lead chars in PBS job name Ensure that the PBS job name starts with an alphanumeric character [0-9A-Za-z], following the PBS scheduler requirement. To avoid failed jobs solely on the account of a bad job name, strip all leading non-alphanumeric characters from the job name. Note that the egsinp basename is not affected, this is strictly for the job name passed to qsub via the -N option. --- HEN_HOUSE/scripts/egs-parallel-pbs | 8 ++------ HEN_HOUSE/scripts/egs-parallel-pbsdsh | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/HEN_HOUSE/scripts/egs-parallel-pbs b/HEN_HOUSE/scripts/egs-parallel-pbs index ade847f9c..aff1d4dfd 100755 --- a/HEN_HOUSE/scripts/egs-parallel-pbs +++ b/HEN_HOUSE/scripts/egs-parallel-pbs @@ -118,16 +118,12 @@ verbosity=$8 ### link file descriptor 3 to egs-parallel log file exec 3>>$basename.egsparallel -### set scheduler job name (maximum 14 characters) -jobname=$(echo ${basename}[$nthread]) +### set scheduler job name (skip leading non alnum chars, maximum 14 characters) +jobname=$(echo "${basename}[$nthread]" | sed 's/^[^[:alnum:]]*//') trim=$(( $(echo $jobname | wc -c) - 14 )) if [ $trim -gt 0 ]; then jobname=$(echo $jobname | cut -c $trim-) fi -### job names can't start with a '.', hopefully the next character is OK -if [[ ${jobname::1} == "." ]]; then - jobname="${jobname:1}" -fi log "job name: $jobname" ### remove existing egsjob and lock files diff --git a/HEN_HOUSE/scripts/egs-parallel-pbsdsh b/HEN_HOUSE/scripts/egs-parallel-pbsdsh index d0c0aa7a2..cd4764a50 100755 --- a/HEN_HOUSE/scripts/egs-parallel-pbsdsh +++ b/HEN_HOUSE/scripts/egs-parallel-pbsdsh @@ -108,16 +108,12 @@ exec 3>>$basename.egsparallel ### begin script log "BEGIN $0" -### set scheduler job name (maximum 14 characters) -jobname=$(echo ${basename}[$nthread]) +### set scheduler job name (skip leading non alnum chars, maximum 14 characters) +jobname=$(echo "${basename}[$nthread]" | sed 's/^[^[:alnum:]]*//') trim=$(( $(echo $jobname | wc -c) - 14 )) if [ $trim -gt 0 ]; then jobname=$(echo $jobname | cut -c $trim-) fi -### job names can't start with a '.', hopefully the next character is OK -if [[ ${jobname::1} == "." ]]; then - jobname="${jobname:1}" -fi log "job name: $jobname" ### create pbsdsh directory to store task files for job numbers (remove existing directory)