|
| 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 |
0 commit comments