Skip to content

Commit

Permalink
Cleanup of stale RUNDIRS from an experiment (#2719)
Browse files Browse the repository at this point in the history
This PR:
- removes stale temporary scratch run directories from `$DATAROOT/`
every 3 days.
- should help to scrub failed attempts.
- removes an unused variable `RUNDIR` defined in `config.base`
  • Loading branch information
aerorahul committed Jun 26, 2024
1 parent 8962991 commit 7706760
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
1 change: 0 additions & 1 deletion parm/config/gefs/config.base
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export EXPDIR="@EXPDIR@/${PSLOT}"
export ROTDIR="@COMROOT@/${PSLOT}"

export DATAROOT="${STMP}/RUNDIRS/${PSLOT}" # TODO: set via prod_envir in Ops
export RUNDIR="${DATAROOT}" # TODO: Should be removed; use DATAROOT instead
export ARCDIR="${NOSCRUB}/archive/${PSLOT}"
export ATARDIR="@ATARDIR@"

Expand Down
3 changes: 1 addition & 2 deletions parm/config/gfs/config.base
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ if [[ "${PDY}${cyc}" -ge "2019092100" && "${PDY}${cyc}" -le "2019110700" ]]; the
export DUMP_SUFFIX="p" # Use dumps from NCO GFS v15.3 parallel
fi
export DATAROOT="${STMP}/RUNDIRS/${PSLOT}" # TODO: set via prod_envir in Ops
export RUNDIR="${DATAROOT}" # TODO: Should be removed; use DATAROOT instead
export ARCDIR="${NOSCRUB}/archive/${PSLOT}"
export ATARDIR="@ATARDIR@"

Expand Down Expand Up @@ -295,7 +294,7 @@ export FHOUT_GFS=3 # 3 for ops
export FHMAX_HF_GFS=@FHMAX_HF_GFS@
export FHOUT_HF_GFS=1
export FHOUT_OCN_GFS=6
export FHOUT_ICE_GFS=6
export FHOUT_ICE_GFS=6
export FHMIN_WAV=0
export FHOUT_WAV=3
export FHMAX_HF_WAV=120
Expand Down
18 changes: 17 additions & 1 deletion scripts/exglobal_cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,29 @@

source "${USHgfs}/preamble.sh"

###############################################################
echo "Begin Cleanup ${DATAROOT}!"

# Remove DATAoutput from the forecast model run
# TODO: Handle this better
DATAfcst="${DATAROOT}/${RUN}fcst.${PDY:-}${cyc}"
if [[ -d "${DATAfcst}" ]]; then rm -rf "${DATAfcst}"; fi
#DATAefcs="${DATAROOT}/${RUN}efcs???${PDY:-}${cyc}"
rm -rf "${DATAROOT}/${RUN}efcs"*"${PDY:-}${cyc}"

# Search and delete files/directories from DATAROOT/ older than ${purge_every_days} days
# purge_every_days should be a positive integer
purge_every_days=3

# Find and delete files older than ${purge_every_days} days
find "${DATAROOT}/"* -type f -mtime "+${purge_every_days}" -exec rm -f {} \;

# Find and delete directories older than ${purge_every_days} days
find "${DATAROOT}/"* -type d -mtime "+${purge_every_days}" -exec rm -rf {} \;

echo "Cleanup ${DATAROOT} completed!"
###############################################################

###############################################################
# Clean up previous cycles; various depths
# PRIOR CYCLE: Leave the prior cycle alone
Expand Down Expand Up @@ -67,7 +83,7 @@ for (( current_date=first_date; current_date <= last_date; \
# shellcheck disable=SC2312
if [[ $(tail -n 1 "${rocotolog}") =~ "This cycle is complete: Success" ]]; then
YMD="${current_PDY}" HH="${current_cyc}" declare_from_tmpl \
COMOUT_TOP:COM_TOP_TMPL
COMOUT_TOP:COM_TOP_TMPL
if [[ -d "${COMOUT_TOP}" ]]; then
IFS=", " read -r -a exclude_list <<< "${exclude_string:-}"
remove_files "${COMOUT_TOP}" "${exclude_list[@]:-}"
Expand Down

0 comments on commit 7706760

Please sign in to comment.