Skip to content

Commit

Permalink
Convert IC staging job into a proper j-job (NOAA-EMC#1806)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnilKumar-NOAA authored Sep 12, 2023
1 parent 0a84646 commit 1842c22
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 36 deletions.
16 changes: 16 additions & 0 deletions jobs/JGLOBAL_STAGE_IC
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#! /usr/bin/env bash

source "${HOMEgfs}/ush/preamble.sh"
source "${HOMEgfs}/ush/jjob_header.sh" -e "stage_ic" -c "base stage_ic"


# Execute the Script
"${HOMEgfs}/scripts/exglobal_stage_ic.sh"

##########################################
# Remove the Temporary working directory
##########################################
cd "${DATAROOT}" || (echo "${DATAROOT} does not exist. ABORT!"; exit 1)
[[ ${KEEPDATA} = "NO" ]] && rm -rf "${DATA}"

exit 0
18 changes: 18 additions & 0 deletions jobs/rocoto/stage_ic.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#! /usr/bin/env bash

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

# Source FV3GFS workflow modules
. "${HOMEgfs}/ush/load_fv3gfs_modules.sh"
status=$?
[[ "${status}" -ne 0 ]] && exit "${status}"

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

# Execute the JJOB
"${HOMEgfs}/jobs/JGLOBAL_STAGE_IC"
status=$?


exit "${status}"
12 changes: 6 additions & 6 deletions parm/config/gfs/config.resources
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [[ $# -ne 1 ]]; then

echo "Must specify an input task argument to set resource variables!"
echo "argument can be any one of the following:"
echo "coupled_ic aerosol_init"
echo "stage_ic aerosol_init"
echo "prep preplandobs prepatmiodaobs"
echo "atmanlinit atmanlrun atmanlfinal"
echo "atmensanlinit atmensanlrun atmensanlfinal"
Expand Down Expand Up @@ -772,12 +772,12 @@ elif [[ ${step} = "arch" || ${step} = "earc" || ${step} = "getic" ]]; then
eval "export memory_${step}=50GB"
fi

elif [[ ${step} = "coupled_ic" ]]; then
elif [[ ${step} = "stage_ic" ]]; then

export wtime_coupled_ic="00:15:00"
export npe_coupled_ic=1
export npe_node_coupled_ic=1
export nth_coupled_ic=1
export wtime_stage_ic="00:15:00"
export npe_stage_ic=1
export npe_node_stage_ic=1
export nth_stage_ic=1
export is_exclusive=True

elif [[ "${step}" = "atmensanlinit" ]]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#! /usr/bin/env bash

########## config.coupled_ic ##########
########## config.stage_ic ##########

echo "BEGIN: config.coupled_ic"
echo "BEGIN: config.stage_ic"

# Get task specific resources
source "${EXPDIR}/config.resources" coupled_ic
source "${EXPDIR}/config.resources" stage_ic

case "${CASE}" in
"C48" | "C96")
Expand All @@ -32,4 +32,4 @@ case "${CASE}" in
;;
esac

echo "END: config.coupled_ic"
echo "END: config.stage_ic"
25 changes: 7 additions & 18 deletions jobs/rocoto/coupled_ic.sh → scripts/exglobal_stage_ic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,8 @@

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

# Source FV3GFS workflow modules
. ${HOMEgfs}/ush/load_fv3gfs_modules.sh
status=$?
[[ ${status} -ne 0 ]] && exit ${status}

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

# Execute the JJOB

source "${HOMEgfs}/ush/jjob_header.sh" -e "coupled_ic" -c "base coupled_ic"

# Locally scoped variables and functions
# shellcheck disable=SC2153
GDATE=$(date -d "${PDY} ${cyc} - ${assim_freq} hours" +%Y%m%d%H)
gPDY="${GDATE:0:8}"
gcyc="${GDATE:8:2}"
Expand All @@ -36,15 +25,15 @@ source="${BASE_CPLIC}/${CPL_ATMIC}/${PDY}${cyc}/${CDUMP}/${CASE}/INPUT/gfs_ctrl.
target="${COM_ATMOS_INPUT}/gfs_ctrl.nc"
${NCP} "${source}" "${target}"
rc=$?
[[ ${rc} -ne 0 ]] && error_message "${source}" "${target}" "${rc}"
(( rc != 0 )) && error_message "${source}" "${target}" "${rc}"
err=$((err + rc))
for ftype in gfs_data sfc_data; do
for tt in $(seq 1 6); do
source="${BASE_CPLIC}/${CPL_ATMIC}/${PDY}${cyc}/${CDUMP}/${CASE}/INPUT/${ftype}.tile${tt}.nc"
target="${COM_ATMOS_INPUT}/${ftype}.tile${tt}.nc"
${NCP} "${source}" "${target}"
rc=$?
[[ ${rc} -ne 0 ]] && error_message "${source}" "${target}" "${rc}"
(( rc != 0 )) && error_message "${source}" "${target}" "${rc}"
err=$((err + rc))
done
done
Expand All @@ -57,7 +46,7 @@ if [[ "${DO_OCN:-}" = "YES" ]]; then
target="${COM_OCEAN_RESTART}/${PDY}.${cyc}0000.MOM.res.nc"
${NCP} "${source}" "${target}"
rc=$?
[[ ${rc} -ne 0 ]] && error_message "${source}" "${target}" "${rc}"
(( rc != 0 )) && error_message "${source}" "${target}" "${rc}"
err=$((err + rc))
case "${OCNRES}" in
"500" | "100") # Only 5 degree or 1 degree ocean does not have MOM.res_[1-4].nc files
Expand All @@ -69,7 +58,7 @@ if [[ "${DO_OCN:-}" = "YES" ]]; then
target="${COM_OCEAN_RESTART}/${PDY}.${cyc}0000.MOM.res_${nn}.nc"
${NCP} "${source}" "${target}"
rc=$?
[[ ${rc} -ne 0 ]] && error_message "${source}" "${target}" "${rc}"
(( rc != 0 )) && error_message "${source}" "${target}" "${rc}"
err=$((err + rc))
fi
done
Expand All @@ -91,7 +80,7 @@ if [[ "${DO_ICE:-}" = "YES" ]]; then
target="${COM_ICE_RESTART}/${PDY}.${cyc}0000.cice_model.res.nc"
${NCP} "${source}" "${target}"
rc=$?
[[ ${rc} -ne 0 ]] && error_message "${source}" "${target}" "${rc}"
(( rc != 0 )) && error_message "${source}" "${target}" "${rc}"
err=$((err + rc))
fi

Expand All @@ -104,7 +93,7 @@ if [[ "${DO_WAVE:-}" = "YES" ]]; then
target="${COM_WAVE_RESTART}/${PDY}.${cyc}0000.restart.${grdID}"
${NCP} "${source}" "${target}"
rc=$?
[[ ${rc} -ne 0 ]] && error_message "${source}" "${target}" "${rc}"
(( rc != 0 )) && error_message "${source}" "${target}" "${rc}"
err=$((err + rc))
done
fi
Expand Down
4 changes: 2 additions & 2 deletions workflow/applications/gfs_forecast_only.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def _get_app_configs(self):
Returns the config_files that are involved in the forecast-only app
"""

configs = ['coupled_ic', 'fcst', 'arch']
configs = ['stage_ic', 'fcst', 'arch']

if self.do_atm:
configs += ['post', 'vrfy']
Expand Down Expand Up @@ -65,7 +65,7 @@ def get_task_names(self):
This is the place where that order is set.
"""

tasks = ['coupled_ic']
tasks = ['stage_ic']

if self.do_aero:
tasks += ['aerosol_init']
Expand Down
10 changes: 5 additions & 5 deletions workflow/rocoto/gfs_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ def _is_this_a_gdas_task(cdump, task_name):
raise TypeError(f'{task_name} must be part of the "enkfgdas" cycle and not {cdump}')

# Specific Tasks begin here
def coupled_ic(self):
def stage_ic(self):

cpl_ic = self._configs['coupled_ic']
cpl_ic = self._configs['stage_ic']

deps = []

Expand Down Expand Up @@ -72,8 +72,8 @@ def coupled_ic(self):

dependencies = rocoto.create_dependency(dep_condition='and', dep=deps)

resources = self.get_resource('coupled_ic')
task = create_wf_task('coupled_ic', resources, cdump=self.cdump, envar=self.envars, dependency=dependencies)
resources = self.get_resource('stage_ic')
task = create_wf_task('stage_ic', resources, cdump=self.cdump, envar=self.envars, dependency=dependencies)

return task

Expand Down Expand Up @@ -484,7 +484,7 @@ def fcst(self):
def _fcst_forecast_only(self):
dependencies = []

dep_dict = {'type': 'task', 'name': f'{self.cdump}coupled_ic'}
dep_dict = {'type': 'task', 'name': f'{self.cdump}stage_ic'}
dependencies.append(rocoto.add_dependency(dep_dict))

if self.app_config.do_wave and self.cdump in self.app_config.wave_cdumps:
Expand Down
2 changes: 1 addition & 1 deletion workflow/rocoto/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class Tasks:
SERVICE_TASKS = ['arch', 'earc']
VALID_TASKS = ['aerosol_init', 'coupled_ic',
VALID_TASKS = ['aerosol_init', 'stage_ic',
'prep', 'anal', 'sfcanl', 'analcalc', 'analdiag', 'arch',
'prepatmiodaobs', 'atmanlinit', 'atmanlrun', 'atmanlfinal',
'ocnanalprep', 'ocnanalbmat', 'ocnanalrun', 'ocnanalchkpt', 'ocnanalpost', 'ocnanalvrfy',
Expand Down

0 comments on commit 1842c22

Please sign in to comment.