Skip to content

Commit

Permalink
companion to cylc/cylc-flow#4455
Browse files Browse the repository at this point in the history
  • Loading branch information
wxtim committed Oct 15, 2021
1 parent eccd12a commit 145fbf4
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/tutorial/furthertopics/broadcast.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Add the following runtime configuration to the ``runtime`` section:
WORD=${WORDS[$(date +%s) % ${#WORDS[@]}]}
# Broadcast random word to the announce task.
cylc broadcast $CYLC_WORKFLOW_NAME -n announce -s "[environment]WORD=${WORD}"
cylc broadcast $CYLC_WORKFLOW_ID -n announce -s "[environment]WORD=${WORD}"
"""
[[[environment]]]
WORDS = ni, it, ekke ekke ptang zoo boing
Expand Down
16 changes: 8 additions & 8 deletions src/tutorial/furthertopics/message-triggers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ In order to get our workflow to trigger messages, we need to:
* specify our custom message in a section called ``[[outputs]]`` within the
``[runtime]`` section of our workflow,

* add ``cylc message -- "${CYLC_WORKFLOW_NAME}" "${CYLC_TASK_JOB}" "YOUR CHOSEN TRIGGER MESSAGE"``
* add ``cylc message -- "${CYLC_WORKFLOW_ID}" "${CYLC_TASK_JOB}" "YOUR CHOSEN TRIGGER MESSAGE"``
to the ``script`` section of ``[runtime]``, your chosen trigger message
should be unique and should exactly match the message defined in
``[[outputs]]``.
Expand All @@ -69,7 +69,7 @@ triggers another task bar and when fully completed triggers another task, baz.
[[foo]]
script = """
sleep 5
cylc message -- "${CYLC_WORKFLOW_NAME}" "${CYLC_TASK_JOB}" "file 1 done"
cylc message -- "${CYLC_WORKFLOW_ID}" "${CYLC_TASK_JOB}" "file 1 done"
sleep 10
"""
[[[outputs]]]
Expand Down Expand Up @@ -251,11 +251,11 @@ triggers another task bar and when fully completed triggers another task, baz.
script = """
sleep 2
random.sh
+ cylc message -- "${CYLC_WORKFLOW_NAME}" "${CYLC_TASK_JOB}" \
+ cylc message -- "${CYLC_WORKFLOW_ID}" "${CYLC_TASK_JOB}" \
"Task partially complete, report ready to view"
sleep 2
random.sh
+ cylc message -- "${CYLC_WORKFLOW_NAME}" "${CYLC_TASK_JOB}" \
+ cylc message -- "${CYLC_WORKFLOW_ID}" "${CYLC_TASK_JOB}" \
"Task partially complete, report updated"
sleep 2
random.sh
Expand Down Expand Up @@ -312,11 +312,11 @@ triggers another task bar and when fully completed triggers another task, baz.
script = """
sleep 2
random.sh
cylc message -- "${CYLC_WORKFLOW_NAME}" "${CYLC_TASK_JOB}" \
cylc message -- "${CYLC_WORKFLOW_ID}" "${CYLC_TASK_JOB}" \
"Task partially complete, report ready to view"
sleep 2
random.sh
cylc message -- "${CYLC_WORKFLOW_NAME}" "${CYLC_TASK_JOB}" \
cylc message -- "${CYLC_WORKFLOW_ID}" "${CYLC_TASK_JOB}" \
"Task partially complete, report updated"
sleep 2
random.sh
Expand Down Expand Up @@ -413,11 +413,11 @@ triggers another task bar and when fully completed triggers another task, baz.
script = """
sleep 2
random.sh
cylc message -- "${CYLC_WORKFLOW_NAME}" "${CYLC_TASK_JOB}" \
cylc message -- "${CYLC_WORKFLOW_ID}" "${CYLC_TASK_JOB}" \
"Task partially complete, report ready to view"
sleep 2
random.sh
cylc message -- "${CYLC_WORKFLOW_NAME}" "${CYLC_TASK_JOB}" \
cylc message -- "${CYLC_WORKFLOW_ID}" "${CYLC_TASK_JOB}" \
"Task partially complete, report updated"
sleep 2
random.sh
Expand Down
10 changes: 5 additions & 5 deletions src/user-guide/task-implementation/job-scripts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Normal severity messages are printed to ``job.out`` and logged by the scheduler:

.. code-block:: bash
cylc message -- "${CYLC_WORKFLOW_NAME}" "${CYLC_TASK_JOB}" \
cylc message -- "${CYLC_WORKFLOW_ID}" "${CYLC_TASK_JOB}" \
"Hello from ${CYLC_TASK_ID}"
"CUSTOM" severity messages are printed to ``job.out``, logged by the
Expand All @@ -150,7 +150,7 @@ event handlers:

.. code-block:: bash
cylc message -- "${CYLC_WORKFLOW_NAME}" "${CYLC_TASK_JOB}" \
cylc message -- "${CYLC_WORKFLOW_ID}" "${CYLC_TASK_JOB}" \
"CUSTOM:data available for ${CYLC_TASK_CYCLE_POINT}"
These can be used to signal special events that are neither routine
Expand All @@ -162,15 +162,15 @@ file (a "data availability" event).

.. code-block:: bash
cylc message -- "${CYLC_WORKFLOW_NAME}" "${CYLC_TASK_JOB}" \
cylc message -- "${CYLC_WORKFLOW_ID}" "${CYLC_TASK_JOB}" \
"WARNING:Uh-oh, something's not right here."
"CRITICAL" severity messages are printed to ``job.err``, logged by the
:term:`scheduler`, and can be passed to *critical* event handlers:

.. code-block:: bash
cylc message -- "${CYLC_WORKFLOW_NAME}" "${CYLC_TASK_JOB}" \
cylc message -- "${CYLC_WORKFLOW_ID}" "${CYLC_TASK_JOB}" \
"CRITICAL:ERROR occurred in process X!"
Task jobs no longer (since Cylc 8) attempt to resend messages if the server
Expand Down Expand Up @@ -226,7 +226,7 @@ before aborting, potentially triggering a *critical* task event handler:
.. code-block:: bash
if ! /bin/false; then
cylc message -- "${CYLC_WORKFLOW_NAME}" "${CYLC_TASK_JOB}" \
cylc message -- "${CYLC_WORKFLOW_ID}" "${CYLC_TASK_JOB}" \
"CRITICAL:ERROR: /bin/false failed!"
exit 1
fi
Expand Down
1 change: 1 addition & 0 deletions src/user-guide/writing-workflows/jinja2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ prior to configuration parsing to provide workflow context:
CYLC_VERBOSE # Verbose mode, True or False
CYLC_VERSION # Version of cylc installation used
CYLC_WORKFLOW_ID # Workflow ID
CYLC_WORKFLOW_NAME # Workflow name
CYLC_WORKFLOW_LOG_DIR # Workflow log directory.
Expand Down
5 changes: 3 additions & 2 deletions src/user-guide/writing-workflows/runtime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ The task job script may export the following environment variables:
# when in any date-time cycling mode
CYLC_WORKFLOW_FINAL_CYCLE_POINT # Final cycle point
CYLC_WORKFLOW_INITIAL_CYCLE_POINT # Initial cycle point
CYLC_WORKFLOW_ID # Workflow ID - the WORKFLOW_NAME plus the run directory
CYLC_WORKFLOW_NAME # Workflow name
CYLC_UTC # UTC mode, True or False
CYLC_VERBOSE # Verbose mode, True or False
Expand Down Expand Up @@ -505,7 +506,7 @@ this case.) E.g. to send an email on (submission) failed and retry:
[[foo]]
script = """
test ${CYLC_TASK_TRY_NUMBER} -eq 3
cylc message -- "${CYLC_WORKFLOW_NAME}" "${CYLC_TASK_JOB}" 'oopsy daisy'
cylc message -- "${CYLC_WORKFLOW_ID}" "${CYLC_TASK_JOB}" 'oopsy daisy'
"""
execution retry delays = PT0S, PT30S
[[[events]]]
Expand Down Expand Up @@ -611,7 +612,7 @@ event handlers using the alternate methods:
[[foo]]
script = """
test ${CYLC_TASK_TRY_NUMBER} -eq 2
cylc message -- "${CYLC_WORKFLOW_NAME}" "${CYLC_TASK_JOB}" 'oopsy daisy'
cylc message -- "${CYLC_WORKFLOW_ID}" "${CYLC_TASK_JOB}" 'oopsy daisy'
"""
execution retry delays = PT0S, PT30S
[[[events]]]
Expand Down

0 comments on commit 145fbf4

Please sign in to comment.