|
63 | 63 | ) |
64 | 64 | from cylc.flow.pathutil import SYMLINKABLE_LOCATIONS |
65 | 65 | from cylc.flow.platforms import validate_platforms |
| 66 | +from cylc.flow.task_events_mgr import TaskEventsManager as TEM |
66 | 67 | from cylc.flow.workflow_events import WorkflowEventHandler |
67 | 68 |
|
68 | 69 |
|
|
200 | 201 | ''', |
201 | 202 | 'options': WorkflowEventHandler.EVENTS.copy(), |
202 | 203 | 'depr_options': WorkflowEventHandler.EVENTS_DEPRECATED.copy(), |
| 204 | + 'warn_options': True, |
203 | 205 | }, |
204 | 206 | 'mail events': { |
205 | 207 | 'desc': ''' |
|
212 | 214 | ''', |
213 | 215 | 'options': WorkflowEventHandler.EVENTS.copy(), |
214 | 216 | 'depr_options': WorkflowEventHandler.EVENTS_DEPRECATED.copy(), |
| 217 | + 'warn_options': True, |
215 | 218 | }, |
216 | 219 | 'startup handlers': f''' |
217 | 220 | Handlers to run at scheduler startup. |
|
590 | 593 | echo %(event)s occurred in %(workflow)s >> my-log-file |
591 | 594 |
|
592 | 595 | ''', |
593 | | - 'handler events': ''' |
| 596 | + 'handler events': f''' |
| 597 | + :Options: ``{"``, ``".join(TEM.STD_EVENTS)}`` & any custom event |
| 598 | +
|
594 | 599 | A list of events for which :cylc:conf:`[..]handlers` are run. |
595 | 600 |
|
596 | | - See :ref:`user_guide.runtime.task_event_handling.list` for valid |
597 | | - events. |
| 601 | + See :ref:`user_guide.runtime.task_event_handling.list` for more |
| 602 | + information on task events. |
598 | 603 |
|
599 | 604 | Example:: |
600 | 605 |
|
|
611 | 616 |
|
612 | 617 | PT10S, PT1M, PT5M |
613 | 618 | ''', |
614 | | - 'mail events': ''' |
| 619 | + 'mail events': f''' |
| 620 | + :Options: ``{"``, ``".join(TEM.STD_EVENTS)}`` & any custom event |
| 621 | +
|
615 | 622 | A list of events for which notification emails should be sent. |
616 | 623 |
|
617 | | - See :ref:`user_guide.runtime.task_event_handling.list` for valid |
618 | | - events. |
| 624 | + See :ref:`user_guide.runtime.task_event_handling.list` for more |
| 625 | + information on task events. |
619 | 626 |
|
620 | 627 | Example:: |
621 | 628 |
|
@@ -676,15 +683,36 @@ def comma_sep_section_note(version_changed: str = '') -> str: |
676 | 683 |
|
677 | 684 |
|
678 | 685 | def short_descr(text: str) -> str: |
679 | | - """Get dedented one-paragraph description from long description.""" |
680 | | - return dedent(text).split('\n\n', 1)[0] |
| 686 | + r"""Get dedented one-paragraph description from long description. |
| 687 | +
|
| 688 | + Examples: |
| 689 | + >>> short_descr('foo\n\nbar') |
| 690 | + 'foo' |
| 691 | +
|
| 692 | + >>> short_descr(':Field: Value\n\nfoo\n\nbar') |
| 693 | + ':Field: Value\n\nfoo' |
| 694 | +
|
| 695 | + """ |
| 696 | + lines = [] |
| 697 | + for line in dedent(text).splitlines(): |
| 698 | + if not line: |
| 699 | + continue |
| 700 | + elif line.startswith(':'): |
| 701 | + lines.append(line) |
| 702 | + else: |
| 703 | + lines.append(line) |
| 704 | + break |
| 705 | + return '\n\n'.join(lines) |
681 | 706 |
|
682 | 707 |
|
683 | 708 | def default_for( |
684 | 709 | text: str, config_path: str, section: bool = False |
685 | 710 | ) -> str: |
686 | | - """Get dedented short description and insert a 'Default(s) For' directive |
687 | | - that links to this config item's flow.cylc counterpart.""" |
| 711 | + """Return a ":Default For: field for this config. |
| 712 | +
|
| 713 | + Get dedented short description and insert a 'Default(s) For' field |
| 714 | + that links to this config item's flow.cylc counterpart. |
| 715 | + """ |
688 | 716 | directive = f":Default{'s' if section else ''} For:" |
689 | 717 | return ( |
690 | 718 | f"{directive} :cylc:conf:`flow.cylc{config_path}`.\n\n" |
|
0 commit comments