Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add cleanup script, test on hera.
  • Loading branch information
EdwardSafford-NOAA committed Aug 27, 2024
1 parent 55df627 commit cfe6bff
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 28 deletions.
1 change: 0 additions & 1 deletion driver/runObsMon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ export cyc=`echo ${pdate}|cut -c9-10`
export NET=obsmon
export MODEL=${model}
export YAML_FILE=${yaml_file}
export KEEPDATA="YES"

#--------------------------------
# locate and source config file
Expand Down
5 changes: 0 additions & 5 deletions jobs/JMON_PLOT_OBS
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,3 @@ status=$?
if [[ -e "${pgmout}" ]] ; then
cat "${pgmout}"
fi

####################
# Remove workspace -- this will have to be a separate job that runs
# after the OM_plot job is complete.
####################
2 changes: 2 additions & 0 deletions parm/OM_config
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,5 @@ export OM_LOGS="${ptmp}/logs/OM_logs"
export OM_PLOTS="${ptmp}/OM_plots"
export DATAROOT=${DATAROOT:-${stmp}}
export COMOUT=${COMOUT:-${ptmp}}

export KEEPDATA=${KEEPDATA:-"NO"}
36 changes: 14 additions & 22 deletions scripts/exobsmon_plot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ if compgen -G "${DATA}/OM_PLOT*.yaml" > /dev/null; then
export logfile="${OM_LOGS}/${MODEL}/OM_plot.log"
if [[ -e ${logfile} ]]; then rm ${logfile}; fi

export logfile_clnup="${OM_LOGS}/${MODEL}/OM_cleanup.log"
if [[ -e ${logfile_clnup} ]]; then rm ${logfile_clnup}; fi

cmdfile="OM_jobscript"
>${cmdfile}

Expand All @@ -55,8 +58,16 @@ if compgen -G "${DATA}/OM_PLOT*.yaml" > /dev/null; then
if (( ${ctr} > 0 )); then
case ${MACHINE_ID} in
hera|orion|hercules)
${SUB} --account ${ACCOUNT} -n ${ctr} -o ${logfile} -D . -J ${jobname} --time=1:00:00 \
--mem=80000M --wrap "srun -l --multi-prog ${cmdfile}"
# submit plot job
JOBID1=$(${SUB} --account ${ACCOUNT} -n ${ctr} -o ${logfile} -D . -J ${jobname} --time=1:00:00 \
--mem=80000M --wrap "srun -l --multi-prog ${cmdfile}")

# submit cleanup job to run after plot job
jobname="OM_cleanup"
JOBID1=`echo ${JOBID1} | gawk '{ print $4 }'`
${SUB} --account ${ACCOUNT} -n 1 -o ${logfile_clnup} -D . -J ${jobname} --time=0:10:00 \
-p ${SERVICE_PARTITION} --dependency=afterok:${JOBID1} ${USHobsmon}/om_cleanup.sh

;;

wcoss2)
Expand All @@ -68,27 +79,8 @@ if compgen -G "${DATA}/OM_PLOT*.yaml" > /dev/null; then
CNTRLobsmon=${CNTRLobsmon}, PARMobsmon=${PARMobsmon}, DATA=${DATA}, CARTOPY_DATA_DIR=${CARTOPY_DATA_DIR}, \
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}, cmdfile=${cmdfile}, ncpus=${ctr}, OM_PLOTS=${OM_PLOTS}" \
-l place=vscatter,select=1:ncpus=${ctr}:mem=${mem}gb:prepost=true,walltime=1:00:00 -N ${jobname} ${USHobsmon}/plot_wcoss2.sh

;;
esac
fi
fi

#
# Need a new job to run following the plot job to clean up $DATA
#

#-----------------------------
# Copy output to COMOUTplots
#
# This will now have to be done in a separate
# job set to run after cmdfile completes.
#
#if [[ -d ./line_plots ]]; then
# cp -r line_plots ${COMOUTplots}
#fi
#
#if [[ -d ./map_plots ]]; then
# cp -r map_plots ${COMOUTplots}
#fi


22 changes: 22 additions & 0 deletions ush/om_cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# om_cleanup.sh
#
# 1. Sync image files with $COMOUTplots directory
# 2. Conditionally remove temp working space
#

echo "Begin om_cleanup.sh"; echo

img_dirs=`ls -d ./*_plots/`
for dir in $img_dirs; do
echo "syncing ${DATA}/${dir} and ${COMOUTplots}/${dir}"
rsync -a ${DATA}/${dir} ${COMOUTplots}/${dir}
done

if [ ${KEEPDATA} = NO ] ; then
echo; echo "removing temp working space ${DATAROOT}/${NET}"; echo
rm -rf ${DATAROOT}/${NET}
fi

echo "End om_cleanup.sh"; echo

0 comments on commit cfe6bff

Please sign in to comment.