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

Splits AWIPS jobs into seperate tasks #2094

Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
10859c2
Corrected missing local variable reference.
henrywinterbottom-wxdev Nov 2, 2023
9df2539
Reverting push to develop.
henrywinterbottom-wxdev Nov 2, 2023
2a560e3
Merge branch 'develop' of https://github.com/HenryWinterbottom-NOAA/g…
henrywinterbottom-wxdev Nov 5, 2023
e26aff3
Merge branch 'develop' of https://github.com/HenryWinterbottom-NOAA/g…
henrywinterbottom-wxdev Nov 9, 2023
3ab096a
Merge branch 'develop' of https://github.com/HenryWinterbottom-NOAA/g…
henrywinterbottom-wxdev Nov 13, 2023
8c42c79
Merge branch 'develop' of https://github.com/HenryWinterbottom-NOAA/g…
henrywinterbottom-wxdev Nov 15, 2023
76d91e0
Merge branch 'develop' of https://github.com/HenryWinterbottom-NOAA/g…
henrywinterbottom-wxdev Nov 16, 2023
f626d91
Merge branch 'develop' of https://github.com/HenryWinterbottom-NOAA/g…
henrywinterbottom-wxdev Nov 17, 2023
afe078d
Merge branch 'develop' of https://github.com/HenryWinterbottom-NOAA/g…
henrywinterbottom-wxdev Nov 27, 2023
40f37ec
Merge branch 'develop' of https://github.com/HenryWinterbottom-NOAA/g…
henrywinterbottom-wxdev Nov 29, 2023
9297b1e
Added new AWIPS jobs for Rocoto.
henrywinterbottom-wxdev Nov 29, 2023
42dac7f
Removed no longer needed script.
henrywinterbottom-wxdev Nov 29, 2023
82c8f1b
Updated Rocoto applications.
henrywinterbottom-wxdev Nov 29, 2023
3e9a24c
Updates to test AWIPS job splitting.
henrywinterbottom-wxdev Nov 29, 2023
5c2b60a
Added tasks to GFS for AWIPS.
HenryRWinterbottom Nov 29, 2023
76d4e8c
Addressing issues raised by linter.
henrywinterbottom-wxdev Nov 29, 2023
7b41f31
Addressing issues raised by linter.
henrywinterbottom-wxdev Nov 29, 2023
763c516
Removed comment as per reviewer request.
henrywinterbottom-wxdev Nov 29, 2023
7e4e358
Renamed tasks as per reviewer suggestion.
henrywinterbottom-wxdev Nov 29, 2023
dd20e83
Updates relative to reviewer comments/suggestions.
henrywinterbottom-wxdev Nov 29, 2023
ea27c25
Update jobs/rocoto/awips_20sh.sh
HenryRWinterbottom Dec 1, 2023
46bf631
Merge branch 'NOAA-EMC:develop' into feature/gfsv17_issue_1228
HenryRWinterbottom Dec 1, 2023
920460b
Renamed files.
henrywinterbottom-wxdev Dec 1, 2023
df94d43
Files have been renamed.
henrywinterbottom-wxdev Dec 1, 2023
fb7fefb
Updated task names.
henrywinterbottom-wxdev Dec 1, 2023
3347e8e
Renamed file to reflect child JJOB.
henrywinterbottom-wxdev Dec 1, 2023
993956c
Updates to reflect upstream file updates.
henrywinterbottom-wxdev Dec 1, 2023
78aef53
File has been renamed.
henrywinterbottom-wxdev Dec 1, 2023
2977c86
Updated task names based on upstream commits.
henrywinterbottom-wxdev Dec 1, 2023
9ba2287
patch to reviewer comments on PR 2094
aerorahul Dec 1, 2023
a50f865
Merge pull request #1 from aerorahul/patch/2094
HenryRWinterbottom Dec 4, 2023
9cc697d
Merge branch 'NOAA-EMC:develop' into feature/gfsv17_issue_1228
HenryRWinterbottom Dec 4, 2023
1066a72
Update jobs/rocoto/awips_g2.sh
HenryRWinterbottom Dec 5, 2023
e9c9209
Update awips_g2.sh
aerorahul Dec 5, 2023
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
20 changes: 7 additions & 13 deletions jobs/rocoto/awips.sh → jobs/rocoto/awips_20sh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@ source "${HOMEgfs}/ush/load_fv3gfs_modules.sh"
status=$?
(( status != 0 )) && exit "${status}"

