Skip to content

Commit

Permalink
Strip non-alphanumeric lead chars in PBS job name
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ftessier committed Mar 26, 2021
1 parent 8df4716 commit 8a7311f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
8 changes: 2 additions & 6 deletions HEN_HOUSE/scripts/egs-parallel-pbs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 2 additions & 6 deletions HEN_HOUSE/scripts/egs-parallel-pbsdsh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8a7311f

Please sign in to comment.