Skip to content

Commit ee54eac

Browse files
Add fetch job and update stage_ic to work with fetched ICs (#3141)
Most jobs require the initial conditions to be available on local disk. The existing “stage_ic” task copies/stages these initial condition into the experiment's COM directory. This PR for the “fetch” task extends that functionality to copy from HPSS (on HPSS-accessible machines) into COM. Resolves #2988 --------- Co-authored-by: David Huber <[email protected]>
1 parent 76cecfb commit ee54eac

20 files changed

+329
-11
lines changed

ci/cases/yamls/gfs_defaults_ci.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@ defaults:
22
!INC {{ HOMEgfs }}/parm/config/gfs/yaml/defaults.yaml
33
base:
44
ACCOUNT: {{ 'HPC_ACCOUNT' | getenv }}
5-
DO_TEST_MODE: "NO"
5+
DO_TEST_MODE: "YES"
6+
FETCHDIR: "/NCEPDEV/emc-global/1year/David.Grumm/test_data"
67
DO_METP: "NO"
8+

jobs/JGLOBAL_FETCH

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#! /usr/bin/env bash
2+
3+
source "${HOMEgfs}/ush/preamble.sh"
4+
source "${HOMEgfs}/ush/jjob_header.sh" -e "fetch" -c "base fetch"
5+
6+
# Execute fetching
7+
"${SCRgfs}/exglobal_fetch.py"
8+
err=$?
9+
10+
###############################################################
11+
# Check for errors and exit if any of the above failed
12+
if [[ "${err}" -ne 0 ]]; then
13+
echo "FATAL ERROR: Unable to fetch ICs to ${ROTDIR}; ABORT!"
14+
exit "${err}"
15+
fi
16+
17+
##########################################
18+
# Remove the Temporary working directory
19+
##########################################
20+
cd "${DATAROOT}" || (echo "${DATAROOT} does not exist. ABORT!"; exit 1)
21+
[[ ${KEEPDATA} = "NO" ]] && rm -rf "${DATA}"
22+
23+
exit 0

jobs/rocoto/fetch.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#! /usr/bin/env bash
2+
3+
source "${HOMEgfs}/ush/preamble.sh"
4+
5+
# Source FV3GFS workflow modules
6+
. "${HOMEgfs}/ush/load_fv3gfs_modules.sh"
7+
status=$?
8+
[[ "${status}" -ne 0 ]] && exit "${status}"
9+
10+
export job="fetch"
11+
export jobid="${job}.$$"
12+
13+
# Execute the JJOB
14+
"${HOMEgfs}/jobs/JGLOBAL_FETCH"
15+
status=$?
16+
17+
18+
exit "${status}"

parm/config/gefs/config.base

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ export ROTDIR="@COMROOT@/${PSLOT}"
103103

104104
export ARCDIR="${NOSCRUB}/archive/${PSLOT}"
105105
export ATARDIR="@ATARDIR@"
106+
export FETCHDIR="@FETCHDIR@" # HPSS or local directory where IC tarball(s) can be found.
106107

107108
# Commonly defined parameters in JJOBS
108109
export envir=${envir:-"prod"}

parm/config/gefs/config.fetch

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../gfs/config.fetch

parm/config/gfs/config.base

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ if [[ "${PDY}${cyc}" -ge "2019092100" && "${PDY}${cyc}" -le "2019110700" ]]; the
132132
fi
133133
export ARCDIR="${NOSCRUB}/archive/${PSLOT}"
134134
export ATARDIR="@ATARDIR@"
135+
export FETCHDIR="@FETCHDIR@"
135136

136137
# Commonly defined parameters in JJOBS
137138
export envir=${envir:-"prod"}
@@ -474,6 +475,10 @@ export DO_VRFY_OCEANDA="@DO_VRFY_OCEANDA@" # Run SOCA Ocean and Seaice DA verif
474475
export FHMAX_FITS=132
475476
[[ "${FHMAX_FITS}" -gt "${FHMAX_GFS}" ]] && export FHMAX_FITS=${FHMAX_GFS}
476477

478+
# User may choose to reset these at experiment setup time
479+
export DO_FETCH_HPSS="NO" # Copy from HPSS (on HPSS-accessible machines) onto COM
480+
export DO_FETCH_LOCAL="NO" # Copy from local disk onto COM
481+
477482
# Archiving options
478483
export HPSSARCH="@HPSSARCH@" # save data to HPSS archive
479484
export LOCALARCH="@LOCALARCH@" # save data to local archive

parm/config/gfs/config.fetch

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#! /usr/bin/env bash
2+
3+
########## config.fetch ##########
4+
5+
echo "BEGIN: config.fetch"
6+
7+
# Get task specific resources
8+
source "${EXPDIR}/config.resources" fetch
9+
10+
# Determine start type
11+
if [[ "${EXP_WARM_START}" == ".false." ]]; then
12+
ic_type="cold"
13+
else
14+
ic_type="warm"
15+
fi
16+
17+
export FETCH_YAML_TMPL="${PARMgfs}/fetch/${NET}_${APP}_${ic_type}_${MODE}.yaml.j2"
18+
19+
echo "END: config.fetch"

parm/config/gfs/config.resources

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if (( $# != 1 )); then
1111

1212
echo "Must specify an input task argument to set resource variables!"
1313
echo "argument can be any one of the following:"
14-
echo "stage_ic aerosol_init"
14+
echo "stage_ic aerosol_init fetch"
1515
echo "prep prepatmiodaobs"
1616
echo "atmanlinit atmanlvar atmanlfv3inc atmanlfinal"
1717
echo "atmensanlinit atmensanlobs atmensanlsol atmensanlletkf atmensanlfv3inc atmensanlfinal"
@@ -1059,7 +1059,7 @@ case ${step} in
10591059
export is_exclusive=True
10601060
;;
10611061

1062-
"arch" | "earc" | "getic")
1062+
"arch" | "earc" | "getic" | "fetch")
10631063
walltime="06:00:00"
10641064
ntasks=1
10651065
tasks_per_node=1

parm/config/gfs/config.stage_ic

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ echo "BEGIN: config.stage_ic"
77
# Get task specific resources
88
source "${EXPDIR}/config.resources" stage_ic
99

10-
export ICSDIR="@ICSDIR@" # User provided ICSDIR; blank if not provided
10+
if [[ "${DO_FETCH_HPSS^^}" =~ "Y" || "${DO_FETCH_LOCAL^^}" =~ "Y" ]]; then
11+
export ICSDIR="${DATAROOT}" # fetch untars data into DATAROOT
12+
else
13+
export ICSDIR="@ICSDIR@" # User provided ICSDIR; blank if not provided
14+
fi
15+
1116
export BASE_IC="@BASE_IC@" # Platform home for staged ICs
1217

1318
export STAGE_IC_YAML_TMPL="${PARMgfs}/stage/master_gfs.yaml.j2"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{% set cycle_YMDH = current_cycle | to_YMDH %}
2+
{% set cycle_YMD = current_cycle | to_YMD %}
3+
{% set cycle_HH = current_cycle | strftime("%H") %}
4+
{% set atm_dir = RUN + "." ~ cycle_YMD ~ "/" ~ cycle_HH ~ "/model/atmos/input" %}
5+
target:
6+
tarball : "{{ FETCHDIR }}/{{ cycle_YMDH }}/atm_cold.tar"
7+
on_hpss: True
8+
contents:
9+
# ATM
10+
- {{atm_dir}}/gfs_ctrl.nc
11+
{% for ftype in ["gfs_data", "sfc_data"] %}
12+
{% for ntile in range(1, ntiles + 1) %}
13+
- {{atm_dir}}/{{ ftype }}.tile{{ ntile }}.nc
14+
{% endfor %} # ntile
15+
{% endfor %} # ftype
16+
destination: "{{ DATAROOT }}"

0 commit comments

Comments
 (0)