Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
0ac1221
#216 addind test cases for preanalysis
Mar 30, 2026
e9084d2
#216 change file name
Mar 30, 2026
f41d9b0
#216 update yml format
Apr 1, 2026
cbf1e12
#216 edit validation check in runscript for cloud runner tests
Apr 1, 2026
c4d1b90
#216 Merge branch 'main' of github.com:singhd789/fre-workflows into …
Apr 1, 2026
01f3c12
#216 revert change (had to merge in recent changes)
Apr 1, 2026
7d69f76
#216 Add pipeline check for stage-history-refined
Apr 1, 2026
f5a8453
#216 add history_refined
Apr 1, 2026
ca7d362
#216 fix path
Apr 1, 2026
0efbaab
Merge pull request #10 from singhd789/216.refinediag-preanalysis-tests
singhd789 Apr 1, 2026
306414f
Revert "Merge pull request #10 from singhd789/216.refinediag-preanaly…
Apr 2, 2026
a61d1d1
#216 whoops, redo/add things again
Apr 2, 2026
cc48ca3
#216 update check in pipeline
Apr 2, 2026
cdd815b
#216 update check and flow.cylc
Apr 2, 2026
e47f0c9
#216 fix path
Apr 2, 2026
a7ddd42
#216 Add local settings for refinediag and preanalysis
Apr 2, 2026
c7c7951
#216 fix YAML for valid yaml format
Apr 6, 2026
0f6a641
#216 Reference absolute path
Apr 9, 2026
45b3e57
#216 Try a different mount point
Apr 9, 2026
94c9597
#216 fix file
Apr 9, 2026
25027bb
#216 add refinediag dummy script
Apr 9, 2026
63f2d72
#216 update
Apr 9, 2026
06ac2c7
#216 fix file extension again
Apr 9, 2026
51badb6
#216 fix dummy script
Apr 9, 2026
0961933
#216 show all file
Apr 9, 2026
965c0ed
#216 essentially copy files to new name
Apr 9, 2026
1bc7e7f
#216 Fix inputDir
Apr 10, 2026
3e2a839
#216 see where I am
Apr 10, 2026
579f664
#216 add hsmget line in pre-script
Apr 10, 2026
e2b979e
#216 fix format
Apr 10, 2026
8b7a0e2
fix format
singhd789 Apr 10, 2026
2f99799
#216 add testfor refineDiag task in pipeline
Apr 14, 2026
70c5de5
#216 replace list_ncvars with ncdump to get netcdf variables
Apr 14, 2026
db34e57
#216 Merge branch '216.refinediag-preanalysis-tests' of github.com:s…
Apr 14, 2026
0b10b80
#216 forgot to add to refineDiag.log
Apr 14, 2026
3b6c06e
#216 fix format
Apr 14, 2026
24ad6b3
#216 fix cylc format (from linting)
Apr 14, 2026
1ec907d
#216 just try something
Apr 15, 2026
0c6bb33
#216 update files
Apr 15, 2026
2560081
#216 see if these changes make a difference
Apr 15, 2026
403de6e
#216 update format in workflow
Apr 15, 2026
0fe4556
#216 Merge branch 'main' of github.com:singhd789/fre-workflows into …
Apr 15, 2026
d31a45d
#216 Merge branch 'main' of github.com:singhd789/fre-workflows into …
Apr 21, 2026
db025f0
#216 try a different path (one that would be in the container)
Apr 22, 2026
f4d96ea
#216 add comment to see if im at hsmput
Apr 22, 2026
bffebc2
#216 add -n to hsmput line
Apr 22, 2026
c941e4e
#216 add terrible workaround to use hsmput
Apr 22, 2026
be93728
#216 add line check
Apr 23, 2026
b433688
#216 fix path
Apr 23, 2026
b39bb9b
#216 update permissions for sed line
Apr 23, 2026
bd7f7a1
#216 update container reference
Apr 23, 2026
f0c1590
#216 try different path
Apr 23, 2026
654fac2
#216 add clean up
Apr 23, 2026
3a19a3c
#216 add dummy scripts in work location for use in test
Apr 29, 2026
0286791
#216 fix path
Apr 29, 2026
ebd4357
#216 try mnt in path
Apr 29, 2026
cbfbc18
#216 remove comments
Apr 29, 2026
bd61338
Merge branch 'main' into 216.refinediag-preanalysis-tests
singhd789 Apr 29, 2026
bd8d720
#216 update path for USER
May 6, 2026
d34a768
#216 Merge branch 'main' of github.com:singhd789/fre-workflows into …
May 6, 2026
83f5826
#216 Merge branch '216.refinediag-preanalysis-tests' of github.com:s…
May 6, 2026
a0211e3
#216 see if this path update makes a difference
May 6, 2026
6ad3d4b
#216 move hsmget up
May 6, 2026
60f87bb
#216 see if the path was incorrect
May 20, 2026
7eedb9e
#216 fix path
May 20, 2026
3c77db5
#216 revert change
May 20, 2026
9ba5716
#216 CLEAN REFINEDIAG FOLDER AT BEGINNING
May 20, 2026
f3c596a
#216 fix up paths for cleaning
May 20, 2026
aca8e8f
#216 fix typo and testing addition
May 21, 2026
17375f0
#216 remove sed check line (not needed)
May 21, 2026
1ec8d01
Uncomment validation logic in run_pp_locally.sh
singhd789 May 21, 2026
5ecdd05
#216 might as well change the others
May 21, 2026
7c6c9bc
#216 Merge branch '216.refinediag-preanalysis-tests' of github.com:s…
May 21, 2026
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
111 changes: 107 additions & 4 deletions .github/workflows/test_cloud_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@ jobs:

