Skip to content

Commit 16bdeab

Browse files
authored
Add the suite file and task shell for running a forecast of GEOS (#150)
Co-authored-by: danholdaway <danholdaway@users.noreply.github.com>
1 parent 003c9af commit 16bdeab

File tree

13 files changed

+388
-11
lines changed

13 files changed

+388
-11
lines changed

src/swell/deployment/prep_suite.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,31 @@ def prepare_cylc_suite_jinja2(logger, swell_suite_path, exp_suite_path, experime
5656
render_dictionary['scheduling']['RunJediHofxExecutable']['execution_time_limit'] = 'PT2H'
5757
render_dictionary['scheduling']['RunJediHofxExecutable']['account'] = 'g0613'
5858
render_dictionary['scheduling']['RunJediHofxExecutable']['qos'] = 'allnccs'
59-
render_dictionary['scheduling']['RunJediHofxExecutable']['constraint'] = 'hasw'
6059
render_dictionary['scheduling']['RunJediHofxExecutable']['nodes'] = 1
6160
render_dictionary['scheduling']['RunJediHofxExecutable']['ntasks_per_node'] = 24
6261

62+
render_dictionary['scheduling'] = {}
63+
render_dictionary['scheduling']['RunGeosExecutable'] = {}
64+
render_dictionary['scheduling']['RunGeosExecutable']['execution_time_limit'] = 'PT2H'
65+
render_dictionary['scheduling']['RunGeosExecutable']['account'] = 'g0613'
66+
render_dictionary['scheduling']['RunGeosExecutable']['qos'] = 'allnccs'
67+
render_dictionary['scheduling']['RunGeosExecutable']['nodes'] = 1
68+
render_dictionary['scheduling']['RunGeosExecutable']['ntasks_per_node'] = 24
69+
6370
render_dictionary['scheduling']['BuildJedi'] = {}
6471
render_dictionary['scheduling']['BuildJedi']['execution_time_limit'] = 'PT4H'
6572
render_dictionary['scheduling']['BuildJedi']['account'] = 'g0613'
6673
render_dictionary['scheduling']['BuildJedi']['qos'] = 'allnccs'
67-
render_dictionary['scheduling']['BuildJedi']['constraint'] = 'hasw'
6874
render_dictionary['scheduling']['BuildJedi']['nodes'] = 1
6975
render_dictionary['scheduling']['BuildJedi']['ntasks_per_node'] = 24
7076

77+
render_dictionary['scheduling']['BuildGeos'] = {}
78+
render_dictionary['scheduling']['BuildGeos']['execution_time_limit'] = 'PT1H'
79+
render_dictionary['scheduling']['BuildGeos']['account'] = 'g0613'
80+
render_dictionary['scheduling']['BuildGeos']['qos'] = 'allnccs'
81+
render_dictionary['scheduling']['BuildGeos']['nodes'] = 1
82+
render_dictionary['scheduling']['BuildGeos']['ntasks_per_node'] = 24
83+
7184
# Render the template
7285
# -------------------
7386
new_suite_file = template_string_jinja2(logger, suite_file, render_dictionary)
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# (C) Copyright 2021-2022 United States Government as represented by the Administrator of the
2+
# National Aeronautics and Space Administration. All Rights Reserved.
3+
#
4+
# This software is licensed under the terms of the Apache Licence Version 2.0
5+
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6+
7+
# --------------------------------------------------------------------------------------------------
8+
9+
# Cylc suite for executing Geos forecast
10+
11+
# --------------------------------------------------------------------------------------------------
12+
13+
[scheduler]
14+
UTC mode = True
15+
allow implicit tasks = False
16+
17+
# --------------------------------------------------------------------------------------------------
18+
19+
[scheduling]
20+
21+
initial cycle point = {{start_cycle_point}}
22+
final cycle point = {{final_cycle_point}}
23+
runahead limit = {{runahead_limit}}
24+
25+
[[graph]]
26+
R1 = """
27+
# Triggers for non cycle time dependent tasks
28+
# -------------------------------------------
29+
# Clone Geos source code
30+
CloneGeos
31+
32+
# Build Geos source code by linking
33+
CloneGeos => BuildGeosByLinking?
34+
35+
# If not able to link to build create the build
36+
BuildGeosByLinking:fail? => BuildGeos
37+
"""
38+
39+
{% for cycle_time in cycle_times %}
40+
{{cycle_time.cycle_time}} = """
41+
{% for model_component in model_components %}
42+
# Task triggers for: {{model_component}}
43+
# ------------------
44+
# Get background
45+
GetRestart-{{model_component}}
46+
47+
# Run Geos hofx executable
48+
BuildGeosByLinking[^]? | BuildGeos[^] => PrepGeosRunDir
49+
GetRestart-{{model_component}} => PrepGeosRunDir
50+
51+
# Run Geos Executable
52+
PrepGeosRunDir => RunGeosExecutable
53+
54+
# Save restart
55+
RunGeosExecutable => SaveRestart-{{model_component}}
56+
{% endfor %}
57+
"""
58+
{% endfor %}
59+
60+
# --------------------------------------------------------------------------------------------------
61+
62+
[runtime]
63+
64+
# Task defaults
65+
# -------------
66+
[[root]]
67+
pre-script = "source $CYLC_SUITE_DEF_PATH/modules"
68+
69+
[[[environment]]]
70+
datetime = $CYLC_TASK_CYCLE_POINT
71+
config = $CYLC_SUITE_DEF_PATH/experiment.yaml
72+
73+
# Tasks
74+
# -----
75+
[[CloneGeos]]
76+
script = "swell_task CloneGeos $config"
77+
78+
[[BuildGeosByLinking]]
79+
script = "swell_task BuildGeosByLinking $config"
80+
81+
[[BuildGeos]]
82+
script = "swell_task BuildGeos $config"
83+
platform = {{platform}}
84+
execution time limit = {{scheduling["BuildGeos"]["execution_time_limit"]}}
85+
[[[directives]]]
86+
--account = {{scheduling["BuildGeos"]["account"]}}
87+
--qos = {{scheduling["BuildGeos"]["qos"]}}
88+
--job-name = BuildGeos
89+
--nodes={{scheduling["BuildGeos"]["nodes"]}}
90+
--ntasks-per-node={{scheduling["BuildGeos"]["ntasks_per_node"]}}
91+
92+
[[PrepGeosRunDir]]
93+
script = "swell_task PrepGeosRunDir $config"
94+
95+
{% for model_component in model_components %}
96+
[[GetRestart-{{model_component}}]]
97+
script = "swell_task GetRestart $config -d $datetime -m {{model_component}}"
98+
99+
[[SaveRestart-{{model_component}}]]
100+
script = "swell_task SaveRestart $config -d $datetime -m {{model_component}}"
101+
{% endfor %}
102+
103+
[[RunGeosExecutable]]
104+
script = "swell_task RunGeosExecutable $config -d $datetime"
105+
platform = {{platform}}
106+
execution time limit = {{scheduling["RunGeosExecutable"]["execution_time_limit"]}}
107+
[[[directives]]]
108+
--account = {{scheduling["RunGeosExecutable"]["account"]}}
109+
--qos = {{scheduling["RunGeosExecutable"]["qos"]}}
110+
--job-name = RunGeosExecutable
111+
--nodes={{scheduling["RunGeosExecutable"]["nodes"]}}
112+
--ntasks-per-node={{scheduling["RunGeosExecutable"]["ntasks_per_node"]}}
113+
114+
# --------------------------------------------------------------------------------------------------
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Cycle frequency
2+
cycle_times:
3+
default_value: ['T00', 'T06', 'T12', 'T18']
4+
prompt: List all cycle times, by middle of the window?
5+
options: ['T00', 'T06', 'T12', 'T18']
6+
type: string-check-list
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Cycle frequency
2+
cycle_times:
3+
default_value: ['T00', 'T06', 'T12', 'T18']
4+
prompt: List all cycle times, by middle of the window?
5+
options: ['T00', 'T06', 'T12', 'T18']
6+
type: string-check-list
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Cycle start point
2+
start_cycle_point:
3+
default_value: '2020-12-15T00:00:00Z'
4+
prompt: What is the time of the first cycle (middle of the window)?
5+
type: iso-datetime
6+
7+
# Cycle final point
8+
final_cycle_point:
9+
default_value: '2020-12-15T06:00:00Z'
10+
prompt: What is the time of the final cycle (middle of the window)?
11+
type: iso-datetime
12+
13+
# Run ahead limit for workflow
14+
runahead_limit:
15+
default_value: 'P4'
16+
prompt: Since this suite is non-cycling choose how many hours the workflow can run ahead?
17+
type: string
18+
19+
# Geos build system
20+
geos_build_method:
21+
default_value: use_existing
22+
prompt: Create a new GEOS build or use an existing build?
23+
options: ['create', 'use_existing']
24+
type: string-drop-list
25+
26+
# Existing Geos bundle directory
27+
existing_source_directory:
28+
default_value: {{existing_source_directory}}
29+
prompt: Provide the path to an existing GEOS bundle directory containing source code repos
30+
type: string
31+
depends:
32+
key: geos_build_method
33+
value: use_existing
34+
35+
# Existing GEOS build
36+
existing_build_directory:
37+
default_value: {{existing_build_directory}}
38+
prompt: Provide the path to an existing GEOS build directory
39+
type: string
40+
depends:
41+
key: geos_build_method
42+
value: use_existing
43+
44+
# R2D2 Configuration
45+
r2d2_local_path:
46+
default_value: {{r2d2_local_path}}
47+
prompt: Enter the path where R2D2 will store experiment output
48+
type: string
49+
50+
# What kind of coupling is needed
51+
model_coupling_style:
52+
default_value: uncoupled
53+
prompt: What kind of coupling would you like to run with?
54+
options: ['uncoupled', 'coupled']
55+
type: string-drop-list
56+
57+
# Models to use
58+
model_components:
59+
default_value: ['geos_atmosphere', 'geos_ocean']
60+
prompt: Select models to use (choose at least one)
61+
options: use_method
62+
type: file-check-list
63+
Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
1-
# (C) Copyright 2021-2022 United States Government as represented by the Administrator of the
1+
# (C) Copyright 2021-2023 United States Government as represented by the Administrator of the
22
# National Aeronautics and Space Administration. All Rights Reserved.
33
#
44
# This software is licensed under the terms of the Apache Licence Version 2.0
55
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
66

77
valid_tasks = [
8-
'StageJedi',
9-
'GetObservations',
10-
'BuildJedi',
8+
'BuildGeosByLinking',
9+
'BuildGeos',
1110
'BuildJediByLinking',
11+
'BuildJedi',
12+
'CleanCycle',
13+
'CloneGeos',
1214
'CloneJedi',
13-
'GetBackground',
14-
'RunJediHofxExecutable',
1515
'EvaDriver',
1616
'GetBackgroundGeosExperiment',
17-
'StoreBackground',
18-
'CleanCycle',
19-
'SaveObsDiags',
17+
'GetBackground',
18+
'GetObservations',
19+
'GetRestart',
2020
'ObsProcessSetup',
21+
'PrepGeosRunDir',
22+
'RunGeosExecutable',
23+
'RunJediHofxExecutable',
24+
'SaveObsDiags',
25+
'SaveRestart',
26+
'StageJedi',
27+
'StoreBackground',
2128
]

src/swell/tasks/build_geos.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# (C) Copyright 2023 United States Government as represented by the Administrator of the
2+
# National Aeronautics and Space Administration. All Rights Reserved.
3+
#
4+
# This software is licensed under the terms of the Apache Licence Version 2.0
5+
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6+
7+
8+
# --------------------------------------------------------------------------------------------------
9+
10+
11+
from swell.tasks.base.task_base import taskBase
12+
13+
14+
# --------------------------------------------------------------------------------------------------
15+
16+
17+
class BuildGeos(taskBase):
18+
19+
def execute(self):
20+
21+
self.logger.info('BuildGeos')
22+
23+
24+
# --------------------------------------------------------------------------------------------------
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# (C) Copyright 2023 United States Government as represented by the Administrator of the
2+
# National Aeronautics and Space Administration. All Rights Reserved.
3+
#
4+
# This software is licensed under the terms of the Apache Licence Version 2.0
5+
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6+
7+
8+
# --------------------------------------------------------------------------------------------------
9+
10+
11+
from swell.tasks.base.task_base import taskBase
12+
13+
14+
# --------------------------------------------------------------------------------------------------
15+
16+
17+
class BuildGeosByLinking(taskBase):
18+
19+
def execute(self):
20+
21+
self.logger.info('BuildGeosByLinking')
22+
23+
24+
# --------------------------------------------------------------------------------------------------

src/swell/tasks/clone_geos.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# (C) Copyright 2023 United States Government as represented by the Administrator of the
2+
# National Aeronautics and Space Administration. All Rights Reserved.
3+
#
4+
# This software is licensed under the terms of the Apache Licence Version 2.0
5+
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6+
7+
8+
# --------------------------------------------------------------------------------------------------
9+
10+
11+
from swell.tasks.base.task_base import taskBase
12+
13+
14+
# --------------------------------------------------------------------------------------------------
15+
16+
17+
class CloneGeos(taskBase):
18+
19+
def execute(self):
20+
21+
self.logger.info('CloneGeos')
22+
23+
24+
# --------------------------------------------------------------------------------------------------

src/swell/tasks/get_restart.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# (C) Copyright 2023 United States Government as represented by the Administrator of the
2+
# National Aeronautics and Space Administration. All Rights Reserved.
3+
#
4+
# This software is licensed under the terms of the Apache Licence Version 2.0
5+
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6+
7+
8+
# --------------------------------------------------------------------------------------------------
9+
10+
11+
from swell.tasks.base.task_base import taskBase
12+
13+
14+
# --------------------------------------------------------------------------------------------------
15+
16+
17+
class GetRestart(taskBase):
18+
19+
def execute(self):
20+
21+
self.logger.info('GetRestart')
22+
23+
24+
# --------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)