Skip to content

Commit 61711f6

Browse files
committed
Eliminate post-script duplication in site files
1 parent 1eaa376 commit 61711f6

File tree

3 files changed

+11
-64
lines changed

3 files changed

+11
-64
lines changed

flow.cylc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,10 +505,14 @@
505505
ls {{ PTMP_DIR }}/{{ HISTORY_DIR_REFINED }}
506506
echo "the contents of {{ PTMP_DIR }}/{{ HISTORY_DIR_REFINED }}/$oname.nc is..."
507507
ls {{ PTMP_DIR }}/{{ HISTORY_DIR_REFINED }}/$oname.nc
508+
hsmget -v -t -a {{ HISTORY_DIR_REFINED }} -p {{ PTMP_DIR }}/{{ HISTORY_DIR_REFINED }} \
509+
-w $TMPDIR/modify_refineDiag $hsmdate/\*
508510
mv -f * $TMPDIR/modify_refineDiag
509511
mv -f $TMPDIR/modify_refineDiag/* .
510512
rm -rf $TMPDIR/modify_refineDiag
511513
fi
514+
hsmput -v -t -s tar -a {{ HISTORY_DIR_REFINED }} -p {{ PTMP_DIR }}/{{ HISTORY_DIR_REFINED }} \
515+
-w $TMPDIR/history_refineDiag $hsmdate
512516
"""
513517
{# The following section executes refineDiag tasks, whether single or multiple refineDiag paths are given #}
514518
{# Create a 'macro' function to reduce code repeat #}

site/ppan.cylc

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
[[root]]
33
init-script = """
44
# stock fre-cli
5-
module load fre/{{ FRE_VERSION }}
5+
#module load fre/{{ FRE_VERSION }}
66
77
# custom user fre-cli
8-
#module load conda
8+
module load conda
99
#conda activate user-fre-cli
10+
conda activate fre-cli
1011
which fre
1112
1213
module load gcp/2.3
@@ -19,6 +20,7 @@
1920
platform = ppan
2021
[[[directives]]]
2122
--comment=xtmp,fre/{{ FRE_VERSION }}
23+
--partition=analysis
2224
[[[environment]]]
2325
COPY_TOOL=gcp
2426

@@ -32,47 +34,17 @@
3234
pre-script = """
3335
env
3436
set -x
37+
module load hsm/1.3.0
3538
module load gcp
39+
# needed only for list_ncvars.
40+
module load fre-nctools/2024.05.01
3641
mkdir -p $work $tempCache $refineDiagDir
3742
hsmget -v -t -a $histDir -p {{ PTMP_DIR }}/$histDir -w $work $hsmdate/\*
3843
cd $work/$hsmdate
3944
ls
4045
"""
4146
{% endif %}
4247

43-
{% if DO_REFINEDIAG %}
44-
[[REFINE-DIAG]]
45-
post-script = """
46-
cd $refineDiagDir
47-
if ls *nc; then
48-
refinedCount=$(ls -1 *nc | wc -l)
49-
else
50-
refinedCount=0
51-
fi
52-
if [[ $refinedCount > 0 ]]; then
53-
for file in $(ls -1 *nc); do
54-
list_ncvars.csh -st01234 $file |& tee $CYLC_WORKFLOW_SHARE_DIR/refineDiag.log
55-
done
56-
else
57-
echo ERROR: RefineDiag script did not create any NetCDF files as it was expected to do
58-
exit 1
59-
fi
60-
if [[ -f {{ HISTORY_DIR_REFINED }}/$oname.nc.tar ]]; then
61-
echo "the contents of {{ PTMP_DIR }}/{{ HISTORY_DIR_REFINED }} is..."
62-
ls {{ PTMP_DIR }}/{{ HISTORY_DIR_REFINED }}
63-
echo "the contents of {{ PTMP_DIR }}/{{ HISTORY_DIR_REFINED }}/$oname.nc is..."
64-
ls {{ PTMP_DIR }}/{{ HISTORY_DIR_REFINED }}/$oname.nc
65-
hsmget -v -t -a {{ HISTORY_DIR_REFINED }} -p {{ PTMP_DIR }}/{{ HISTORY_DIR_REFINED }} \
66-
-w $TMPDIR/modify_refineDiag $hsmdate/\*
67-
mv -f * $TMPDIR/modify_refineDiag
68-
mv -f $TMPDIR/modify_refineDiag/* .
69-
rm -rf $TMPDIR/modify_refineDiag
70-
fi
71-
hsmput -v -t -s tar -a {{ HISTORY_DIR_REFINED }} -p {{ PTMP_DIR }}/{{ HISTORY_DIR_REFINED }} \
72-
-w $TMPDIR/history_refineDiag $hsmdate
73-
"""
74-
{% endif %}
75-
7648
[[MAKE-TIMEAVGS]]
7749
pre-script = module load cdo
7850

site/ppan_test.cylc

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -103,35 +103,6 @@
103103
script_name:$CYLC_TASK_NAME;exp_run_uuid:$CYLC_WORKFLOW_UUID"
104104
{{ EPMT_POSTAMBLE }}
105105
"""
106-
post-script = """
107-
cd $refineDiagDir
108-
if ls *nc; then
109-
refinedCount=$(ls -1 *nc | wc -l)
110-
else
111-
refinedCount=0
112-
fi
113-
if [[ $refinedCount > 0 ]]; then
114-
for file in $(ls -1 *nc); do
115-
list_ncvars.csh -st01234 $file |& tee $CYLC_WORKFLOW_SHARE_DIR/refineDiag.log
116-
done
117-
else
118-
echo ERROR: RefineDiag script did not create any NetCDF files as it was expected to do
119-
exit 1
120-
fi
121-
if [[ -f {{ HISTORY_DIR_REFINED }}/$oname.nc.tar ]]; then
122-
echo "the contents of {{ PTMP_DIR }}/{{ HISTORY_DIR_REFINED }} is..."
123-
ls {{ PTMP_DIR }}/{{ HISTORY_DIR_REFINED }}
124-
echo "the contents of {{ PTMP_DIR }}/{{ HISTORY_DIR_REFINED }}/$oname.nc is..."
125-
ls {{ PTMP_DIR }}/{{ HISTORY_DIR_REFINED }}/$oname.nc
126-
hsmget -v -t -a {{ HISTORY_DIR_REFINED }} -p {{ PTMP_DIR }}/{{ HISTORY_DIR_REFINED }} \
127-
-w $TMPDIR/modify_refineDiag $hsmdate/\*
128-
mv -f * $TMPDIR/modify_refineDiag
129-
mv -f $TMPDIR/modify_refineDiag/* .
130-
rm -rf $TMPDIR/modify_refineDiag
131-
fi
132-
hsmput -v -t -s tar -a {{ HISTORY_DIR_REFINED }} -p {{ PTMP_DIR }}/{{ HISTORY_DIR_REFINED }} \
133-
-w $TMPDIR/history_refineDiag $hsmdate
134-
"""
135106
{% endif %}
136107

137108
[[DATA-CATALOG]]

0 commit comments

Comments
 (0)