diff --git a/src/plugins/xtriggers/index.rst b/src/plugins/xtriggers/index.rst index c5d783f13e..c9c6314fc2 100644 --- a/src/plugins/xtriggers/index.rst +++ b/src/plugins/xtriggers/index.rst @@ -66,4 +66,4 @@ These xtriggers can be registered in the package's ``setup.cfg`` or It is recommended to implement only one xtrigger per module. This allows you to write a ``validate`` function for each xtrigger - see - :ref:`xrandom.validate` for an example. + :py:mod:`cylc.flow.xtriggers.xrandom` for an example. diff --git a/src/user-guide/writing-workflows/external-triggers.rst b/src/user-guide/writing-workflows/external-triggers.rst index f0cf272e13..ed9e0cd5fe 100644 --- a/src/user-guide/writing-workflows/external-triggers.rst +++ b/src/user-guide/writing-workflows/external-triggers.rst @@ -288,8 +288,14 @@ properties: - The module containing the xtrigger function may also contain a ``validate`` function taking a single argument, which is a dictionary of all the arguments passed to the xtrigger function in ``flow.cylc``. It should raise an - exception if validation fails. See :py:mod:`cylc.flow.xtriggers.xrandom` for an example - of a validate function. + exception if validation fails. See + :py:mod:`cylc.flow.xtriggers.xrandom` + for an example of a validate function. +- The arguments you call the xtrigger function with are automatically + validated against the function signature, so you don't necessarily need + to check for the presence of arguments or their types in the validate + function. However, you may want to check that the values are of the correct + type or within a certain range. .. note:: @@ -297,6 +303,7 @@ properties: because each call is executed in an independent process in the process pool. If necessary the filesystem can be used for this purpose. + .. spelling:word-list:: vv @@ -383,7 +390,7 @@ time (useful for testing the effect of a long-running trigger function - which should be avoided) and has a configurable random chance of success. The function signature is: -.. autofunction:: cylc.flow.xtriggers.xrandom.xrandom +.. automodule:: cylc.flow.xtriggers.xrandom The ``percent`` argument sets the odds of success in any given call; ``secs`` is the number of seconds to sleep before returning; and the @@ -397,29 +404,6 @@ An example xrandom trigger workflow: .. literalinclude:: ../../workflows/xtrigger/xrandom/flow.cylc :language: cylc -.. _xrandom.validate: - -Validation example using xrandom -"""""""""""""""""""""""""""""""" - -The ``xrandom`` xtrigger module contains an example of an xtrigger validation -function. - -Validation functions are run on the inputs to the xtrigger when calling -``cylc validate``, and should raise an exception with user facing error -messages if validation fails. - -.. autofunction:: cylc.flow.xtriggers.xrandom.validate - -.. tip:: - - The arguments you call the xtrigger function with are automatically - validated against the function signature, so you don't necessarily need - to check for the presence of arguments or their types in the validate - function. However, you may want to check that the values are of the correct - type or within a certain range. - - .. _Current Trigger Function Limitations: Current Limitations