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