Skip to content

Commit cf5199f

Browse files
authored
Merge pull request #871 from oliver-sanders/broadcasts++
improve broadcast documentation
2 parents 90f136d + 4b47093 commit cf5199f

File tree

5 files changed

+146
-22
lines changed

5 files changed

+146
-22
lines changed

src/dictionaries/words

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ basename
1212
baz
1313
boolean
1414
booleans
15+
broadcasted
1516
cfg
1617
changelog
1718
changelogs

src/tutorial/furthertopics/broadcast.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,14 @@ e.g::
135135
Stop the workflow::
136136

137137
cylc stop tutorial-broadcast
138+
139+
140+
Further Reading
141+
---------------
142+
143+
The :ref:`cylc-broadcast` section in the user guide contains more detail
144+
on broadcasts.
145+
146+
The GUI contains an "Edit Runtime" utility which loads the task's configuration
147+
into a form. Any changes you make are then broadcasted to the task.
148+
See :ref:`interventions.edit-a-tasks-configuration`.
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
.. _cylc-broadcast:
2+
3+
Cylc Broadcast
4+
==============
5+
6+
Cylc "Broadcasts" allow us to override the :cylc:conf:`[runtime]` settings of tasks.
7+
8+
Broadcasts can target specific cycles, families or tasks.
9+
10+
Broadcasts can be helpful for:
11+
12+
* Quickly developing tasks without having to
13+
:ref:`edit and reload the workflow configuration <interventions.edit-the-workflow-configuration>`.
14+
* Sending small amounts of data from a running task to other upcoming tasks (e.g. file paths).
15+
* Reconfiguring production workflows while they are running.
16+
17+
Broadcasts which target specific cycles will eventually be
18+
:ref:`expired <user_guide.broadcast.expiry>` when no longer needed.
19+
20+
Otherwise, broadcasts last for the life of the workflow and will persist if
21+
the workflow is shutdown and restarted (unless manually "cleared").
22+
23+
.. seealso::
24+
25+
:ref:`broadcast-tutorial`
26+
27+
28+
Issuing Broadcasts
29+
------------------
30+
31+
CLI
32+
^^^
33+
34+
Some examples of issuing broadcasts using the ``cylc broacast`` CLI command:
35+
36+
.. code-block:: bash
37+
38+
# set or update the environment variable "ANSWER" for all tasks
39+
cylc broadcast myworkflow -s '[environment]ANSWER=42'
40+
41+
# amend the directives for all tasks in the cycle "2000"
42+
cylc broadcast myworkflow -p 2000 -s '[directives]--memory=2GB'
43+
44+
# change the platform all tasks in the family "FOO" will submit on
45+
cylc broadcast myworkflow -n FOO -s 'platform=my-hpc'
46+
47+
The ``cylc broadcast`` command can be run from within tasks as a means to
48+
communicate small amounts of data back to the scheduler for subsequent tasks to
49+
use. Note that this will not work for remote task platforms which have been
50+
configured to use polling -
51+
:cylc:conf:`global.cylc[platforms][<platform name>]communication method = poll`.
52+
53+
For more information, run ``cylc broadcast --help``.
54+
55+
56+
GUI
57+
^^^
58+
59+
Broadcasts can also be issued from the GUI in a similar way by choosing
60+
"Broadcast" from the task menu.
61+
62+
Additionally, the GUI provides a utility called "Edit Runtime" which loads
63+
the tasks configuration into a form. Any changes you make are then broadcasted
64+
to the task:
65+
66+
.. image:: ../interventions/edit-a-tasks-configuration.gui.gif
67+
:width: 75%
68+
:align: center
69+
70+
|
71+
72+
73+
.. _user_guide.broadcast.expiry:
74+
75+
Expiry
76+
------
77+
78+
Broadcasts which target specific cycles will eventually expire (i.e. be
79+
deleted) as the workflow moves on, to avoid gradual accumulation
80+
(note broadcasts are persisted when the workflow restarts).
81+
82+
83+
Expiry Point
84+
^^^^^^^^^^^^
85+
86+
Broadcasts expire once they are no longer required by upcoming tasks.
87+
The exact point at which a broadcast is expired depends on:
88+
89+
* The oldest cycle in the workflow to contain
90+
:term:`active tasks <active task>`.
91+
* The longest cycling :term:`recurrence` in the workflow.
92+
93+
Broadcasts which are older than the oldest :term:`active cycle point`
94+
*minus* the duration of the longest recurrence will be cleared.
95+
96+
For example, for the following workflow:
97+
98+
.. code-block:: cylc
99+
100+
[scheduling]
101+
[[graph]]
102+
P1Y = foo
103+
P2Y = bar
104+
P3Y = baz
105+
106+
The longest cycling recurrence is ``P3Y``.
107+
108+
If there were no more tasks left running in the cycle ``2000``, then broadcasts
109+
for cycles earlier than ``1997`` (``2000 - P3Y``) would be expired.
110+
111+
This is designed to keep broadcasts as far back as the previous instance
112+
of each task, in case you want to re-run it.
113+
114+
115+
Broadcasting To Historical Cycles
116+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
117+
118+
Broadcasts targeting historical cycles may be expired as soon as they are
119+
issued as the result of broadcast expiry.
120+
121+
However, broadcast expiry does not occur while the workflow is paused, so
122+
you can pause the workflow, do the broadcast, trigger the tasks, and then
123+
resume the workflow, e.g:
124+
125+
.. code-block:: bash
126+
127+
cylc pause my-workflow
128+
cylc broadcast my-workflow -p 2000 -s ...
129+
cylc trigger my-workflow
130+
cylc play my-workflow
131+
132+
133+
.. TODO: document sub-workflows

src/user-guide/running-workflows/dynamic-behaviour.rst

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/user-guide/running-workflows/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Running Workflows
1313
reflow
1414
workflow-run-modes
1515
scheduler-log-files
16-
dynamic-behaviour
16+
cylc-broadcast
1717
authentication-files
1818
workflow-databases
1919
advanced

0 commit comments

Comments
 (0)