singularity exec --writable-tmpfs ${bind_paths} ${container_path} ${runscript_path}

# Can potentially do this to get list of tasks
#task_list=$(cylc list test_pp__ptest__ttest)
#task1=$(echo $task_list | cut -d ' ' -f1) ....

- name: Upload workflow-run log files
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -166,6 +162,106 @@ jobs:
exit 2
fi

- name: Print stage-history-refined successes or failures
run: |
set +e
# Successes
success=$(grep -E "CYLC_JOB_EXIT=SUCCEEDED" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/stage-history-refined/0[1-3]/job.status)
exit_status_1=$?
# Failures
failure=$(grep -E "CYLC_JOB_EXIT=ERR" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/stage-history-refined/0[1-3]/job.status)
exit_status_2=$?
if [ $exit_status_1 -eq 0 ]; then
echo $success | sed 's/ /\n/g' #split string by spaces
elif [ $exit_status_1 -eq 1 ]; then
echo "No succeeded tasks found"
else
echo "WARNING: error with grep execution"
exit 2
fi
if [ $exit_status_2 -eq 0 ]; then
echo "Failures found"
echo $failure | sed 's/ /\n/g' #split string by spaces
exit 1 #exit with error
elif [ $exit_status_2 -eq 1 ]; then
echo "No task failures found."
else
echo "WARNING: error with grep execution"
exit 2
fi

- name: Print refine-diag successes or failures
run: |
set +e
# Successes
success=$(grep -E "CYLC_JOB_EXIT=SUCCEEDED" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/refineDiag-*/0[1-3]/job.status)
exit_status_1=$?

# Failures
failure=$(grep -E "CYLC_JOB_EXIT=ERR" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/refineDiag-*/0[1-3]/job.status)
exit_status_2=$?

if [ $exit_status_1 -eq 0 ]; then
echo $success | sed 's/ /\n/g' #split string by spaces

# Check if refine-diag task executed correctly
# history files copied into another history file
# ........

elif [ $exit_status_1 -eq 1 ]; then
echo "No succeeded tasks found"
else
echo "WARNING: error with grep execution"
exit 2
fi

if [ $exit_status_2 -eq 0 ]; then
echo "Failures found"
echo $failure | sed 's/ /\n/g' #split string by spaces
exit 1 #exit with error
elif [ $exit_status_2 -eq 1 ]; then
echo "No task failures found."
else
echo "WARNING: error with grep execution"
exit 2
fi

