Skip to content

Commit df6b80e

Browse files
committed
Update workflow-state command and xtrigger docs.
1 parent d97bce3 commit df6b80e

File tree

3 files changed

+19
-28
lines changed

3 files changed

+19
-28
lines changed

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

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,9 @@ The workflow state trigger function signature looks like this:
126126

127127
.. autofunction:: cylc.flow.xtriggers.workflow_state.workflow_state
128128

129-
The first three arguments are compulsory; they single out the target workflow name
130-
(``workflow``) task name (``task``) and cycle point
131-
(``point``). The function arguments mirror the arguments and options of
132-
the ``cylc workflow-state`` command - see
133-
``cylc workflow-state --help`` for documentation.
129+
The first argument identifies the target workflow, cycle, task, and status or
130+
output trigger name. The function arguments mirror the arguments and options of
131+
the ``cylc workflow-state`` command - see ``cylc workflow-state --help``.
134132

135133
As a simple example, consider the following "upstream"
136134
workflow (which we want to trigger off of):
@@ -158,8 +156,8 @@ Some important points to note about this:
158156
- The ``workflow_state`` trigger function, like the
159157
``cylc workflow-state`` command, must have read-access to the upstream
160158
workflow's public database.
161-
- The cycle point argument is supplied by a string template
162-
``%(point)s``. The string templates available to trigger function
159+
- The cycle point is supplied by a string template
160+
``%(point)s``. The string templates available to trigger functions
163161
arguments are described in :ref:`Custom Trigger Functions`).
164162

165163
The return value of the ``workflow_state`` trigger function looks like
@@ -168,20 +166,17 @@ this:
168166
.. code-block:: python
169167
170168
results = {
171-
'workflow': workflow,
172-
'task': task,
173-
'point': point,
174-
'offset': offset,
175-
'status': status,
176-
'message': message,
177-
'cylc_run_dir': cylc_run_dir
169+
'workflow_id': workflow_id,
170+
'task_id': task_id,
171+
'task_selector': task_selector,
172+
'flow_num': flow_num,
178173
}
179174
return (satisfied, results)
180175
181176
The ``satisfied`` variable is boolean (value True or False, depending
182177
on whether or not the trigger condition was found to be satisfied). The
183-
``results`` dictionary contains the names and values of all of the
184-
target workflow state parameters. Each item in it gets qualified with the
178+
``results`` dictionary contains the names and values of the
179+
target workflow state parameters. Each name gets qualified with the
185180
unique trigger label ("upstream" here) and passed to the environment of
186181
dependent tasks (the members of the ``FAM`` family in this case).
187182
To see this, take a look at the job script for one of the downstream tasks:
@@ -194,18 +189,16 @@ To see this, take a look at the job script for one of the downstream tasks:
194189
# TASK RUNTIME ENVIRONMENT:
195190
export upstream_workflow upstream_cylc_run_dir upstream_offset \
196191
upstream_message upstream_status upstream_point upstream_task
197-
upstream_workflow="up"
198-
upstream_cylc_run_dir="/home/vagrant/cylc-run"
199-
upstream_offset="None"
200-
upstream_message="data ready"
201-
upstream_status="succeeded"
202-
upstream_point="2011"
203-
upstream_task="foo"}
192+
upstream_workflow_id="up"
193+
upstream_task_id="2011/foo"
194+
upstream_selector="succeeded"
195+
upstream_flow_num="1"
196+
}
204197
...
205198
206199
.. note::
207200

208-
The task has to know the name (label) of the external trigger that it
201+
The dependent task has to know the name of the xtrigger that it
209202
depends on - "upstream" in this case - in order to use this information.
210203
However the name could be given to the task environment in the workflow
211204
configuration.

src/workflows/xtrigger/sequential/flow.cylc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
initial cycle point = 2010
55
sequential xtriggers = True
66
[[xtriggers]]
7-
upstream = workflow_state(workflow=up, task=foo, point=%(point)s, \
8-
message='data ready'):PT10S
7+
upstream = workflow_state(up//%(point)s/foo:x):PT10S
98
clock_0 = wall_clock(offset=PT0H, sequential=False)
109
[[graph]]
1110
P1Y = """

src/workflows/xtrigger/workflow_state/downstream/flow.cylc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
[scheduling]
44
initial cycle point = 2010
55
[[xtriggers]]
6-
upstream = workflow_state(workflow=up, task=foo, point=%(point)s, \
7-
message='data ready'):PT10S
6+
upstream = workflow_state(up//%(point)s/foo:x):PT10S
87
clock_0 = wall_clock(offset=PT0H)
98
[[graph]]
109
P1Y = """

0 commit comments

Comments
 (0)