Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace sleep with wait_for_file #2586

Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
126ec91
Updated GEMPAK version and APRUN launcher.
HenryRWinterbottom Apr 29, 2024
3e8557a
Implementing wait_for_file.
henrywinterbottom-wxdev May 6, 2024
cbea5c5
Addressed reviewer requests.
henrywinterbottom-wxdev May 28, 2024
308708c
Merge branch 'develop' into feature/gwdev_issue_2444.r002
HenryRWinterbottom May 28, 2024
c4b1f15
Corrected conflicts.
henrywinterbottom-wxdev May 28, 2024
5888129
Manual corrections.
henrywinterbottom-wxdev May 28, 2024
58f94ee
Merge branch 'develop' into feature/gwdev_issue_2444.r002
HenryRWinterbottom May 28, 2024
f10df4b
Working through linter complaints.
henrywinterbottom-wxdev May 28, 2024
1f3d521
Fixing linter flags.
henrywinterbottom-wxdev May 28, 2024
30f977c
Debugging from linter.
henrywinterbottom-wxdev May 28, 2024
601da99
Linter corrections.
henrywinterbottom-wxdev May 29, 2024
9589a22
Linter debugging.
henrywinterbottom-wxdev May 29, 2024
c3dcccb
Linter fixes.
henrywinterbottom-wxdev May 29, 2024
1416e46
Linter fixes.
henrywinterbottom-wxdev May 29, 2024
5c7b417
Update ush/wave_tar.sh
HenryRWinterbottom May 29, 2024
063e0f6
Addresses reviewer comment.
henrywinterbottom-wxdev May 29, 2024
e0e4c6b
Update wave_tar.sh
HenryRWinterbottom May 29, 2024
f4f365d
Addresses reviewer comment.
henrywinterbottom-wxdev May 29, 2024
d19a649
Merge branch 'develop' into feature/gwdev_issue_2444.r002
HenryRWinterbottom May 29, 2024
90dfb15
Update exgfs_wave_post_gridded_sbs.sh
HenryRWinterbottom May 29, 2024
c7679b6
Addressed reviewer comment.
henrywinterbottom-wxdev May 30, 2024
9c8b695
Merge branch 'NOAA-EMC:develop' into feature/gwdev_issue_2444.r002
HenryRWinterbottom May 30, 2024
911c8f4
Corrected globbing issue.
HenryRWinterbottom May 31, 2024
ee9c709
Merge branch 'develop' into feature/gwdev_issue_2444.r002
HenryRWinterbottom May 31, 2024
3e42e51
Merge branch 'NOAA-EMC:develop' into feature/gwdev_issue_2444.r002
HenryRWinterbottom Jun 3, 2024
65b3b53
Merge branch 'develop' into feature/gwdev_issue_2444.r002
HenryRWinterbottom Jun 4, 2024
0c41c04
Reverting linter complaint to account for a missing environment varia…
henrywinterbottom-wxdev Jun 4, 2024
088d124
Merge branch 'develop' into feature/gwdev_issue_2444.r002
HenryRWinterbottom Jun 6, 2024
8a113c4
Merge branch 'develop' into feature/gwdev_issue_2444.r002
HenryRWinterbottom Jun 7, 2024
3830494
Merge branch 'NOAA-EMC:develop' into feature/gwdev_issue_2444.r002
HenryRWinterbottom Jun 12, 2024
17e5149
Bug fix related to bash integer expansion.
HenryRWinterbottom Jun 12, 2024
4465617
Merge branch 'develop' into feature/gwdev_issue_2444.r002
HenryRWinterbottom Jun 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion env/HERA.env
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ elif [[ "${step}" = "gempak" ]]; then
export NTHREADS_GEMPAK=${nth_gempak:-1}
[[ ${NTHREADS_GEMPAK} -gt ${nth_max} ]] && export NTHREADS_GEMPAK=${nth_max}


elif [[ "${step}" = "fit2obs" ]]; then

nth_max=$((npe_node_max / npe_node_fit2obs))
Expand Down
21 changes: 7 additions & 14 deletions scripts/exgfs_atmos_awips_20km_1p0deg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,13 @@
###############################################
# Wait for the availability of the pgrb file
###############################################
icnt=1
while (( icnt < 1000 )); do
if [[ -s "${COM_ATMOS_GRIB_0p25}/${RUN}.${cycle}.pgrb2b.0p25.f${fcsthrs}.idx" ]]; then
break
fi

