Skip to content

Commit 6b189e9

Browse files
improve workflow events documentation (#685)
1 parent 97db3ee commit 6b189e9

File tree

1 file changed

+90
-28
lines changed

1 file changed

+90
-28
lines changed

src/user-guide/writing-workflows/scheduler.rst

Lines changed: 90 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,53 +10,115 @@ workflows.
1010

1111

1212
.. _user_guide.scheduler.workflow_event_handling:
13+
.. _user_guide.scheduler.workflow_events:
1314

14-
Workflow Event Handling
15-
-----------------------
15+
Workflow Events
16+
---------------
1617

17-
Workflow event handlers allow configured commands to run when workflow events
18-
occur.
18+
There are two types of event in Cylc:
1919

20-
.. note::
20+
* workflow events e.g. ``startup`` and ``shutdown``, which pertain to the :term:`scheduler`
21+
* task events e.g. ``submitted`` and ``failed``, which pertain to :term:`tasks <task>`.
2122

22-
Cylc supports workflow events e.g. ``startup`` and ``shutdown``
23-
and task events e.g. ``submitted`` and ``failed``.
23+
This section covers workflow events, for
24+
task events see :ref:`user_guide.runtime.task_event_handling`.
2425

25-
See also :ref:`user_guide.runtime.task_event_handling`.
26+
.. rubric:: Event Handlers
2627

27-
Workflow event handlers are configured by:
28+
Workflow events have "handlers" (i.e. hooks) which allow configured commands to
29+
run when workflow events occur. These can be configured by:
2830

2931
* :cylc:conf:`flow.cylc[scheduler][events]` (per workflow)
3032
* :cylc:conf:`global.cylc[scheduler][events]` (user/site defaults)
3133

34+
.. rubric:: Abort On Event
3235

33-
Workflow Events
34-
^^^^^^^^^^^^^^^
36+
As well as event handlers, you can tell the scheduler to abort (i.e., shut down
37+
immediately with error status) on certain workflow events, using the
38+
``abort on ...`` configurations.
39+
40+
.. rubric:: Configuration
41+
42+
Some workflow events have related configurations e.g. for setting the timeout.
43+
44+
.. rubric:: List of workflow events:
45+
46+
.. cylc-scope:: global.cylc[scheduler][events]
47+
48+
.. describe:: startup
49+
50+
:Event Handler: `startup handlers`
3551

36-
The list of events is:
52+
The scheduler was started or restarted.
53+
54+
E.G. using one of these commands ``cylc play``, ``cylc vip`` or ``cylc vr``.
55+
56+
.. describe:: shutdown
57+
58+
:Event Handler: `shutdown handlers`
59+
60+
The scheduler was shut down.
61+
62+
E.G. using the ``cylc stop`` command.
63+
64+
.. describe:: abort
65+
66+
:Event Handler: `abort handlers`
3767

38-
startup
39-
The scheduler started running the workflow.
40-
shutdown
41-
The workflow finished and the scheduler will shut down.
42-
abort
4368
The scheduler shut down early with error status, due to a fatal error
4469
condition or a configured timeout.
45-
workflow timeout
70+
71+
.. describe:: workflow timeout
72+
73+
:Configuration: `workflow timeout`
74+
:Event Handler: `workflow timeout handlers`
75+
:Abort On Event: `abort on workflow timeout`
76+
4677
The workflow run timed out.
47-
stall
48-
The workflow stalled.
49-
stall timeout
78+
79+
The timer starts counting down at scheduler startup. It resets on workflow
80+
restart.
81+
82+
Note, the ``abort`` event is not raised by "Abort On Event" handlers.
83+
84+
.. describe:: stall
85+
86+
:Event Handler: `stall handlers`
87+
88+
The workflow :term:`stalled <stall>` (i.e. the scheduler cannot make any
89+
further progress due to runtime events).
90+
91+
E.G. a task failure is blocking the pathway through the graph.
92+
93+
.. describe:: stall timeout
94+
95+
:Configuration: `stall timeout`
96+
:Event Handler: `stall timeout handlers`
97+
:Abort On Event: `abort on stall timeout`
98+
5099
The workflow timed out after stalling.
51-
inactivity timeout
52-
The workflow timed out with no activity.
53100

54-
You can tell the scheduler to abort (i.e., shut down immediately with error
55-
status) on certain workflow events, with the following settings:
101+
.. describe:: inactivity timeout
102+
103+
:Configuration: `inactivity timeout`
104+
:Event Handler: `inactivity timeout handlers`
105+
:Abort On Event: `abort on inactivity timeout`
106+
107+
The workflow timed out with no activity (i.e. a period with no job
108+
submissions or task messages).
109+
110+
This can be useful for system administrators to help catch workflows which
111+
have become stalled on external conditions or system issues.
112+
113+
.. describe:: restart timeout
114+
115+
:Configuration: `restart timeout`
116+
117+
If a workflow that has run to completion is restarted, the scheduler will
118+
have nothing to do so will shut down. This timeout gives the user a grace
119+
period in which to trigger new tasks to continue the workflow run.
56120

57-
- abort on stall timeout
58-
- abort on inactivity timeout
59-
- abort on workflow timeout
121+
.. cylc-scope::
60122

61123
Mail Events
62124
^^^^^^^^^^^

0 commit comments

Comments
 (0)