@@ -126,11 +126,9 @@ The workflow state trigger function signature looks like this:
126
126
127
127
.. autofunction :: cylc.flow.xtriggers.workflow_state.workflow_state
128
128
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 ``.
134
132
135
133
As a simple example, consider the following "upstream"
136
134
workflow (which we want to trigger off of):
@@ -158,8 +156,8 @@ Some important points to note about this:
158
156
- The ``workflow_state `` trigger function, like the
159
157
``cylc workflow-state `` command, must have read-access to the upstream
160
158
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
163
161
arguments are described in :ref: `Custom Trigger Functions `).
164
162
165
163
The return value of the ``workflow_state `` trigger function looks like
@@ -168,20 +166,17 @@ this:
168
166
.. code-block :: python
169
167
170
168
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,
178
173
}
179
174
return (satisfied, results)
180
175
181
176
The ``satisfied `` variable is boolean (value True or False, depending
182
177
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
185
180
unique trigger label ("upstream" here) and passed to the environment of
186
181
dependent tasks (the members of the ``FAM `` family in this case).
187
182
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:
194
189
# TASK RUNTIME ENVIRONMENT:
195
190
export upstream_workflow upstream_cylc_run_dir upstream_offset \
196
191
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
+ }
204
197
...
205
198
206
199
.. note ::
207
200
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
209
202
depends on - "upstream" in this case - in order to use this information.
210
203
However the name could be given to the task environment in the workflow
211
204
configuration.
0 commit comments