- name: Print pre-analysis successes or failures
run: |
set +e
# Successes
success=$(grep -E "CYLC_JOB_EXIT=SUCCEEDED" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/preAnalysis-*/0[1-3]/job.status)
exit_status_1=$?
# Failures
failure=$(grep -E "CYLC_JOB_EXIT=ERR" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/preAnalysis-*/0[1-3]/job.status)
exit_status_2=$?
if [ $exit_status_1 -eq 0 ]; then
echo $success | sed 's/ /\n/g' #split string by spaces
# Check if preanalysis task executed correctly: Check database exists
if [ -s "/contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/db" ]; then
echo "Pre-analysis task produced non-empty db file"
exit 0
else
echo "Pre-analysis task did not produce expected, non-empty db file"
exit 1
fi
elif [ $exit_status_1 -eq 1 ]; then
echo "No succeeded tasks found"
else
echo "WARNING: error with grep execution"
exit 2
fi
if [ $exit_status_2 -eq 0 ]; then
echo "Failures found"
echo $failure | sed 's/ /\n/g' #split string by spaces
exit 1 #exit with error
elif [ $exit_status_2 -eq 1 ]; then
echo "No task failures found."
else
echo "WARNING: error with grep execution"
exit 2
fi

- name: Print regrid-xy successes or failures
run: |
set +e
Expand Down Expand Up @@ -446,6 +542,13 @@ jobs:
exit 2
fi

## I think this will work (without cylc clean) because the
## OUTPUT_DIR is bind mounted from the host
## This is to retain clean workspace on cloud and to not waste
## allocation
- name: Clean up output folder
run: rm -rf /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest

