Skip to content

Commit

Permalink
Add documentation for xtriggers entry_point (#671)
Browse files Browse the repository at this point in the history
Add documentation for xtriggers entry_point

---------

Co-authored-by: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com>
  • Loading branch information
ColemanTom and MetRonnie authored Jan 24, 2024
1 parent c3c2f03 commit 7b8d510
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ src/appendices/command-ref.rst
# auto-generated documentation
src/plugins/main-loop/built-in
src/plugins/install/built-in
src/plugins/xtriggers/built-in
src/user-guide/task-implementation/job-runner-handlers
src/dictionaries/sentence_case
1 change: 1 addition & 0 deletions src/plugins/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ The following are "core" plugins maintained by the Cylc team:
main-loop/index
install/index
job-runners/index
xtriggers/index

.. warning::

Expand Down
52 changes: 52 additions & 0 deletions src/plugins/xtriggers/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Xtrigger Plugins
======================================

Xtrigger plugins allow you to install and use xtriggers without them being
in your ``CYLC_PYTHONPATH``.


Built In Plugins
----------------

Cylc Flow provides the following xtriggers.

.. autosummary::
:toctree: built-in
:template: docstring_only.rst

cylc.flow.xtriggers.echo
cylc.flow.xtriggers.workflow_state
cylc.flow.xtriggers.xrandom

.. Note: Autosummary generates files in this directory, these are cleaned
up by `make clean`.
Developing ``xtrigger`` plugins
-------------------------------

Cylc uses entry points registered by setuptools to search for xtrigger
plugins.

Example
^^^^^^^

Plugins are registered by registering them with the ``cylc.xtriggers``
entry points. Each xtrigger is registered individually.

.. code-block:: ini
:caption: ``setup.cfg``
[options.entry_points]
cylc.xtriggers =
foo = my_package.foo:foo
bar = my_package.foo:bar
baz = my_package.baz:baz
.. code-block:: toml
:caption: ``pyproject.toml``
[project.entry-points."cylc.xtriggers"]
foo = "my_package.foo:foo"
bar = "my_package.foo:bar"
baz = "my_package.baz:baz"
7 changes: 5 additions & 2 deletions src/user-guide/writing-workflows/external-triggers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,17 @@ properties:

- they must:

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

- they can be located either:

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

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

0 comments on commit 7b8d510

Please sign in to comment.