Skip to content

Commit

Permalink
Add missing jobids in some pre-job scripts (#1176)
Browse files Browse the repository at this point in the history
Some of the pre-job scripts (`jobs/rocoto/*`) were not defining `job` and `jobid` before calling the j-job.

Also refactors the archive j-jobs to match the new j-job structure.

Fixes #1169
  • Loading branch information
aerorahul committed Dec 15, 2022
1 parent 62b2590 commit f2ecf3a
Show file tree
Hide file tree
Showing 12 changed files with 106 additions and 61 deletions.
61 changes: 36 additions & 25 deletions jobs/JENKFGDAS_ARCHIVE → jobs/JGDAS_ENKF_ARCHIVE
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,12 @@

source "${HOMEgfs}/ush/preamble.sh"

#############################
# Source relevant config files
#############################
export EXPDIR=${EXPDIR:-${HOMEgfs}/parm/config}
configs="base earc"
for config in ${configs}; do
. "${EXPDIR}"/config."${config}"
status=$?
[[ ${status} -ne 0 ]] && exit "${status}"
done

##########################################
# Source machine runtime environment
##########################################
. ${HOMEgfs}/env/${machine}.env earc
status=$?
[[ ${status} -ne 0 ]] && exit "${status}"

##############################################
# Obtain unique process id (pid) and make temp directory
##############################################
export pid=${pid:-$$}
export DATA=${DATA:-${DATAROOT}/${jobid:?}}
export DATA=${DATA:-${DATAROOT}/${jobid}}
mkdir -p "${DATA}"
cd "${DATA}"
cd "${DATA}" || (echo "${DATA} does not exist. ABORT!"; exit 1)


##############################################
Expand All @@ -40,33 +21,63 @@ setpdy.sh
##############################################
# Determine Job Output Name on System
##############################################
export pid=${pid:-$$}
export pgmout="OUTPUT.${pid}"
export pgmerr=errfile


#############################
# Source relevant config files
#############################
export EXPDIR=${EXPDIR:-${HOMEgfs}/parm/config}
configs="base earc"
for config in ${configs}; do
. "${EXPDIR}/config.${config}"
status=$?
[[ ${status} -ne 0 ]] && exit "${status}"
done


##########################################
# Source machine runtime environment
##########################################
. "${HOMEgfs}/env/${machine}.env" earc
status=$?
[[ ${status} -ne 0 ]] && exit "${status}"


##############################################
# Set variables used in the script
##############################################
export CDATE=${CDATE:-${PDY}${cyc}}
export CDUMP=${CDUMP:-${RUN:-"gdas"}}
export COMPONENT="atmos"

###############################################################
# Run archive script
###############################################################

${SCRgfs}/exgdas_enkf_earc.sh
"${SCRgfs}/exgdas_enkf_earc.sh"
status=$?
[[ ${status} -ne 0 ]] && exit "${status}"

###############################################################

echo "ENDED NORMALLY."
##############################################
# End JOB SPECIFIC work
##############################################

##############################################
# Final processing
##############################################
if [[ -e "${pgmout}" ]] ; then
cat "${pgmout}"
fi


##########################################
# Remove the Temporary working directory
##########################################
cd "${DATAROOT}"
cd "${DATAROOT}" || (echo "${DATAROOT} does not exist. ABORT!"; exit 1)
[[ ${KEEPDATA} = "NO" ]] && rm -rf "${DATA}"

exit 0
61 changes: 34 additions & 27 deletions jobs/JGLOBAL_ARCHIVE
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,12 @@

source "${HOMEgfs}/ush/preamble.sh"

export RUN_ENVIR=${RUN_ENVIR:-"nco"}

#############################################
# Source relevant config files
#############################################
export EXPDIR=${EXPDIR:-${HOMEgfs}/parm/config}
configs="base arch"
for config in ${configs}; do
. ${EXPDIR}/config.${config}
status=$?
[[ ${status} -ne 0 ]] && exit "${status}"
done

##########################################
# Source machine runtime environment
##########################################
. "${HOMEgfs}"/env/"${machine}".env arch
status=$?
[[ ${status} -ne 0 ]] && exit "${status}"

##############################################
# Obtain unique process id (pid) and make temp directory
##############################################
export pid=${pid:-$$}
export DATA=${DATA:-${DATAROOT}/${jobid:?}}
export DATA=${DATA:-${DATAROOT}/${jobid}}
mkdir -p "${DATA}"
cd "${DATA}"
cd "${DATA}" || (echo "${DATA} does not exist. ABORT!"; exit 1)


##############################################
Expand All @@ -42,16 +21,36 @@ setpdy.sh
##############################################
# Determine Job Output Name on System
##############################################
export pid=${pid:-$$}
export pgmout="OUTPUT.${pid}"
export pgmerr=errfile

#############################################
# Source relevant config files
#############################################
export EXPDIR=${EXPDIR:-${HOMEgfs}/parm/config}
configs="base arch"
for config in ${configs}; do
. ${EXPDIR}/config.${config}
status=$?
[[ ${status} -ne 0 ]] && exit "${status}"
done


##########################################
# Source machine runtime environment
##########################################
. "${HOMEgfs}/env/${machine}.env" arch
status=$?
[[ ${status} -ne 0 ]] && exit "${status}"


##############################################
# Set variables used in the script
##############################################
export CDATE=${CDATE:-${PDY}${cyc}}
export CDUMP=${CDUMP:-${RUN:-"gfs"}}
export COMPONENT=${COMPONENT:-atmos}


###############################################################
# Run archive script
Expand All @@ -61,14 +60,22 @@ ${GLOBALARCHIVESH:-${SCRgfs}/exglobal_archive.sh}
status=$?
[[ ${status} -ne 0 ]] && exit "${status}"

###############################################################
##############################################
# End JOB SPECIFIC work
##############################################

##############################################
# Final processing
##############################################
if [[ -e "${pgmout}" ]] ; then
cat "${pgmout}"
fi

echo "ENDED NORMALLY."

##########################################
# Remove the Temporary working directory
##########################################
cd "${DATAROOT}"
cd "${DATAROOT}" || (echo "${DATAROOT} does not exist. ABORT!"; exit 1)
[[ ${KEEPDATA} = "NO" ]] && rm -rf "${DATA}"

exit 0
3 changes: 3 additions & 0 deletions jobs/rocoto/aeroanlfinal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ source "$HOMEgfs/ush/preamble.sh"
status=$?
[[ $status -ne 0 ]] && exit $status

export job="aeroanlfinal"
export jobid="${job}.$$"

###############################################################
echo "Do nothing for now"
3 changes: 3 additions & 0 deletions jobs/rocoto/aeroanlinit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ source "$HOMEgfs/ush/preamble.sh"
status=$?
[[ $status -ne 0 ]] && exit $status

export job="aeroanlinit"
export jobid="${job}.$$"

###############################################################
echo "Do nothing for now"
3 changes: 3 additions & 0 deletions jobs/rocoto/aeroanlrun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ source "$HOMEgfs/ush/preamble.sh"
status=$?
[[ $status -ne 0 ]] && exit $status

export job="aeroanlrun"
export jobid="${job}.$$"

###############################################################
echo "Do nothing for now"
3 changes: 3 additions & 0 deletions jobs/rocoto/arch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ source "${HOMEgfs}/ush/preamble.sh"
status=$?
[[ ${status} -ne 0 ]] && exit "${status}"

export job="arch"
export jobid="${job}.$$"

###############################################################
# Execute the JJOB
"${HOMEgfs}"/jobs/JGLOBAL_ARCHIVE
Expand Down
7 changes: 5 additions & 2 deletions jobs/rocoto/earc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ source "${HOMEgfs}/ush/preamble.sh"

###############################################################
# Source FV3GFS workflow modules
. "${HOMEgfs}"/ush/load_fv3gfs_modules.sh
. "${HOMEgfs}/ush/load_fv3gfs_modules.sh"
status=$?
[[ ${status} -ne 0 ]] && exit "${status}"

export job="earc"
export jobid="${job}.$$"

###############################################################
# Execute the JJOB
"${HOMEgfs}"/jobs/JENKFGDAS_ARCHIVE
"${HOMEgfs}/jobs/JGDAS_ENKF_ARCHIVE"
status=$?


Expand Down
3 changes: 3 additions & 0 deletions jobs/rocoto/gldas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ source "$HOMEgfs/ush/preamble.sh"
status=$?
[[ $status -ne 0 ]] && exit $status

export job="gldas"
export jobid="${job}.$$"

###############################################################
# Execute the JJOB. GLDAS only runs once per day.

Expand Down
3 changes: 3 additions & 0 deletions jobs/rocoto/ocnanalpost.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ module purge
module use "${HOMEgfs}/sorc/gdas.cd/modulefiles"
module load GDAS/"${machine,,}"

export job="ocnanalpost"
export jobid="${job}.$$"

###############################################################
# Execute the JJOB
"${HOMEgfs}"/jobs/JGDAS_GLOBAL_OCEAN_ANALYSIS_POST
Expand Down
3 changes: 3 additions & 0 deletions jobs/rocoto/ocnanalprep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ module purge
module use "${HOMEgfs}/sorc/gdas.cd/modulefiles"
module load "GDAS/${machine,,}"

export job="ocnanalprep"
export jobid="${job}.$$"

###############################################################
# Execute the JJOB
"${HOMEgfs}"/jobs/JGDAS_GLOBAL_OCEAN_ANALYSIS_PREP
Expand Down
3 changes: 3 additions & 0 deletions jobs/rocoto/ocnanalrun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ module purge
module use "${HOMEgfs}/sorc/gdas.cd/modulefiles"
module load GDAS/"${machine,,}"

export job="ocnanalrun"
export jobid="${job}.$$"

###############################################################
# Execute the JJOB
"${HOMEgfs}"/jobs/JGDAS_GLOBAL_OCEAN_ANALYSIS_RUN
Expand Down
14 changes: 7 additions & 7 deletions scripts/exgdas_enkf_earc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ source "${HOMEgfs}/ush/preamble.sh"
##############################################
export n=$((10#${ENSGRP}))
export CDUMP_ENKF=$(echo "${EUPD_CYC:-"gdas"}" | tr a-z A-Z)
export ARCH_LIST="${ROTDIR}/enkf${CDUMP}.${PDY}/${cyc}/${COMPONENT}/earc${ENSGRP}"
export ARCH_LIST="${ROTDIR}/enkf${CDUMP}.${PDY}/${cyc}/atmos/earc${ENSGRP}"

# ICS are restarts and always lag INC by $assim_freq hours.
EARCINC_CYC=${ARCH_CYC}
Expand Down Expand Up @@ -122,13 +122,13 @@ if [ "${ENSGRP}" -eq 0 ]; then
[[ ! -d ${ARCDIR} ]] && mkdir -p "${ARCDIR}"
cd "${ARCDIR}"

nb_copy "${ROTDIR}"/enkf"${CDUMP}"."${PDY}"/"${cyc}"/"${COMPONENT}"/"${CDUMP}".t"${cyc}"z.enkfstat enkfstat."${CDUMP}"."${CDATE}"
nb_copy "${ROTDIR}"/enkf"${CDUMP}"."${PDY}"/"${cyc}"/"${COMPONENT}"/"${CDUMP}".t"${cyc}"z.gsistat.ensmean gsistat."${CDUMP}"."${CDATE}".ensmean
nb_copy "${ROTDIR}/enkf${CDUMP}.${PDY}/${cyc}/atmos/${CDUMP}.t${cyc}z.enkfstat" "enkfstat.${CDUMP}.${CDATE}"
nb_copy "${ROTDIR}/enkf${CDUMP}.${PDY}/${cyc}/atmos/${CDUMP}.t${cyc}z.gsistat.ensmean" "gsistat.${CDUMP}.${CDATE}.ensmean"

if [ "${CDUMP_ENKF}" != "GDAS" ]; then
nb_copy "${ROTDIR}"/enkfgfs."${PDY}"/"${cyc}"/"${COMPONENT}"/"${CDUMP}".t"${cyc}"z.enkfstat enkfstat.gfs."${CDATE}"
nb_copy "${ROTDIR}"/enkfgfs."${PDY}"/"${cyc}"/"${COMPONENT}"/"${CDUMP}".t"${cyc}"z.gsistat.ensmean gsistat.gfs."${CDATE}".ensmean
fi
nb_copy "${ROTDIR}/enkfgfs.${PDY}/${cyc}/atmos/${CDUMP}.t${cyc}z.enkfstat" "enkfstat.gfs.${CDATE}"
nb_copy "${ROTDIR}/enkfgfs.${PDY}/${cyc}/atmos/${CDUMP}.t${cyc}z.gsistat.ensmean" "gsistat.gfs.${CDATE}.ensmean"
fi

fi

Expand All @@ -152,7 +152,7 @@ if [ "${ENSGRP}" -eq 0 ]; then
# Loop over GDAS and GFS EnKF directories separately.
clist="gdas gfs"
for ctype in ${clist}; do
COMIN_ENS="${ROTDIR}/enkf${ctype}.${gPDY}/${gcyc}/${COMPONENT}"
COMIN_ENS="${ROTDIR}/enkf${ctype}.${gPDY}/${gcyc}/atmos"
if [ -d "${COMIN_ENS}" ]; then
rocotolog="${EXPDIR}/logs/${GDATE}.log"
if [ -f "${rocotolog}" ]; then
Expand Down

0 comments on commit f2ecf3a

Please sign in to comment.