sleep 10
icnt=$((icnt + 1))
if (( icnt >= 180 )); then
msg="FATAL ERROR: No GFS pgrb2 file after 30 min of waiting"
err_exit "${msg}"
exit 5
fi
done
sleep_interval=10
idxfile="${COM_ATMOS_GRIB_0p25}/${RUN}.${cycle}.pgrb2b.0p25.f${fcsthrs}.idx"
if ! -s wait_for_file "${idxfile}" "${sleep_interval}" "180"; then
Fixed Show fixed Hide fixed
msg="FATAL ERROR: No GFS pgrb2 file after waiting"
err_exit "${msg}"
exit 5
fi

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

Expand Down
19 changes: 5 additions & 14 deletions scripts/exgfs_atmos_postsnd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

### Loop for the hour and wait for the sigma and surface flux file:
export FSTART=$STARTHOUR
sleep_interval=10
HenryRWinterbottom marked this conversation as resolved.
Show resolved Hide resolved
#
while [ $FSTART -lt $ENDHOUR ]
do
Expand All @@ -69,20 +70,10 @@
export MAKEBUFR=YES
fi

ic=0
while [ $ic -lt 1000 ]; do
if [[ ! -f "${COM_ATMOS_HISTORY}/${RUN}.${cycle}.atm.logf${FEND}.${logfm}" ]]; then
sleep 10
ic=$(expr $ic + 1)
else
break
fi

if [ $ic -ge 360 ]
then
err_exit "COULD NOT LOCATE logf$FEND file AFTER 1 HOUR"
fi
done
filename="${COM_ATMOS_HISTORY}/${RUN}.${cycle}.atm.logf${FEND}.${logfm}"
if ! -f wait_for_file "${filename}" "${sleep_interval}" "360"; then
Fixed Show fixed Hide fixed
err_exit "COULD NOT LOCATE logf${FEND} file"
HenryRWinterbottom marked this conversation as resolved.
Show resolved Hide resolved
fi

## 1-hourly output before $NEND1, 3-hourly output after
if [ $FEND -gt $NEND1 ]; then
Expand Down
35 changes: 13 additions & 22 deletions scripts/exgfs_wave_nawips.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ pdsext=no
g2tbls=g2varswmo2.tbl
NAGRIB=nagrib2

sleep_interval=20
maxtries=15
fhcnt=${fstart}
while [ ${fhcnt} -le ${FHMAX_WAV} ]; do
Expand Down Expand Up @@ -72,28 +73,18 @@ while [ ${fhcnt} -le ${FHMAX_WAV} ]; do
esac
GRIBIN="${COM_WAVE_GRID}/${RUNwave}.${cycle}.${grdIDin}.f${fhr}.grib2"
GRIBIN_chk=${GRIBIN}.idx

icnt=1
while [ ${icnt} -lt 1000 ]; do
if [ -r ${GRIBIN_chk} ] ; then
break
else
let "icnt=icnt+1"
sleep 20
fi
if [ ${icnt} -ge ${maxtries} ]; then
msg="ABORTING after 5 minutes of waiting for ${GRIBIN}."
echo ' '
echo '**************************** '
echo '*** ERROR : NO GRIB FILE *** '
echo '**************************** '
echo ' '
echo ${msg}
set_trace
echo "${RUNwave} ${grdID} ${fhr} prdgen ${date} ${cycle} : GRIB file missing." >> ${wavelog}
err=1;export err;${errchk} || exit ${err}
fi
done
if ! wait_for_file "${GRIBIN}" "${sleep_interval}" "${maxtries}"; then
HenryRWinterbottom marked this conversation as resolved.
Show resolved Hide resolved
msg="ABORTING waiting for ${GRIBIN}."
echo ' '
echo '**************************** '
echo '*** ERROR : NO GRIB FILE *** '
echo '**************************** '
echo ' '
echo "${msg}"
set_trace
echo "${RUNwave} ${grdID} ${fhr} prdgen ${date} ${cycle} : GRIB file missing." >> "${wavelog}"
err=1;export err;"${errchk}" || exit "${err}"
HenryRWinterbottom marked this conversation as resolved.
Show resolved Hide resolved
fi