export job="awips"
export job="awips_20sh.sh"
HenryRWinterbottom marked this conversation as resolved.
Show resolved Hide resolved
export jobid="${job}.$$"

# TODO (#1228) - This script is doing more than just calling a j-job
# Also, this forces us to call the config files here instead of the j-job
source "${HOMEgfs}/ush/jjob_header.sh" -e "awips" -c "base awips"

fhrlst=$(echo ${FHRLST} | sed -e 's/_/ /g; s/f/ /g; s/,/ /g')
# shellcheck disable=SC2153
fhrlst=$(echo "${FHRLST}" | sed -e 's/_/ /g; s/f/ /g; s/,/ /g')

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

Expand All @@ -45,22 +44,17 @@ for fhr3 in ${fhrlst}; do
fhmax=84
Copy link
Member

Choose a reason for hiding this comment

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

Wondering if these should be configurable settings in config instead of being hardcoded (these are historically like this so perhaps now is the time to refine this).

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this needs to be done, but is outside the scope of this PR.

if (( fhr >= fhmin && fhr <= fhmax )); then
if ((fhr % 3 == 0)); then
export fcsthrs=${fhr3}
${AWIPS20SH}
fi

if ((fhr % 6 == 0)); then
${AWIPSG2SH}
export fcsthrs="${fhr3}"
"${AWIPS20SH}"
fi
fi

fhmin=90
fhmax=240
Copy link
Member

Choose a reason for hiding this comment

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

Same thoughts....perhaps these fhmin and fhmax variables should be variables?

if (( fhr >= fhmin && fhr <= fhmax )); then
if ((fhr % 6 == 0)); then
export fcsthrs=${fhr3}
${AWIPS20SH}
${AWIPSG2SH}
export fcsthrs="${fhr3}"
"${AWIPS20SH}"
fi
fi
done
Expand Down
66 changes: 66 additions & 0 deletions jobs/rocoto/awips_g2sh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#! /usr/bin/env bash

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

###############################################################
## Abstract:
## Inline awips driver script
## HOMEgfs : /full/path/to/workflow
## EXPDIR : /full/path/to/config/files
## CDATE : current analysis date (YYYYMMDDHH)
## CDUMP : cycle name (gdas / gfs)
## PDY : current date (YYYYMMDD)
## cyc : current cycle (HH)
###############################################################

###############################################################
# Source FV3GFS workflow modules
source "${HOMEgfs}/ush/load_fv3gfs_modules.sh"
status=$?
(( status != 0 )) && exit "${status}"

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

source "${HOMEgfs}/ush/jjob_header.sh" -e "awips" -c "base awips"
HenryRWinterbottom marked this conversation as resolved.
Show resolved Hide resolved

# shellcheck disable=SC2153
fhrlst=$(echo "${FHRLST}" | sed -e "s/_/ /g; s/f/ /g; s/,/ /g")

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

################################################################################
echo
echo "=============== BEGIN AWIPS ==============="

