Skip to content

Commit e551971

Browse files
wxtimoliver-sandersMetRonnie
authored
Fix additional tutorials (#388)
* Updated clock-triggered-tasks tutorial * fix cylc broadcast torial * fixed up family triggers tutorial * Inheritance tutorial * updated queues tutorial * updated retries * updated message triggeres tutorial * add cylc validate prior to all instances of cylc install * fixed flow.cylc indentation * Apply suggestions from code review Co-authored-by: Oliver Sanders <[email protected]> Co-authored-by: Ronnie Dutta <[email protected]> * refactor refs to GUI/TUI * Apply suggestions from code review Co-authored-by: Ronnie Dutta <[email protected]> *Ensure user has a UI running before playing a workflow which might otherwise run too fast to see. * Update src/tutorial/furthertopics/clock-triggered-tasks.rst Co-authored-by: Ronnie Dutta <[email protected]> Co-authored-by: Oliver Sanders <[email protected]>
1 parent db15507 commit e551971

File tree

10 files changed

+129
-104
lines changed

10 files changed

+129
-104
lines changed

src/7-to-8/summary.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ Cylc Install
330330

331331
.. seealso::
332332

333-
:ref:`Moving to Cylc Install<majorchangesinstall>`.
333+
* :ref:`Moving to Cylc Install<majorchangesinstall>`.
334334

335335

336336
Cylc install cleanly separates workflow source directory from run directory,

src/tutorial/furthertopics/broadcast.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ runs on.
2020
Standalone Example
2121
------------------
2222

23-
Create a new workflow in the ``cylc-run`` directory called
23+
Create a new workflow in the ``cylc-src`` directory called
2424
``tutorial-broadcast``::
2525

26-
mkdir ~/cylc-run/tutorial-broadcast
27-
cd ~/cylc-run/tutorial-broadcast
26+
mkdir ~/cylc-src/tutorial-broadcast
27+
cd ~/cylc-src/tutorial-broadcast
2828

2929
Copy the following configuration into a :cylc:conf:`flow.cylc` file:
3030

@@ -69,6 +69,8 @@ whilst the workflow is running. For instance we could change the value of the
6969
Run the workflow then try using the ``cylc broadcast`` command to change the
7070
message::
7171

72+
cylc validate .
73+
cylc install
7274
cylc play tutorial-broadcast
7375
cylc broadcast tutorial-broadcast -n announce -s "[environment]WORD=it"
7476

@@ -118,7 +120,8 @@ Add the following runtime configuration to the ``runtime`` section:
118120
[[[environment]]]
119121
WORDS = ni, it, ekke ekke ptang zoo boing
120122
121-
Run the workflow and inspect the log. You should see the message change randomly
123+
Re-install and run the workflow, and inspect the log.
124+
You should see the message change randomly
122125
after every third entry (because the ``change_word`` task runs every 3 hours)
123126
e.g::
124127

src/tutorial/furthertopics/clock-triggered-tasks.rst

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ Example
3838

3939
Our example workflow will simulate a clock chiming on the hour.
4040

41-
Within your ``~/cylc-run`` directory create a new directory called
41+
Within your ``~/cylc-src`` directory create a new directory called
4242
``clock-trigger``::
4343

44-
mkdir ~/cylc-run/clock-trigger
45-
cd ~/cylc-run/clock-trigger
44+
mkdir ~/cylc-src/clock-trigger
45+
cd ~/cylc-src/clock-trigger
4646

4747
Paste the following code into a ``flow.cylc`` file:
4848

@@ -72,15 +72,14 @@ of times equal to the (cycle point) hour.
7272

7373
Run your workflow using::
7474

75+
cylc validate .
76+
cylc install
7577
cylc play clock-trigger
7678

7779
Stop the workflow after a few cycles using ``cylc stop --now --now clock-trigger``.
7880
Notice how the tasks run as soon as possible rather than
7981
waiting for the actual time to be equal to the cycle point.
8082

81-
.. TODO - check this tutorial still works now that cylc run/restart has been
82-
replaced by cylc play
83-
8483

8584
Clock-Triggering Tasks
8685
----------------------
@@ -98,7 +97,7 @@ your ``flow.cylc``:
9897
This tells the workflow to clock trigger the ``bell`` task with a cycle
9998
offset of ``0`` hours.
10099

101-
Save your changes and run your workflow.
100+
Save your changes, install and run your workflow.
102101

103102
Your workflow should now be running the ``bell`` task in real-time. Any cycle times
104103
that have already passed (such as the one defined by ``initial cycle time``)
@@ -133,6 +132,8 @@ Edit the ``[[scheduling]]`` section to read:
133132

134133
.. code-block:: cylc
135134
135+
initial cycle point = now
136+
final cycle point = +P1D # Run for one day
136137
[[xtriggers]]
137138
quarter_past_trigger = wall_clock(offset=PT15M):PT30S
138139
half_past_trigger = wall_clock(offset=PT30M):PT30S
@@ -147,19 +148,21 @@ Edit the ``[[scheduling]]`` section to read:
147148
148149
Note the different values used for the cycle offsets of the clock-trigger tasks.
149150

150-
Save your changes and run your workflow using::
151+
Save your changes, install and run your workflow using::
151152

152-
cylc play clock-trigger now
153+
cylc validate .
154+
cylc install
155+
cylc play clock-trigger
153156

154157
.. note::
155158

156-
The ``now`` argument will run your workflow using the current time for the
157-
initial cycle point.
159+
Setting ``initial cycle point = now`` will run your workflow using the
160+
current time at startup as the initial cycle point.
158161

159162
Again, notice how the tasks trigger until the current time is reached.
160163

161164
Leave your workflow running for a while to confirm it is working as expected
162-
and then shut it down using the :guilabel:`stop` button in the ``cylc gui``.
165+
before stopping it.
163166

164167

165168
.. note::

src/tutorial/furthertopics/family-triggers.rst

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,20 @@ that the dependency refers to the ``succeed`` state e.g:
2121

2222
.. code-block:: cylc-graph
2323
24-
bake_bread => sell_bread # sell_bread is dependent on bake_bread succeeding.
25-
bake_bread:succeed => sell_bread # sell_bread is dependent on bake_bread succeeding.
26-
sell_bread:fail => through_away # through_away is dependent on sell_bread failing.
24+
bake_bread => sell_bread # sell_bread is dependent on bake_bread succeeding.
25+
bake_bread:succeed => sell_bread? # sell_bread is dependent on bake_bread succeeding.
26+
sell_bread:fail? => throw_away # throw_away is dependent on sell_bread failing.
2727
2828
The left-hand side of a :term:`dependency` (e.g. ``sell_bread:fail``) is
2929
referred to as the :term:`trigger <task trigger>`.
3030

31+
.. note::
32+
33+
``sell_bread(:succeed)`` and ``sell_bread:fail`` are mutually exclusive
34+
outcomes. As both appear in the graph above, it is
35+
necessary to use the ``?`` syntax to mark them as
36+
:ref:`optional outputs`.
37+
3138
When we write a trigger involving a family, special qualifiers are required
3239
to specify whether the dependency is concerned with *all* or *any* of the tasks
3340
in that family reaching the desired :term:`state <task state>` e.g:
@@ -45,8 +52,8 @@ Example
4552

4653
Create a new workflow called ``tutorial-family-triggers``::
4754

48-
mkdir ~/cylc-run/tutorial-family-triggers
49-
cd ~/cylc-run/tutorial-family-triggers
55+
mkdir ~/cylc-src/tutorial-family-triggers
56+
cd ~/cylc-src/tutorial-family-triggers
5057

5158
Paste the following configuration into the :cylc:conf:`flow.cylc` file:
5259

@@ -81,8 +88,10 @@ You have now created a workflow that:
8188
or fails.
8289
* Has 7 tasks that inherit from the ``MINERS`` family.
8390

84-
Run the workflow::
91+
Validate, install and run the workflow::
8592

93+
cylc validate .
94+
cylc install
8695
cylc play tutorial-family-triggers
8796

8897
You should see the ``visit_mine`` task run, then trigger the members of the
@@ -113,8 +122,8 @@ this:
113122
114123
[[graph]]
115124
R1 = """
116-
visit_mine => MINERS
117-
MINERS:finish-all & MINERS:succeed-any => sell_diamonds
125+
visit_mine => MINERS?
126+
MINERS:finish-all & MINERS:succeed-any? => sell_diamonds
118127
"""
119128
120129
Then, add the following task to the ``[runtime]`` section:
@@ -131,6 +140,10 @@ Save your changes and run your workflow. You should see the new
131140
``sell_diamonds`` task being run once all the miners have finished and at
132141
least one of them has succeeded. Stop your workflow as described above.
133142

143+
.. seealso::
144+
145+
User guide on
146+
:ref:`family triggers and optional outputs<optional outputs.family triggers>`.
134147

135148
Family Triggering: Failure
136149
--------------------------
@@ -149,10 +162,9 @@ this:
149162
150163
[[graph]]
151164
R1 = """
152-
visit_mine => MINERS
153-
MINERS:finish-all & MINERS:succeed-any => sell_diamonds
154-
MINERS:finish-all & MINERS:fail-any => close_shafts
155-
close_shafts => !MINERS
165+
visit_mine => MINERS?
166+
MINERS:finish-all & MINERS:succeed-any? => sell_diamonds
167+
MINERS:finish-all & MINERS:fail-any? => close_shafts
156168
"""
157169
158170
Alter the ``[[sell_diamonds]]`` section to look like this:
@@ -163,7 +175,7 @@ Alter the ``[[sell_diamonds]]`` section to look like this:
163175
script = sleep 5
164176
165177
These changes add a ``close_shafts`` task which is run once all the
166-
``MINERS`` tasks have finished and any of them have failed.
178+
``MINERS`` tasks have finished and any of them have failed.
167179

168180
Save your changes and run your workflow. You should see the new
169181
``close_shafts`` run should any of the ``MINERS`` tasks be in the failed

src/tutorial/furthertopics/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _tutorials.furthertopics:
2+
13
Further Topics
24
==============
35

src/tutorial/furthertopics/inheritance.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ multiple inheritance.
1313
Inheritance Hierarchy
1414
---------------------
1515

16-
Within your ``~/cylc-run`` directory create a new directory called
16+
Within your ``~/cylc-src`` directory create a new directory called
1717
``inheritance-tutorial``::
1818

19-
mkdir ~/cylc-run/inheritance-tutorial
20-
cd ~/cylc-run/inheritance-tutorial
19+
mkdir ~/cylc-src/inheritance-tutorial
20+
cd ~/cylc-src/inheritance-tutorial
2121

2222
And paste the following code into a ``flow.cylc`` file. This
2323
defines two tasks each representing different aircraft, the Airbus A380 jumbo
@@ -74,7 +74,7 @@ jet and the Robson R44 helicopter:
7474
The ``[meta]`` section is a freeform section where we can define metadata
7575
to be associated with a task, family or the workflow itself.
7676

77-
This metadata should not be mistaken with Rose :ref:`conf-meta`.
77+
This metadata should not be mistaken for Rose :ref:`conf-meta`.
7878

7979
.. admonition:: Reminder
8080
:class: hint
@@ -183,7 +183,7 @@ Add the following task to your :cylc:conf:`flow.cylc` file.
183183
[[[meta]]]
184184
title = V-22 Osprey Military Aircraft.
185185
186-
Refresh your ``cylc graph`` window or re-run the ``cylc graph`` command.
186+
Re-run the ``cylc graph`` command.
187187

188188
The inheritance hierarchy should now look like this:
189189

0 commit comments

Comments
 (0)