#if [ "$grdIDin" = "global.0p25" && "$grid" = "glo_30m" ]; then
if [ "${grdIDin}" = "global.0p25" ]; then
Expand Down
22 changes: 10 additions & 12 deletions scripts/exgfs_wave_post_gridded_sbs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@
fhr=$FHMIN_WAV
fi
fhrg=$fhr
sleep_interval=10
iwaitmax=120 # Maximum loop cycles for waiting until wave component output file is ready (fails after max)
while [ $fhr -le $FHMAX_WAV ]; do

Expand All @@ -252,27 +253,24 @@
export GRIBDATA=${DATA}/output_$YMDHMS
export GRDIDATA=${DATA}/output_$YMDHMS

# Gridded data (main part, need to be run side-by-side with forecast
WalterKolczynski-NOAA marked this conversation as resolved.
Show resolved Hide resolved

if [ $fhr = $fhrg ]
WalterKolczynski-NOAA marked this conversation as resolved.
Show resolved Hide resolved
then
iwait=0
for wavGRD in ${waveGRD} ; do
gfile=${COM_WAVE_HISTORY}/${WAV_MOD_TAG}.out_grd.${wavGRD}.${YMD}.${HMS}
while [ ! -s ${gfile} ]; do sleep 10; let iwait=iwait+1; done
if [ $iwait -eq $iwaitmax ]; then
# Gridded data (main part, need to be run side-by-side with forecast
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment can now be deleted as it was added back above. Thanks again for doing that!

for wavGRD in "${waveGRD}"; do
Fixed Show fixed Hide fixed
gfile="${COM_WAVE_HISTORY}/${WAV_MOD_TAG}.out_grd.${wavGRD}.${YMD}.${HMS}"
if ! wait_for_file "${gfile}" "${sleep_interval}" "${iwaitmax}"; then
echo '*************************************************** '
echo " FATAL ERROR : NO RAW FIELD OUTPUT FILE out_grd.$grdID "
echo " FATAL ERROR : NO RAW FIELD OUTPUT FILE out_grd.${grdID} "
echo '*************************************************** '
echo ' '
set_trace
echo "${WAV_MOD_TAG} post ${grdID} ${PDY} ${cycle} : field output missing."
err=3; export err;${errchk}
exit $err
err=3; export err; "${errchk}"
exit "${err}"
fi
${NLN} ${gfile} ./out_grd.${wavGRD}
${NLN} "${gfile}" "./out_grd.${wavGRD}"
done

if [ "$DOGRI_WAV" = 'YES' ]
then
nigrd=1
Expand Down
36 changes: 13 additions & 23 deletions scripts/exgfs_wave_prdgen_gridded.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,29 +97,19 @@ grids=${grids:-ak_10m at_10m ep_10m wc_10m glo_30m}

GRIBIN="${COM_WAVE_GRID}/${RUNwave}.${cycle}.${grdID}.f${fhr}.grib2"
HenryRWinterbottom marked this conversation as resolved.
Show resolved Hide resolved
GRIBIN_chk=$GRIBIN.idx

icnt=1
while [ $icnt -lt 1000 ]; do
if [ -r $GRIBIN_chk ] ; then
break
else
echo "Waiting for input file: $GRIBIN"
let "icnt=icnt+1"
sleep 5
fi
if [ $icnt -ge $maxtries ]; then
msg="ABNORMAL EXIT: NO GRIB FILE FOR GRID $GRIBIN"
echo ' '
echo '**************************** '
echo '*** ERROR : NO GRIB FILE *** '
echo '**************************** '
echo ' '
echo $msg
set_trace
echo "$RUNwave $grdID ${fhr} prdgen $date $cycle : GRIB file missing." >> $wavelog
err=1;export err;${errchk} || exit ${err}
fi
done
sleep_interval=5
if ! wait_for_file "${GRIBIN}" "${sleep_interval}" "1000"; then
HenryRWinterbottom marked this conversation as resolved.
Show resolved Hide resolved
msg="ABNORMAL EXIT: NO GRIB FILE FOR GRID $GRIBIN"
echo ' '
echo '**************************** '
echo '*** ERROR : NO GRIB FILE *** '
echo '**************************** '
echo ' '
echo $msg
set_trace
HenryRWinterbottom marked this conversation as resolved.
Show resolved Hide resolved
echo "$RUNwave $grdID ${fhr} prdgen $date $cycle : GRIB file missing." >> $wavelog
err=1;export err;${errchk} || exit ${err}
fi

GRIBOUT=$RUNwave.$cycle.$grdID.f${fhr}.clipped.grib2