for fhr3 in ${fhrlst}; do
fhr=$(( 10#${fhr3} ))
if (( fhr > FHMAX_GFS )); then
echo "Nothing to process for FHR = ${fhr3}, cycle"
continue
Copy link
Contributor

Choose a reason for hiding this comment

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

If it is past FHMAX_GFS, there are no more forecasts. Should this be break?

fi

fhmin=0
fhmax=84
Copy link
Member

Choose a reason for hiding this comment

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

See comment earlier about hardcoded values.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@KateFriedman-NOAA I will wait for a consensus regarding hard-coded values.

if (( fhr >= fhmin && fhr <= fhmax )); then
if ((fhr % 6 == 0)); then
"${AWIPSG2SH}"
fi
fi

fhmin=90
fhmax=240
Copy link
Member

Choose a reason for hiding this comment

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

See comment earlier about hardcoded values.

if (( fhr >= fhmin && fhr <= fhmax )); then
if ((fhr % 6 == 0)); then
export fcsthrs="${fhr3}"
"${AWIPSG2SH}"
fi
fi
done


###############################################################
# Force Exit out cleanly
if [[ ${KEEPDATA:-"NO"} == "NO" ]] ; then rm -rf "${DATA}" ; fi

exit 0
3 changes: 2 additions & 1 deletion workflow/applications/gfs_cycled.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ def get_task_names(self):
gfs_tasks += ['gempak']

if self.do_awips:
gfs_tasks += ['awips']
gfs_tasks += ['awips_20km_1p0']
gfs_tasks += ['awips_g2']
gfs_tasks += ['fbwinds']

if self.do_npoess:
Expand Down
3 changes: 2 additions & 1 deletion workflow/applications/gfs_forecast_only.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ def get_task_names(self):
tasks += ['gempak']

if self.do_awips:
tasks += ['awips']
tasks += ['awips_20km_1p0']
tasks += ['awips_g2']
tasks += ['fbwinds']

if self.do_wafs:
Expand Down
66 changes: 63 additions & 3 deletions workflow/rocoto/gfs_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ def fbwinds(self):

return task

def awips(self):
def awips_20km_1p0(self):

def _get_awipsgroups(cdump, config):

Expand Down Expand Up @@ -877,8 +877,68 @@ def _get_awipsgroups(cdump, config):
vardict = {varname2: varval2, varname3: varval3}

resources = self.get_resource('awips')
task = create_wf_task('awips', resources, cdump=self.cdump, envar=awipsenvars, dependency=dependencies,
metatask='awips', varname=varname1, varval=varval1, vardict=vardict)
task = create_wf_task('awips_20km_1p0', resources, cdump=self.cdump, envar=awipsenvars, dependency=dependencies,
metatask='awips_20km_1p0', varname=varname1, varval=varval1, vardict=vardict)

return task

def awips_g2(self):

def _get_awipsgroups(cdump, config):

fhmin = config['FHMIN']
fhmax = config['FHMAX']
fhout = config['FHOUT']

# Get a list of all forecast hours
fhrs = []
if cdump in ['gdas']:
fhrs = range(fhmin, fhmax + fhout, fhout)
elif cdump in ['gfs']:
fhmax = np.max(
[config['FHMAX_GFS_00'], config['FHMAX_GFS_06'], config['FHMAX_GFS_12'], config['FHMAX_GFS_18']])
fhout = config['FHOUT_GFS']
fhmax_hf = config['FHMAX_HF_GFS']
fhout_hf = config['FHOUT_HF_GFS']
if fhmax > 240:
fhmax = 240
if fhmax_hf > 240:
fhmax_hf = 240
Copy link
Member

Choose a reason for hiding this comment

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

Do we want these hardcoded still or configurable (but still set to 240 for now)?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd call this outside scope as well.

fhrs_hf = list(range(fhmin, fhmax_hf + fhout_hf, fhout_hf))
fhrs = fhrs_hf + list(range(fhrs_hf[-1] + fhout, fhmax + fhout, fhout))

nawipsgrp = config['NAWIPSGRP']
ngrps = nawipsgrp if len(fhrs) > nawipsgrp else len(fhrs)

fhrs = [f'f{fhr:03d}' for fhr in fhrs]
fhrs = np.array_split(fhrs, ngrps)
fhrs = [fhr.tolist() for fhr in fhrs]

grp = ' '.join([f'_{fhr[0]}-{fhr[-1]}' for fhr in fhrs])
dep = ' '.join([fhr[-1] for fhr in fhrs])
lst = ' '.join(['_'.join(fhr) for fhr in fhrs])

return grp, dep, lst
HenryRWinterbottom marked this conversation as resolved.
Show resolved Hide resolved

deps = []
dep_dict = {'type': 'metatask', 'name': f'{self.cdump}post'}
deps.append(rocoto.add_dependency(dep_dict))
dependencies = rocoto.create_dependency(dep=deps)

awipsenvars = self.envars.copy()
awipsenvar_dict = {'FHRGRP': '#grp#',
'FHRLST': '#lst#',
'ROTDIR': self._base.get('ROTDIR')}
for key, value in awipsenvar_dict.items():
awipsenvars.append(rocoto.create_envar(name=key, value=str(value)))

varname1, varname2, varname3 = 'grp', 'dep', 'lst'
varval1, varval2, varval3 = _get_awipsgroups(self.cdump, self._configs['awips'])
vardict = {varname2: varval2, varname3: varval3}

resources = self.get_resource('awips')
task = create_wf_task('awips_g2', resources, cdump=self.cdump, envar=awipsenvars, dependency=dependencies,
metatask='awips_g2', varname=varname1, varval=varval1, vardict=vardict)

return task

Expand Down
2 changes: 1 addition & 1 deletion workflow/rocoto/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Tasks:
'fcst', 'post', 'ocnpost',
'verfozn', 'verfrad', 'vminmon', 'metp',
'tracker', 'genesis', 'genesis_fsu',
'postsnd', 'awips', 'fbwinds', 'gempak',
'postsnd', 'awips_g2sh', 'awips_20sh', 'fbwinds', 'gempak',
Copy link
Member

Choose a reason for hiding this comment

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

See comment earlier about job names.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure why sh is needed in these names? IMO, they should be awips_g2 and awips_20km. The later is short for awips_20km_1p0deg. It is fine to use the full name and be clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They were included to reflect the original awips.sh that called multiple j-job calls. For example,

    if (( fhr >= fhmin && fhr <= fhmax )); then
        if ((fhr % 6 == 0)); then
            export fcsthrs="${fhr3}"
            "${AWIPS20SH}"
            "${AWIPSG2SH}"
        fi
    fi

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated this to be consistent with @KateFriedman-NOAA's comment here.

This is the result for a GFS forecast-only 120-forecast using AWIPS (and no waves):

       CYCLE                    TASK                       JOBID               STATE         EXIT STATUS     TRIES      DURATION
================================================================================================================================
202103231200             gfsstage_ic         druby://hfe02:43701          SUBMITTING                   -         0           0.0
202103231200                 gfsfcst                           -                   -                   -         -             -
202103231200            gfspost_f000                           -                   -                   -         -             -
202103231200            gfspost_f006                           -                   -                   -         -             -
202103231200            gfspost_f012                           -                   -                   -         -             -
202103231200            gfspost_f018                           -                   -                   -         -             -
202103231200            gfspost_f024                           -                   -                   -         -             -
202103231200            gfspost_f030                           -                   -                   -         -             -
202103231200            gfspost_f036                           -                   -                   -         -             -
202103231200            gfspost_f042                           -                   -                   -         -             -
202103231200            gfspost_f048                           -                   -                   -         -             -
202103231200            gfspost_f054                           -                   -                   -         -             -
202103231200            gfspost_f060                           -                   -                   -         -             -
202103231200            gfspost_f066                           -                   -                   -         -             -
202103231200            gfspost_f072                           -                   -                   -         -             -
202103231200            gfspost_f078                           -                   -                   -         -             -
202103231200            gfspost_f084                           -                   -                   -         -             -
202103231200            gfspost_f090                           -                   -                   -         -             -
202103231200            gfspost_f096                           -                   -                   -         -             -
202103231200            gfspost_f102                           -                   -                   -         -             -
202103231200            gfspost_f108                           -                   -                   -         -             -
202103231200            gfspost_f114                           -                   -                   -         -             -
202103231200            gfspost_f120                           -                   -                   -         -             -
202103231200             gfsmetpg2g1                           -                   -                   -         -             -
202103231200             gfsmetpg2o1                           -                   -                   -         -             -
202103231200             gfsmetppcp1                           -                   -                   -         -             -
202103231200    gfsawips_20km_1p0deg_f000-f000                           -                   -                   -         -             -
202103231200    gfsawips_20km_1p0deg_f006-f006                           -                   -                   -         -             -
202103231200    gfsawips_20km_1p0deg_f012-f012                           -                   -                   -         -             -
202103231200    gfsawips_20km_1p0deg_f018-f018                           -                   -                   -         -             -
202103231200    gfsawips_20km_1p0deg_f024-f024                           -                   -                   -         -             -
202103231200    gfsawips_20km_1p0deg_f030-f030                           -                   -                   -         -             -
202103231200    gfsawips_20km_1p0deg_f036-f036                           -                   -                   -         -             -
202103231200    gfsawips_20km_1p0deg_f042-f042                           -                   -                   -         -             -
202103231200    gfsawips_20km_1p0deg_f048-f048                           -                   -                   -         -             -
202103231200    gfsawips_20km_1p0deg_f054-f054                           -                   -                   -         -             -
202103231200    gfsawips_20km_1p0deg_f060-f060                           -                   -                   -         -             -
202103231200    gfsawips_20km_1p0deg_f066-f066                           -                   -                   -         -             -
202103231200    gfsawips_20km_1p0deg_f072-f072                           -                   -                   -         -             -
202103231200    gfsawips_20km_1p0deg_f078-f078                           -                   -                   -         -             -
202103231200    gfsawips_20km_1p0deg_f084-f084                           -                   -                   -         -             -
202103231200    gfsawips_20km_1p0deg_f090-f090                           -                   -                   -         -             -
202103231200    gfsawips_20km_1p0deg_f096-f096                           -                   -                   -         -             -
202103231200    gfsawips_20km_1p0deg_f102-f102                           -                   -                   -         -             -
202103231200    gfsawips_20km_1p0deg_f108-f108                           -                   -                   -         -             -
202103231200    gfsawips_20km_1p0deg_f114-f114                           -                   -                   -         -             -
202103231200    gfsawips_20km_1p0deg_f120-f120                           -                   -                   -         -             -
202103231200    gfsawips_g2_f000-f000                           -                   -                   -         -             -
202103231200    gfsawips_g2_f006-f006                           -                   -                   -         -             -
202103231200    gfsawips_g2_f012-f012                           -                   -                   -         -             -
202103231200    gfsawips_g2_f018-f018                           -                   -                   -         -             -
202103231200    gfsawips_g2_f024-f024                           -                   -                   -         -             -
202103231200    gfsawips_g2_f030-f030                           -                   -                   -         -             -
202103231200    gfsawips_g2_f036-f036                           -                   -                   -         -             -
202103231200    gfsawips_g2_f042-f042                           -                   -                   -         -             -
202103231200    gfsawips_g2_f048-f048                           -                   -                   -         -             -
202103231200    gfsawips_g2_f054-f054                           -                   -                   -         -             -
202103231200    gfsawips_g2_f060-f060                           -                   -                   -         -             -
202103231200    gfsawips_g2_f066-f066                           -                   -                   -         -             -
202103231200    gfsawips_g2_f072-f072                           -                   -                   -         -             -
202103231200    gfsawips_g2_f078-f078                           -                   -                   -         -             -
202103231200    gfsawips_g2_f084-f084                           -                   -                   -         -             -
202103231200    gfsawips_g2_f090-f090                           -                   -                   -         -             -
202103231200    gfsawips_g2_f096-f096                           -                   -                   -         -             -
202103231200    gfsawips_g2_f102-f102                           -                   -                   -         -             -
202103231200    gfsawips_g2_f108-f108                           -                   -                   -         -             -
202103231200    gfsawips_g2_f114-f114                           -                   -                   -         -             -
202103231200    gfsawips_g2_f120-f120                           -                   -                   -         -             -
202103231200              gfsfbwinds                           -                   -                   -         -             -
202103231200                 gfsarch                           -                   -                   -         -             -
202103231200              gfscleanup                           -                   -                   -         -             -

'waveawipsbulls', 'waveawipsgridded', 'wavegempak', 'waveinit',
'wavepostbndpnt', 'wavepostbndpntbll', 'wavepostpnt', 'wavepostsbs', 'waveprep',
'npoess']
Expand Down