## Keep in here for now as a just in case reference ##
# - name: Print any succeeded tasks
# run: |
Expand Down
11 changes: 8 additions & 3 deletions flow.cylc
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@
env
set -x
mkdir -p $work $tempCache $refineDiagDir
hsmget -v -t -a $histDir -p {{ PTMP_DIR }}/$histDir -w $work $hsmdate/\*
cd $work/$hsmdate
ls
"""
Expand Down Expand Up @@ -500,19 +501,23 @@
fi
if [[ $refinedCount > 0 ]]; then
for file in $(ls -1 *nc); do
list_ncvars.csh -st01234 $file |& tee $CYLC_WORKFLOW_SHARE_DIR/refineDiag.log
# list the variables names in the netcdf file
ncdump -h $file |
grep -E "float|double" |
awk '{print $2}' |
cut -d '(' -f1 |& tee $CYLC_WORKFLOW_SHARE_DIR/refineDiag.log
done
else
echo ERROR: RefineDiag script did not create any NetCDF files as it was expected to do
exit 1
fi
if [[ -f {{ REFINED_HISTORY_DIR }}/$oname.nc.tar ]]; then
hsmget -v -t -a {{ REFINED_HISTORY_DIR }} -p {{ PTMP_DIR }}/{{ REFINED_HISTORY_DIR }} \
-w $TMPDIR/modify_refineDiag $hsmdate/\*
echo "the contents of {{ PTMP_DIR }}/{{ REFINED_HISTORY_DIR }} is..."
ls {{ PTMP_DIR }}/{{ REFINED_HISTORY_DIR }}
echo "the contents of {{ PTMP_DIR }}/{{ REFINED_HISTORY_DIR }}/$oname.nc is..."
ls {{ PTMP_DIR }}/{{ REFINED_HISTORY_DIR }}/$oname.nc
hsmget -v -t -a {{ REFINED_HISTORY_DIR }} -p {{ PTMP_DIR }}/{{ REFINED_HISTORY_DIR }} \
-w $TMPDIR/modify_refineDiag $hsmdate/\*
mv -f * $TMPDIR/modify_refineDiag
mv -f $TMPDIR/modify_refineDiag/* .
rm -rf $TMPDIR/modify_refineDiag
Expand Down
3 changes: 3 additions & 0 deletions for_gh_runner/dummy_preanalysis.csh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/csh

echo "Pre-analysis script is running!"
26 changes: 26 additions & 0 deletions for_gh_runner/dummy_refinediag.csh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/csh

## RefineDiag scripts reads raw history files and generates new, refined history files
# Script copies test history file to another history file
set input_dir = `pwd`

if ( $?refineDiagDir ) then
set output_dir = $refineDiagDir
else
echo "ERROR: refineDiagDir environment variable is not set."
exit 1
endif

if ( -d "$input_dir" ) then
#ls -aF
echo "Input directory found: $input_dir"
echo "good to go"
foreach INFILE (*atmos_month*.nc)
set OUTFILE = ${INFILE:r}_refined.${INFILE:e}
echo "OUTFILE $OUTFILE"
cp "$INFILE" "$output_dir/$OUTFILE"
end
else
echo "Error: Input directory $input_dir does not exist."
exit 1
endif
7 changes: 7 additions & 0 deletions for_gh_runner/run_pp_locally.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ if [ -d $cylc_src_dir_name ]; then
sleep 10s
fi

## More cleaning neede for refineDiag output
if [ -d /work/$USER/fre-wf-local-testing/refined_history ]; then
echo -e "Refine Diag scripts previously run, removing ..."
rm -rf "/work/$USER/fre-wf-local-testing/refined_history"
fi


# if you want this, comment on https://github.com/NOAA-GFDL/fre-cli/issues/673
#echo ""
#echo ""
Expand Down
13 changes: 10 additions & 3 deletions for_gh_runner/runscript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,20 @@ check_exit_status () {
fre_pp_steps () {
set -x

## Clean previous experiment
echo "experiment cleaning, if it was previously installed"
if [ -d /mnt/cylc-run/${name} ]; then
echo -e "\n${name} previously installed"
echo " Removing ${name}..."
cylc clean ${name}
fi

## More cleaning needed for refineDiag output
if [ -d /mnt/$USER/refined_history ]; then
echo -e "Refine Diag scripts previously run, removing ..."
rm -rf /mnt/$USER/refined_history
fi

## Checkout
echo -e "\nCreating $name directory in ${HOME}/cylc-src/${name} ..."
rm -rf /mnt/cylc-src/${name}
Expand All @@ -94,13 +101,13 @@ fre_pp_steps () {
#Not sure if needed because if no global.cylc found, cylc uses default, which utilizes background jobs anyway ...
#export CYLC_CONF_PATH=/mnt/cylc-src/${name}/generic-global-config/

## Configure the rose-suite and rose-app files for the workflow
echo -e "\nRunning fre pp configure-yaml, combining separate yaml configs into one, then writing rose-suite/app config files ..."
## Configure the rose-suite file for the workflow
echo -e "\nRunning fre pp configure-yaml, combining separate yaml configs into one, then writing rose-suite config file ..."
fre -vv pp configure-yaml -e ${expname} -p ${plat} -t ${targ} -y ${yamlfile}
check_exit_status "CONFIGURE-YAML"

## Validate the configuration files
echo -e "\nRunning fre pp validate, validating rose-suite/app config files ..."
echo -e "\nRunning fre pp validate, validating rose-suite config file ..."
fre -vv pp validate -e ${expname} -p ${plat} -t ${targ}
check_exit_status "VALIDATE"

Expand Down
21 changes: 18 additions & 3 deletions for_gh_runner/yaml_workflow/local_settings.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
directories:
## to test staging data from archive, use the below
# history_dir: "/archive/inl/test_cloud_runner_history_files"
#
# to have a faster turn-around (does not test archive data staging), use the below
history_dir: "/work/inl/test_cloud_runner_history_files"
history_dir: "/work/inl/test_cloud_runner_history_files"
refined_history_dir: "/work/$USER/fre-wf-local-testing/refined_history"
pp_dir: !join [/work/$USER/test_cloud_runner_scratch_dir/, *FRE_STEM, /, pp]
# analysis_dir: !join [/nbhome/$USER/, *FRE_STEM, /, *name]
ptmp_dir: "/xtmp/$USER/ptmp"

postprocess:
settings:
history_segment: "P1Y"
# site: "ppan"
site: "ppan_test"
site: "ppan"
# site: "ppan_test"
pp_chunks: [*PP_CHUNK96]
pp_start: *EXP_AMIP_START
pp_stop: *EXP_AMIP_END
pp_grid_spec: *GRID_SPEC96_LOCAL
switches:
clean_work: True
do_atmos_plevel_masking: True

# to be first-step-user-script
preanalysis:
vitals:
script: "/work/d4s/fre-wf-local-testing/dummy_preanalysis.csh"
inputs: ['atmos_month', 'aerosol_month'] # not used currently
do_preanalysis: True
refinediag:
ocean:
script: "/work/d4s/fre-wf-local-testing/dummy_refinediag.csh"
inputs: ['ocean_monthly', 'ocean_bgc'] # not used currently
outputs: ['ocean_refined'] # not used currently
do_refinediag: True
24 changes: 21 additions & 3 deletions for_gh_runner/yaml_workflow/settings.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# directories shared across tools
directories:
history_dir: "/mnt/history"
pp_dir: "/mnt/pp"
history_dir: "/mnt/history"
refined_history_dir: "/mnt/$USER/refined_history"
pp_dir: "/mnt/pp"
# analysis_dir: !join [/nbhome/$USER/, *FRE_STEM, /, *name]
ptmp_dir: "/mnt/ptmp"
ptmp_dir: "/mnt/ptmp"

postprocess:
settings:
Expand All @@ -16,3 +17,20 @@ postprocess:
switches:
clean_work: True
do_atmos_plevel_masking: True

# to be first-step-user-scripts
preanalysis:
vitals:
script: "/contrib-efs/fre-workflows-runners/actions-runner-1/_work/fre-workflows/fre-workflows/for_gh_runner/dummy_preanalysis.csh"
inputs: ['atmos_month', 'aerosol_month'] #not used currently
# to be user-script_on
do_preanalysis: True

# to be refinediag-user-scripts
refinediag:
ocean:
script: "/contrib-efs/fre-workflows-runners/actions-runner-1/_work/fre-workflows/fre-workflows/for_gh_runner/dummy_refinediag.csh"
inputs: ['ocean_monthly', 'ocean_bgc'] # not used currently
outputs: ['ocean_refined'] # not used currently
# to be user_script_on
do_refinediag: True
2 changes: 1 addition & 1 deletion site/gaea.cylc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
COPY_TOOL=gcp

[[STAGE-HISTORY]]
pre-script = module load hsm/1.3.0
pre-script = module load hsm/1.4.0

[[MAKE-TIMESERIES]]
pre-script = module load cdo
Expand Down
6 changes: 3 additions & 3 deletions site/ppan.cylc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#module load conda
#conda activate user-fre-cli

which fre
#which fre
module load gcp/2.3
module list
"""
Expand All @@ -24,15 +24,15 @@

[[STAGE-HISTORY]]
pre-script = """
module load gcp/2.3 hsm/1.3.0
module load gcp/2.3 hsm/1.4.0
"""

{% if DO_REFINEDIAG or DO_PREANALYSIS %}
[[PRE-ANALYSIS]]
pre-script = """
env
set -x
module load hsm/1.3.0
module load hsm/1.4.0
Comment thread
singhd789 marked this conversation as resolved.
module load gcp
# needed only for list_ncvars.
module load fre-nctools/2024.05.01
Expand Down
6 changes: 3 additions & 3 deletions site/ppan_test.cylc
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
epmt check

#### if you want to use your own conda environment, comment out 'module load fre/...' below
module load fre/{{ FRE_VERSION }}
module load gcp/2.3 hsm/1.3.0
#module load fre/{{ FRE_VERSION }}
module load gcp/2.3 hsm/1.4.0

#### if you want to use your own conda environment, edit the PATH and uncomment below like so:
#export PATH=/home/$USER/conda/envs/fre-cli/bin:$PATH
export PATH=/home/$USER/conda/envs/fre-cli/bin:$PATH
"""
env-script = """
{{ EPMT_PREAMBLE }}
Expand Down
Loading