Expand Down
21 changes: 7 additions & 14 deletions ush/gfs_bufr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,19 @@
/
EOF

sleep_interval=10
for (( hr = 10#${FSTART}; hr <= 10#${FEND}; hr = hr + 10#${FINT} )); do
hh2=$(printf %02i "${hr}")
hh3=$(printf %03i "${hr}")

#---------------------------------------------------------
# Make sure all files are available:
ic=0
while (( ic < 1000 )); do
if [[ ! -f "${COM_ATMOS_HISTORY}/${RUN}.${cycle}.atm.logf${hh3}.${logfm}" ]]; then
sleep 10
ic=$((ic + 1))
else
break
fi

if (( ic >= 360 )); then
echo "FATAL: COULD NOT LOCATE logf${hh3} file AFTER 1 HOUR"
exit 2
fi
done
filename="${COM_ATMOS_HISTORY}/${RUN}.${cycle}.atm.logf${hh3}.${logfm}"
if ! -f wait_for_file "${filename}" "${sleep_interval}" "1000"; then
Fixed Show fixed Hide fixed
echo "FATAL: COULD NOT LOCATE logf${hh3} file"
exit 2
fi

#------------------------------------------------------------------
${NLN} "${COM_ATMOS_HISTORY}/${RUN}.${cycle}.atmf${hh3}.${atmfm}" "sigf${hh2}"
${NLN} "${COM_ATMOS_HISTORY}/${RUN}.${cycle}.sfcf${hh3}.${atmfm}" "flxf${hh2}"
Expand Down
19 changes: 6 additions & 13 deletions ush/gfs_bufr_netcdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
hh1=$(echo "${hh#"${hh%??}"}")
hh=$hh1
fi

sleep_interval=10
while test $hh -le $FEND
do
if test $hh -lt 100
Expand All @@ -75,19 +77,10 @@
hh2=$hh
fi

#---------------------------------------------------------
# Make sure all files are available:
ic=0
while [ $ic -lt 1000 ]
do
if [ ! -f $COMIN/${RUN}.${cycle}.logf${hh2}.txt ]
then
sleep 10
ic=$(expr $ic + 1)
else
break
fi

filename="${COMIN}/${RUN}.${cycle}.logf${hh2}.txt"
if ! -f wait_for_file "${filename}" "${sleep_interval}" "360"; then
Fixed Show fixed Hide fixed
err_exit "COULD NOT LOCATE logf${hh2} file"
fi
if [ $ic -ge 360 ]
then
err_exit "COULD NOT LOCATE logf${hh2} file AFTER 1 HOUR"
Expand Down
25 changes: 16 additions & 9 deletions ush/wave_tar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,27 @@
count=0
countMAX=5
tardone='no'

while [ "$count" -lt "$countMAX" ] && [ "$tardone" = 'no' ]
sleep_interval=10

while [[ "${tardone}" = "no" ]]
do

nf=$(ls | awk '/'$ID.*.$filext'/ {a++} END {print a}')
nbm2=$(( $nb - 2 ))
if [ $nf -ge $nbm2 ]
then
then

filename="${ID}.${cycle}.${type}_tar"
WalterKolczynski-NOAA marked this conversation as resolved.
Show resolved Hide resolved
if ! -f wait_for_file "${filename}" "${sleep_interval}" "${countMAX}"; then
Fixed Show fixed Hide fixed
set +x
echo ' '
echo '***************************************** '
echo '*** FATAL ERROR : TAR CREATION FAILED *** '
echo '***************************************** '
echo ' '
set_trace
HenryRWinterbottom marked this conversation as resolved.
Show resolved Hide resolved
exit 3
fi
tar -cf $ID.$cycle.${type}_tar ./$ID.*.$filext
exit=$?

Expand All @@ -128,12 +141,6 @@
then
tardone='yes'
fi
else
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that a lot of the wave post point jobs are failing in CI. I didn't see the errors but looking again at this code, it looks like the logic here was changed. Perhaps that's the issue?

set +x
echo ' All files not found for tar. Sleeping 10 seconds and trying again ..'
set_trace
sleep 10
count=$(expr $count + 1)
fi

done
Expand Down
1 change: 1 addition & 0 deletions versions/run.hera.ver
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export spack_env=gsi-addon-dev-rocky8
export hpss_ver=hpss
export ncl_ver=6.6.2
export R_ver=3.6.1

export gempak_ver=7.17.0
export perl_ver=5.38.0

Expand Down
Loading