Skip to content

Commit 7b8d510

Browse files
Add documentation for xtriggers entry_point (#671)
Add documentation for xtriggers entry_point --------- Co-authored-by: Ronnie Dutta <[email protected]>
1 parent c3c2f03 commit 7b8d510

File tree

4 files changed

+59
-2
lines changed

4 files changed

+59
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@ src/appendices/command-ref.rst
2424
# auto-generated documentation
2525
src/plugins/main-loop/built-in
2626
src/plugins/install/built-in
27+
src/plugins/xtriggers/built-in
2728
src/user-guide/task-implementation/job-runner-handlers
2829
src/dictionaries/sentence_case

src/plugins/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ The following are "core" plugins maintained by the Cylc team:
1212
main-loop/index
1313
install/index
1414
job-runners/index
15+
xtriggers/index
1516

1617
.. warning::
1718

src/plugins/xtriggers/index.rst

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
Xtrigger Plugins
2+
======================================
3+
4+
Xtrigger plugins allow you to install and use xtriggers without them being
5+
in your ``CYLC_PYTHONPATH``.
6+
7+
8+
Built In Plugins
9+
----------------
10+
11+
Cylc Flow provides the following xtriggers.
12+
13+
.. autosummary::
14+
:toctree: built-in
15+
:template: docstring_only.rst
16+
17+
cylc.flow.xtriggers.echo
18+
cylc.flow.xtriggers.workflow_state
19+
cylc.flow.xtriggers.xrandom
20+
21+
.. Note: Autosummary generates files in this directory, these are cleaned
22+
up by `make clean`.
23+
24+
Developing ``xtrigger`` plugins
25+
-------------------------------
26+
27+
Cylc uses entry points registered by setuptools to search for xtrigger
28+
plugins.
29+
30+
Example
31+
^^^^^^^
32+
33+
Plugins are registered by registering them with the ``cylc.xtriggers``
34+
entry points. Each xtrigger is registered individually.
35+
36+
.. code-block:: ini
37+
:caption: ``setup.cfg``
38+
39+
[options.entry_points]
40+
cylc.xtriggers =
41+
foo = my_package.foo:foo
42+
bar = my_package.foo:bar
43+
baz = my_package.baz:baz
44+
45+
.. code-block:: toml
46+
:caption: ``pyproject.toml``
47+
48+
[project.entry-points."cylc.xtriggers"]
49+
foo = "my_package.foo:foo"
50+
bar = "my_package.foo:bar"
51+
baz = "my_package.baz:baz"
52+

src/user-guide/writing-workflows/external-triggers.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,17 @@ properties:
230230

231231
- they must:
232232

233-
- be defined in a module with the same name as the function;
233+
- be defined in a module with the same name as the function, unless
234+
provided using the ``cylc.xtriggers`` entry point;
234235
- be compatible with the same Python version that runs the scheduler
235236
(see :ref:`Requirements` for the latest version specification).
236237

237238
- they can be located either:
238239

239240
- in ``<workflow-dir>/lib/python/``;
240-
- or anywhere in your ``$CYLC_PYTHONPATH``.
241+
- anywhere in your ``$CYLC_PYTHONPATH``;
242+
- or defined using the ``cylc.xtriggers`` entry point for an installed
243+
package.
241244

242245
- they can take arbitrary positional and keyword arguments
243246
- workflow and task identity, and cycle point, can be passed to trigger

0 commit comments

Comments
 (0)