-
Notifications
You must be signed in to change notification settings - Fork 5
/
flow.cylc
187 lines (159 loc) · 6.33 KB
/
flow.cylc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#!jinja2
[meta]
title = CSET
description = Workflow for running CSET.
URL = https://metoffice.github.io/CSET
# Import all of our Jinja utilities for use in the workflow.
{% from "jinja_utils" import get_models, glob, max, min, zip, restructure_field_list, sanitise_task_name %}
# Load a list a model detail dictionaries.
{% set models = get_models(ROSE_SUITE_VARIABLES) %}
[scheduling]
# There is rarely a reason to manually set the runahead limit, as we will
# usually be limited by number of concurrent jobs.
{% if CSET_RUNAHEAD_LIMIT|default(False) %}
runahead limit = P{{CSET_RUNAHEAD_LIMIT}}
{% endif %}
# Initial and final cycle points cover the entire period of interest.
{% if CSET_CYCLING_MODE == "case_study" %}
initial cycle point = {{ min(CSET_CASE_DATES) }}
final cycle point = {{ max(CSET_CASE_DATES) }}
{% elif CSET_CYCLING_MODE == "trial" %}
initial cycle point = {{CSET_TRIAL_START_DATE}}
# End date can be blank.
{% if CSET_TRIAL_END_DATE|default(False) %}
final cycle point = {{CSET_TRIAL_END_DATE}}
{% endif %}
{% endif %}
[[graph]]
# Only runs on the first cycle.
R1/^ = """
build_conda => install_website_skeleton => setup_complete
"""
{% if CSET_CYCLING_MODE == "case_study" %}
# Runs for every forecast initiation time to process the data in parallel.
{% for date in CSET_CASE_DATES %}
R1/{{date}} = """
setup_complete[^] => FETCH_DATA:succeed-all => fetch_complete
fetch_complete => PROCESS:finish-all => housekeeping_raw
"""
{% endfor %}
{% elif CSET_CYCLING_MODE == "trial" %}
# Analyse from each forecast.
{{CSET_TRIAL_CYCLE_PERIOD}} = """
setup_complete[^] => FETCH_DATA:succeed-all => fetch_complete
fetch_complete => PROCESS:finish-all => housekeeping_raw
"""
{% endif %}
# Can only run tasks on final cycle point if it exists, so skip for
# continuous trials.
{% if CSET_CYCLING_MODE != "trial" or CSET_TRIAL_END_DATE|default(False) %}
# Only runs on the final cycle.
R1/$ = """
housekeeping_raw => finish_website => send_email
housekeeping_raw => housekeeping_full
"""
{% endif %}
[runtime]
[[root]]
script = rose task-run -v
execution time limit = PT15M
[[[environment]]]
# As these variables are used in the environment script, they must be
# defined.
CSET_ENV_USE_MODULES = {{CSET_ENV_USE_MODULES|default(False)}}
{% if CSET_ENV_USE_MODULES|default(False) %}
MODULES_LIST = {{MODULES_LIST}}
MODULES_PURGE = {{MODULES_PURGE}}
{% endif %}
CSET_ENV_USE_CONDA = {{CSET_ENV_USE_CONDA|default(False)}}
{% if CSET_ENV_USE_CONDA|default(False) %}
CONDA_PATH = {{CONDA_PATH}}
CONDA_VENV_LOCATION = {{CONDA_VENV_LOCATION}}
{% endif %}
CSET_ENV_SEPARATE_MET = {{CSET_ENV_SEPARATE_MET|default(False)}}
{% if CSET_ENV_SEPARATE_MET|default(False) %}
CONDA_METPLUS_VENV_LOCATION = {{CONDA_METPLUS_VENV_LOCATION}}
MET_INSTALL_DIR = {{MET_INSTALL_DIR}}
MET_BUILD_BASE = {{MET_BUILD_BASE}}
METPLUS_BASE = {{METPLUS_BASE}}
MET_LIBRARIES = {{MET_LIBRARIES}}
{% endif %}
LOGLEVEL = {{LOGLEVEL}}
COLORBAR_FILE = {{COLORBAR_FILE}}
PLOT_RESOLUTION = {{PLOT_RESOLUTION|default(100)}}
[[PROCESS]]
script = rose task-run -v --app-key=run_cset_recipe
execution time limit = PT1H
[[FETCH_DATA]]
script = rose task-run -v --app-key=fetch_fcst
execution time limit = PT1H
[[[environment]]]
CSET_ANALYSIS_OFFSET = {{CSET_ANALYSIS_OFFSET}}
CSET_ANALYSIS_PERIOD = {{CSET_ANALYSIS_PERIOD}}
[[METPLUS]]
[[[environment]]]
{% if METPLUS_GRID_STAT|default(False) %}
METPLUS_ANA_DIR = {{METPLUS_ANA_DIR}}
METPLUS_FCST_DIR = {{METPLUS_FCST_DIR}}
METPLUS_OBS_DIR = {{METPLUS_OBS_DIR}}
ROSE_APP_OPT_CONF_KEYS = {{METPLUS_OPT_CONFIG_KEYS}}
{% endif %}
[[DUMMY_TASK]]
script = true
platform = localhost
execution time limit = PT1M
[[setup_complete]]
inherit = DUMMY_TASK
[[fetch_complete]]
inherit = DUMMY_TASK
[[build_conda]]
# Create the conda environment if it does not yet exist, possibly installing
# CSET from source.
execution time limit = PT30M
[[[environment]]]
CONDA_VENV_CREATE = {{CONDA_VENV_CREATE}}
CSET_ENV_USE_LOCAL_CSET = {{CSET_ENV_USE_LOCAL_CSET|default(False) }}
{% if CSET_ENV_USE_LOCAL_CSET|default(False) %}
CSET_LOCAL_CSET_PATH = {{CSET_LOCAL_CSET_PATH}}
{% endif %}
[[install_website_skeleton]]
# Copies the static files that make up the web interface.
[[[environment]]]
WEB_DIR = {{WEB_DIR}}
{% for model in models %}
[[fetch_fcst_m{{model["number"]}}]]
# Fetch data from disk or a file based archival system.
inherit = FETCH_DATA
[[[environment]]]
MODEL_NUMBER = {{model["number"]}}
ROSE_APP_COMMAND_KEY = {{model["data_source"]}}
DATA_PATH = {{model["data_path"]}}
DATE_TYPE = {{model["date_type"]}}
{% if model["date_type"] != "initiation" %}
DATA_PERIOD = {{model["data_period"]}}
{% endif %}
{% endfor %}
[[housekeeping_raw]]
# Housekeep unprocessed data files.
script = rose task-run -v --app-key=housekeeping
[[[environment]]]
HOUSEKEEPING_MODE = {{[HOUSEKEEPING_MODE, 1]|min}}
[[housekeeping_full]]
# Housekeep processed intermediate files too.
script = rose task-run -v --app-key=housekeeping
[[[environment]]]
HOUSEKEEPING_MODE = {{[HOUSEKEEPING_MODE, 2]|min}}
[[finish_website]]
# Updates the workflow info in the web interface.
[[send_email]]
# Send email to notify that the workflow is complete.
platform = localhost
[[[environment]]]
WEB_ADDR = {{WEB_ADDR}}
WEB_DIR = {{WEB_DIR}}
# Include files bring their own graph and runtime sections.
{% for include_file in glob("includes/*.cylc") %}
{% include include_file %}
{% endfor %}
{# Site-specific details that add to (or override) the core suite definition #}
{% include 'site/' ~ SITE ~ '.cylc' %}