@@ -567,22 +567,25 @@ task ``whizz`` downstream. The scheduler will then stall with
567
567
script = "sleep 10"
568
568
569
569
570
- .. _ EventHandling :
570
+ .. _ user_guide.runtime.task_event_handling :
571
571
572
- Event Handling
573
- --------------
572
+ Task Event Handling
573
+ -------------------
574
574
575
- .. seealso ::
575
+ Task event handlers allow configured commands to run when task events occur.
576
576
577
- * Task events :cylc:conf: `[runtime][<namespace>][events] `
578
- * Workflow events :cylc:conf: `[scheduler][events] `
577
+ .. note ::
579
578
580
- .. cylc-scope :: flow.cylc[runtime][<namespace>]
579
+ Cylc supports workflow events e.g. ``startup `` and ``shutdown ``
580
+ and task events e.g. ``submitted `` and ``failed ``.
581
581
582
- Custom *event handler * scripts can be called when certain workflow and task
583
- events occur. Event handlers can be used to send a message, raise an alarm, or
584
- whatever you like. They can even call ``cylc `` commands to intervene in the
585
- workflow.
582
+ See also :ref: `user_guide.scheduler.workflow_event_handling `.
583
+
584
+ Event handlers can be used to send a message, raise an alarm, or whatever you
585
+ like. They can even call ``cylc `` commands to intervene in the workflow.
586
+
587
+ Task event handlers are configured by
588
+ :cylc:conf: `flow.cylc[runtime][<namespace>][events] `.
586
589
587
590
.. note ::
588
591
@@ -596,7 +599,7 @@ They should return quickly to avoid tying up the scheduler process pool -
596
599
see :ref: `Managing External Command Execution `.
597
600
598
601
599
- .. cylc-scope : :
602
+ .. _ user_guide.runtime.task_event_handling.event_specific_handlers :
600
603
601
604
Event-Specific Handlers
602
605
^^^^^^^^^^^^^^^^^^^^^^^
@@ -634,18 +637,40 @@ can be:
634
637
Values should be a list of commands, command lines, or command line templates
635
638
(see below) to call if the specified event is triggered.
636
639
640
+
641
+ .. _user_guide.runtime.task_event_handling.general_event_handlers :
642
+
637
643
General Event Handlers
638
644
^^^^^^^^^^^^^^^^^^^^^^
639
645
640
- Alternatively you can configure ``handler events `` and ``handlers ``
641
- under :cylc:conf: `[runtime][<namespace>][events] `, where the former is a list
642
- of events (as above), and the latter a list of commands, command lines, lines
643
- or command line templates (see below) to call if any of the specified events
644
- are triggered.
646
+ .. cylc-scope :: flow.cylc[runtime][<namespace>][events]
647
+
648
+ Alternatively you can configure a list of generic event :cylc:conf: `handlers ` to be run
649
+ for configured :cylc:conf: `handler events `.
650
+
651
+ :cylc:conf: `handler events `
652
+ A list of events which may include any of the above
653
+ events (e.g. ``submission failed `` or ``warning ``) or
654
+ any of a task's :term: `custom outputs <custom output> `.
655
+ :cylc:conf: `handlers `
656
+ A list of commands to be run for these events.
657
+ Information about the event can be provided using
658
+ :ref: `user_guide.runtime.event_handlers.task_event_handling.template_variables `.
659
+
660
+ Example:
661
+
662
+ .. code-block :: cylc
663
+
664
+ handlers = """
665
+ my-handler %(event)s %(workflow)s,
666
+ echo %(workflow)s-%(event)s >> my-log-file
667
+ """
668
+ handler events = submission failed, failed, warning, my-custom-output
645
669
646
670
.. cylc-scope ::
647
671
648
- .. _task_event_template_variables :
672
+
673
+ .. _user_guide.runtime.event_handlers.task_event_handling.template_variables :
649
674
650
675
Task Event Template Variables
651
676
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0 commit comments