Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assorted tutorial fixes against Cylc 8 #4869

Merged
merged 10 commits into from
Jun 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions cylc/flow/etc/tutorial/consolidation-tutorial/flow.cylc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!jinja2
[scheduler]
UTC mode = True

Expand Down Expand Up @@ -100,3 +101,5 @@
RESOLUTION = 0.2
# The area to generate forecasts for (lng1, lat1, lng2, lat2)
DOMAIN = -12,48,5,61 # Do not change!

{% include 'etc/python-job.settings' %}
wxtim marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ def get_wind_fields():
data.sort(key=lambda x: x[1])

# Convert data into (lat, lng, (wind_x, wind_y)) components.
x_coords = [datum[0] for datum in data]
y_coords = [datum[1] for datum in data]
x_coords = [datum[1] for datum in data]
y_coords = [datum[0] for datum in data]
Comment on lines -84 to +85
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better now

wind

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to add a map layer but couldn't find a nice way of doing it without adding another dependency. No thanks.

z_coords = [(datum[3] * math.sin(math.radians(datum[2])),
datum[3] * math.cos(math.radians(datum[2])))
for datum in data]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# WARNING: This file contains an anti-pattern
# which should normally be avoided, but is necessary
# to allow the tutorial workflows to work out-of-the-box.

[runtime]
[[root]]
[[[environment]]]
# These environment variables ensure that tasks can
# run in the same environment as the workflow:
{% from "sys" import path, executable %}
PYTHONPATH = {{':'.join(path)}}
PATH = $(dirname {{executable}}):$PATH
3 changes: 3 additions & 0 deletions cylc/flow/etc/tutorial/cylc-forecasting-workflow/flow.cylc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!jinja2
[scheduler]
UTC mode = True
[task parameters]
Expand Down Expand Up @@ -91,3 +92,5 @@
[[post_process<site>]]
# Generate a forecast for the location <site> 60 minutes in the future.
script = post-process $CYLC_TASK_PARAM_site 60

{% include 'etc/python-job.settings' %}
3 changes: 2 additions & 1 deletion cylc/flow/etc/tutorial/runtime-introduction/.validate
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

set -eux
FLOW_NAME="$(< /dev/urandom tr -dc A-Za-z | head -c6)"
cylc install --workflow-name "$FLOW_NAME" --no-run-name
SRC=$(cylc get-resources tutorial 2>&1 | head -n1 | awk '{print $NF}')
cylc install "${SRC}/runtime-introduction" --workflow-name "$FLOW_NAME" --no-run-name
Comment on lines -20 to +21
Copy link
Member

@MetRonnie MetRonnie Jun 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a thought for consistency, instead of doing this here, how about making run-validate-tutorials do

+SRC=$(cylc get-resources tutorial 2>&1 | head -n1 | awk '{print $NF}')
+cd "$SRC"
-for FILE in $(echo ../../cylc/flow/etc/tutorial/*/.validate) ; do
+for FILE in $(echo */.validate) ; do

cylc validate --check-circular --icp=2000 "$FLOW_NAME"
cylc play --no-detach --abort-if-any-task-fails "$FLOW_NAME"
cylc clean "$FLOW_NAME"
3 changes: 3 additions & 0 deletions cylc/flow/etc/tutorial/runtime-introduction/flow.cylc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!jinja2
[scheduler]
UTC mode = True
[scheduling]
Expand Down Expand Up @@ -50,3 +51,5 @@
print(choice(['Windy', 'Rainy', 'Sunny', 'Snowy']))
"
"""

{% include 'etc/python-job.settings' %}
3 changes: 3 additions & 0 deletions cylc/flow/etc/tutorial/runtime-tutorial/flow.cylc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!jinja2
[scheduler]
UTC mode = True

Expand Down Expand Up @@ -41,3 +42,5 @@
[[forecast]]
[[get_rainfall]]
[[post_process_exeter]]

{% include 'etc/python-job.settings' %}