| 1 |
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE. |
| 2 |
# Copyright (C) NIWA & British Crown (Met Office) & Contributors. |
| 3 |
# |
| 4 |
# This program is free software: you can redistribute it and/or modify |
| 5 |
# it under the terms of the GNU General Public License as published by |
| 6 |
# the Free Software Foundation, either version 3 of the License, or |
| 7 |
# (at your option) any later version. |
| 8 |
# |
| 9 |
# This program is distributed in the hope that it will be useful, |
| 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
# GNU General Public License for more details. |
| 13 |
# |
| 14 |
# You should have received a copy of the GNU General Public License |
| 15 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 |
"""Define all legal items and values for cylc workflow definition files.""" |
| 17 |
|
| 18 |
import contextlib |
| 19 |
import re |
| 20 |
from textwrap import dedent |
| 21 |
from typing import ( |
| 22 |
Any, |
| 23 |
Dict, |
| 24 |
Literal, |
| 25 |
Optional, |
| 26 |
Set, |
| 27 |
) |
| 28 |
|
| 29 |
from metomi.isodatetime.data import Calendar |
| 30 |
|
| 31 |
from cylc.flow import LOG |
| 32 |
from cylc.flow.cfgspec.globalcfg import ( |
| 33 |
DIRECTIVES_DESCR, |
| 34 |
DIRECTIVES_ITEM_DESCR, |
| 35 |
EVENTS_DESCR, |
| 36 |
EVENTS_SETTINGS, |
| 37 |
EXECUTION_POLL_DESCR, |
| 38 |
LOG_RETR_SETTINGS, |
| 39 |
MAIL_DESCR, |
| 40 |
MAIL_FOOTER_DESCR, |
| 41 |
MAIL_FROM_DESCR, |
| 42 |
MAIL_INTERVAL_DESCR, |
| 43 |
MAIL_TO_DESCR, |
| 44 |
MAIN_LOOP_DESCR, |
| 45 |
MAIN_LOOP_PLUGIN_DESCR, |
| 46 |
MAIN_LOOP_PLUGIN_INTERVAL_DESCR, |
| 47 |
REPLACES, |
| 48 |
SCHEDULER_DESCR, |
| 49 |
SUBMISSION_POLL_DESCR, |
| 50 |
SUBMISSION_RETY_DESCR, |
| 51 |
TASK_EVENTS_DESCR, |
| 52 |
TASK_EVENTS_SETTINGS, |
| 53 |
UTC_MODE_DESCR, |
| 54 |
) |
| 55 |
import cylc.flow.flags |
| 56 |
from cylc.flow.parsec.OrderedDict import OrderedDictWithDefaults |
| 57 |
from cylc.flow.parsec.config import ( |
| 58 |
ConfigNode as Conf, |
| 59 |
ParsecConfig, |
| 60 |
) |
| 61 |
from cylc.flow.parsec.exceptions import UpgradeError |
| 62 |
from cylc.flow.parsec.upgrade import ( |
| 63 |
converter, |
| 64 |
upgrader, |
| 65 |
) |
| 66 |
from cylc.flow.parsec.validate import ( |
| 67 |
CylcConfigValidator as VDR, |
| 68 |
DurationFloat, |
| 69 |
cylc_config_validate, |
| 70 |
) |
| 71 |
from cylc.flow.platforms import ( |
| 72 |
fail_if_platform_and_host_conflict, |
| 73 |
get_platform_deprecated_settings, |
| 74 |
is_platform_definition_subshell, |
| 75 |
) |
| 76 |
from cylc.flow.run_modes import ( |
| 77 |
TASK_CONFIG_RUN_MODES, |
| 78 |
RunMode, |
| 79 |
) |
| 80 |
from cylc.flow.task_events_mgr import EventData |
| 81 |
|
| 82 |
|
| 83 |
# Regex to check whether a string is a command |
| 84 |
REC_COMMAND = re.compile(r'(`|\$\()\s*(.*)\s*([`)])$') |
| 85 |
|
| 86 |
REPLACED_BY_PLATFORMS = ''' |
| 87 |
.. deprecated:: 8.0.0 |
| 88 |
|
| 89 |
This is used to select a matching platform. |
| 90 |
It will be removed in a future version of Cylc 8. |
| 91 |
Please set a suitable platform in |
| 92 |
:cylc:conf:`flow.cylc[runtime][<namespace>]platform` instead. |
| 93 |
:ref:`See the migration guide <MajorChangesPlatforms>`. |
| 94 |
''' |
| 95 |
|
| 96 |
CYCLE_POINT_CONSTRAINTS = ''' |
| 97 |
Rules to allow only certain {0} datetime cycle points. |
| 98 |
|
| 99 |
.. admonition:: Use Case |
| 100 |
|
| 101 |
Writing a workflow where users may change the {0} |
| 102 |
cycle point, but where only some {0} cycle points are |
| 103 |
reasonable. |
| 104 |
|
| 105 |
Set by defining a list of truncated time points, which |
| 106 |
the {0} cycle point must match. |
| 107 |
|
| 108 |
Examples: |
| 109 |
|
| 110 |
- ``T00, T06, T12, T18`` - only at 6 hourly intervals. |
| 111 |
- ``T-30`` - only at half-past an hour. |
| 112 |
- ``01T00`` - only at midnight on the first day of a month. |
| 113 |
|
| 114 |
.. seealso:: |
| 115 |
|
| 116 |
:ref:`Recurrence tutorial <tutorial-inferred-recurrence>`. |
| 117 |
''' |
| 118 |
|
| 119 |
|
| 120 |
def global_default(text: str, config_path: str) -> str: |
| 121 |
"""Insert a link to this config item's global counterpart after the first |
| 122 |
paragraph of the description text. Also dedents. |
| 123 |
""" |
| 124 |
first, sep, rest = dedent(text).partition('\n\n') |
| 125 |
return ( |
| 126 |
f"{first}\n\n" |
| 127 |
"The default value is set in the global config: " |
| 128 |
f":cylc:conf:`global.cylc{config_path}`." |
| 129 |
f"{sep}{rest}" |
| 130 |
) |
| 131 |
|
| 132 |
|
| 133 |
def get_script_common_text(this: str, example: Optional[str] = None): |
| 134 |
text = dedent(''' |
| 135 |
|
| 136 |
See also :ref:`JobScripts`. |
| 137 |
|
| 138 |
Other user-defined script items: |
| 139 |
|
| 140 |
''') |
| 141 |
for item in ( |
| 142 |
'init-script', 'env-script', 'pre-script', 'script', 'post-script', |
| 143 |
'err-script', 'exit-script' |
| 144 |
): |
| 145 |
if item != this: |
| 146 |
text += f"* :cylc:conf:`[..]{item}`\n" |
| 147 |
text += dedent(f''' |
| 148 |
|
| 149 |
Example:: |
| 150 |
|
| 151 |
{example if example else 'echo "Hello World"'} |
| 152 |
''') |
| 153 |
return text |
| 154 |
|
| 155 |
|
| 156 |
with Conf( |
| 157 |
'flow.cylc', |
| 158 |
desc=''' |
| 159 |
Defines a Cylc workflow configuration. |
| 160 |
|
| 161 |
After processing any embedded templating code |
| 162 |
(see :ref:`Jinja`) the resultant raw flow.cylc file |
| 163 |
must be valid. See also :ref:`FlowConfigFile` for a descriptive |
| 164 |
overview of flow.cylc files, including syntax (:ref:`Syntax`). |
| 165 |
|
| 166 |
.. versionchanged:: 8.0.0 |
| 167 |
|
| 168 |
The configuration file was previously named ``suite.rc``, but that |
| 169 |
name is now deprecated. |
| 170 |
The ``suite.rc`` file name now activates :ref:`cylc_7_compat_mode`. |
| 171 |
Rename to ``flow.cylc`` to turn off compatibility mode. |
| 172 |
''' |
| 173 |
) as SPEC: |
| 174 |
|
| 175 |
with Conf('meta', desc=''' |
| 176 |
Metadata for this workflow. |
| 177 |
|
| 178 |
Cylc defines and uses |
| 179 |
the terms "title", "description" and "URL". |
| 180 |
Users can define more terms, and use these in event handlers. |
| 181 |
|
| 182 |
Example:: |
| 183 |
|
| 184 |
A user could define "workflow-priority". An event handler |
| 185 |
would then respond to failure events in a way set by |
| 186 |
"workflow-priority". |
| 187 |
'''): |
| 188 |
Conf('description', VDR.V_STRING, '', desc=''' |
| 189 |
A multi-line description of the workflow. |
| 190 |
|
| 191 |
It can be retrieved at run time with the ``cylc show`` command. |
| 192 |
''') |
| 193 |
Conf('title', VDR.V_STRING, '', desc=''' |
| 194 |
A single line description of the workflow. |
| 195 |
|
| 196 |
It can be retrieved at run time with the ``cylc show`` command. |
| 197 |
''') |
| 198 |
Conf('URL', VDR.V_STRING, '', desc=''' |
| 199 |
A web URL to workflow documentation. |
| 200 |
|
| 201 |
The URL can be retrieved at run time with the ``cylc show`` |
| 202 |
command. |
| 203 |
|
| 204 |
The template variable ``%(workflow)s`` will be replaced with the |
| 205 |
actual workflow ID. |
| 206 |
|
| 207 |
.. deprecated:: 8.0.0 |
| 208 |
|
| 209 |
The ``%(suite_name)s`` template variable is deprecated, please |
| 210 |
use ``%(workflow)s``. |
| 211 |
|
| 212 |
.. seealso:: |
| 213 |
|
| 214 |
:cylc:conf:`flow.cylc[runtime][<namespace>][meta]URL`. |
| 215 |
|
| 216 |
Example: |
| 217 |
|
| 218 |
``http://my-site.com/workflows/%(workflow)s/index.html`` |
| 219 |
|
| 220 |
''') |
| 221 |
Conf('<custom metadata>', VDR.V_STRING, '', desc=''' |
| 222 |
Any user-defined metadata item. |
| 223 |
|
| 224 |
Like title, description and URL these can be |
| 225 |
passed to workflow event handlers to be interpreted according to |
| 226 |
your needs. |
| 227 |
|
| 228 |
For example, a user could define an item called |
| 229 |
"workflow-priority". An event handler could then respond to |
| 230 |
failure events in a way set by "workflow-priority". |
| 231 |
''') |
| 232 |
with Conf('scheduler', desc=( |
| 233 |
global_default(SCHEDULER_DESCR, "[scheduler]") |
| 234 |
)): |
| 235 |
Conf('UTC mode', VDR.V_BOOLEAN, desc=( |
| 236 |
global_default(UTC_MODE_DESCR, "[scheduler]UTC mode") |
| 237 |
)) |
| 238 |
|
| 239 |
Conf('allow implicit tasks', VDR.V_BOOLEAN, default=False, desc=''' |
| 240 |
Allow tasks in the graph that are not defined in |
| 241 |
:cylc:conf:`flow.cylc[runtime]`. |
| 242 |
|
| 243 |
:term:`Implicit tasks <implicit task>` are tasks without explicit |
| 244 |
definitions in :cylc:conf:`flow.cylc[runtime]`. By default, |
| 245 |
these are not allowed, as they are often typos. However, |
| 246 |
this setting can be set to ``True`` to allow implicit tasks. |
| 247 |
It is recommended to only set this to ``True`` if required during |
| 248 |
development/prototyping of a workflow graph, but set it to |
| 249 |
``False`` after finishing the :cylc:conf:`flow.cylc[runtime]` |
| 250 |
section. |
| 251 |
|
| 252 |
.. admonition:: Cylc 7 compatibility mode |
| 253 |
|
| 254 |
In :ref:`Cylc_7_compat_mode`, implicit tasks are still |
| 255 |
allowed unless you explicitly set this to ``False``, or |
| 256 |
unless a ``rose-suite.conf`` file is present (to maintain |
| 257 |
backward compatibility with Rose 2019). |
| 258 |
|
| 259 |
.. versionadded:: 8.0.0 |
| 260 |
''') |
| 261 |
|
| 262 |
Conf('install', VDR.V_STRING_LIST, desc=''' |
| 263 |
Configure custom directories and files to be installed on remote |
| 264 |
hosts. |
| 265 |
|
| 266 |
.. note:: |
| 267 |
|
| 268 |
The following directories already get installed by default: |
| 269 |
|
| 270 |
``ana/`` |
| 271 |
Rose ana analysis modules |
| 272 |
``app/`` |
| 273 |
Rose applications |
| 274 |
``bin/`` |
| 275 |
Cylc bin directory (added to ``PATH``) |
| 276 |
``etc/`` |
| 277 |
Miscellaneous resources |
| 278 |
``lib/`` |
| 279 |
Cylc lib directory (``lib/python`` added to ``PYTHONPATH`` |
| 280 |
for workflow config) |
| 281 |
|
| 282 |
These should be located in the top level of your Cylc workflow, |
| 283 |
i.e. the directory that contains your ``flow.cylc`` file. |
| 284 |
|
| 285 |
Directories must have a trailing slash. |
| 286 |
For example, to add the following items to your file installation: |
| 287 |
|
| 288 |
.. code-block:: none |
| 289 |
|
| 290 |
~/cylc-run/workflow_x |
| 291 |
|-- dir1/ |
| 292 |
|-- dir2/ |
| 293 |
|-- file1 |
| 294 |
`-- file2 |
| 295 |
|
| 296 |
.. code-block:: cylc |
| 297 |
|
| 298 |
[scheduler] |
| 299 |
install = dir/, dir2/, file1, file2 |
| 300 |
|
| 301 |
.. versionadded:: 8.0.0 |
| 302 |
''') |
| 303 |
|
| 304 |
Conf('cycle point format', VDR.V_CYCLE_POINT_FORMAT, desc=''' |
| 305 |
Set the datetime format and precision that Cylc uses for |
| 306 |
:term:`cycle points<cycle point>` in :term:`datetime cycling` |
| 307 |
workflows. |
| 308 |
|
| 309 |
.. seealso:: |
| 310 |
|
| 311 |
* To alter the time zone used in the datetime cycle point |
| 312 |
format, see |
| 313 |
:cylc:conf:`flow.cylc[scheduler]cycle point time zone`. |
| 314 |
* To alter the number of expanded year digits (for years |
| 315 |
below 0 or above 9999), see |
| 316 |
:cylc:conf:`flow.cylc |
| 317 |
[scheduler]cycle point num expanded year digits`. |
| 318 |
|
| 319 |
By default, Cylc uses a ``CCYYMMDDThhmmZ`` (``Z`` in the special |
| 320 |
case of UTC) or ``CCYYMMDDThhmm±hhmm`` format for writing |
| 321 |
datetime cycle points, following the :term:`ISO 8601` standard. |
| 322 |
|
| 323 |
You may use the `isodatetime library's syntax |
| 324 |
<https://github.com/metomi/isodatetime#dates-and-times>`_ to set |
| 325 |
the cycle point format. |
| 326 |
|
| 327 |
You can also use a subset of the strptime/strftime POSIX |
| 328 |
standard - supported tokens are ``%F``, ``%H``, ``%M``, ``%S``, |
| 329 |
``%Y``, ``%d``, ``%j``, ``%m``, ``%s``, ``%z``. |
| 330 |
|
| 331 |
If specifying a format here, we recommend including a time zone - |
| 332 |
this will be used for displaying cycle points only. To avoid |
| 333 |
confusion, we recommend using the same time zone as |
| 334 |
:cylc:conf:`flow.cylc[scheduler]cycle point time zone`. |
| 335 |
|
| 336 |
The ISO 8601 *extended* datetime format (``CCYY-MM-DDThh:mm``) |
| 337 |
cannot be used, as cycle points are used in job-log and work |
| 338 |
directory paths where the ":" character is invalid. |
| 339 |
|
| 340 |
.. warning:: |
| 341 |
|
| 342 |
The smallest unit included in the format sets the precision |
| 343 |
of cycle points in the workflow. |
| 344 |
If the precision is lower than the smallest unit |
| 345 |
in a graph recurrence, the workflow will fail. |
| 346 |
For example, if you set a format of ``CCYY``, and have a |
| 347 |
recurrence ``R/2000/P8M``, then both the first and second |
| 348 |
cycle points will be ``2000``, which is invalid. |
| 349 |
''') |
| 350 |
Conf('cycle point num expanded year digits', VDR.V_INTEGER, 0, desc=''' |
| 351 |
Enable negative years or years more than four digits long. |
| 352 |
|
| 353 |
For years below 0 or above 9999, the ISO 8601 standard specifies |
| 354 |
that an extra number of year digits and a sign should be used. |
| 355 |
This extra number needs to be written down somewhere (here). |
| 356 |
|
| 357 |
For example, if this extra number is set to 2, 00Z on the 1st of |
| 358 |
January in the year 10040 will be represented as |
| 359 |
``+0100400101T0000Z`` (2 extra year digits used). With this number |
| 360 |
set to 3, 06Z on the 4th of May 1985 would be written as |
| 361 |
``+00019850504T0600Z``. |
| 362 |
|
| 363 |
This number defaults to 0 (no sign or extra digits used). |
| 364 |
''') |
| 365 |
Conf('cycle point time zone', VDR.V_CYCLE_POINT_TIME_ZONE, desc=''' |
| 366 |
Time zone to be used for datetime cycle points if not otherwise |
| 367 |
specified. |
| 368 |
|
| 369 |
This time zone will be used for |
| 370 |
datetime cycle point dumping and inferring the time zone of cycle |
| 371 |
points that are input without time zones. |
| 372 |
|
| 373 |
Time zones should be expressed as :term:`ISO8601` time zone offsets |
| 374 |
from UTC, such as ``+13``, ``+1300``, ``-0500`` or ``+0645``, |
| 375 |
with ``Z`` representing the special case of ``+0000`` (UTC). |
| 376 |
Cycle points will be converted to the time zone you give and will |
| 377 |
be represented with this string at the end. |
| 378 |
|
| 379 |
If not set, it will default to UTC (``Z``). |
| 380 |
|
| 381 |
.. admonition:: Cylc 7 compatibility mode |
| 382 |
|
| 383 |
In :ref:`Cylc_7_compat_mode`, it will default to the |
| 384 |
local/system time zone, rather than UTC. |
| 385 |
|
| 386 |
The time zone will persist over reloads/restarts following any |
| 387 |
local time zone changes (e.g. if the |
| 388 |
workflow is run during winter time, then stopped, then restarted |
| 389 |
after summer time has begun, the cycle points will remain |
| 390 |
in winter time). Changing this setting after the workflow has |
| 391 |
first started will have no effect. |
| 392 |
|
| 393 |
If you use a custom |
| 394 |
:cylc:conf:`flow.cylc[scheduler]cycle point format`, it is a good |
| 395 |
idea to set the same time zone here. If you specify a different |
| 396 |
one here, it will only be used for inferring timezone-less cycle |
| 397 |
points; cycle points will be displayed in the time zone from the |
| 398 |
cycle point format. |
| 399 |
|
| 400 |
.. caution:: |
| 401 |
|
| 402 |
It is not recommended to write the time zone with a ":" |
| 403 |
(e.g. ``+05:30``), given that the time zone is used as part of |
| 404 |
task output filenames. |
| 405 |
|
| 406 |
.. seealso:: |
| 407 |
|
| 408 |
:cylc:conf:`flow.cylc[scheduler]UTC mode` |
| 409 |
|
| 410 |
.. versionchanged:: 7.8.9/7.9.4 |
| 411 |
|
| 412 |
The value set here now persists over reloads/restarts after a |
| 413 |
system time zone change. |
| 414 |
|
| 415 |
.. versionchanged:: 8.0.0 |
| 416 |
|
| 417 |
The default time zone is now ``Z`` instead of the local time of |
| 418 |
the first workflow start. |
| 419 |
''') |
| 420 |
with Conf('experimental', desc=''' |
| 421 |
Activate experimental features. |
| 422 |
|
| 423 |
These are preview features which will become the default in future |
| 424 |
releases. |
| 425 |
|
| 426 |
.. versionadded:: 8.6.0 |
| 427 |
'''): |
| 428 |
Conf('all', VDR.V_BOOLEAN, False, desc=''' |
| 429 |
Activate all experimental features. |
| 430 |
|
| 431 |
Encouraged for canary testing. |
| 432 |
|
| 433 |
.. versionadded:: 8.6.0 |
| 434 |
''') |
| 435 |
Conf('expire triggers', VDR.V_BOOLEAN, False, desc=''' |
| 436 |
This reimplements "suicide triggers" as "expire triggers". |
| 437 |
|
| 438 |
* When the condition is met, the task will generate the |
| 439 |
``expired`` output rather than just being removed. |
| 440 |
* The ``expired`` output will be marked as |
| 441 |
:term:`optional <optional output>` for the triggered task, |
| 442 |
but a custom |
| 443 |
`flow.cylc[runtime][<namespace>]completion` condition |
| 444 |
will need to be modified accordingly. |
| 445 |
* This should be functionally equivalent to "suicide triggers" |
| 446 |
in that the triggered task will not run. |
| 447 |
* However, the triggered task will now be left in the |
| 448 |
``expired`` state making it clearer in the GUI/logs that |
| 449 |
the task has been triggered in this way. |
| 450 |
* It is possible to trigger other tasks off of this ``expired`` |
| 451 |
output for more advanced failure recovery. |
| 452 |
|
| 453 |
.. versionadded:: 8.6.0 |
| 454 |
''') |
| 455 |
|
| 456 |
with Conf( # noqa: SIM117 (keep same format) |
| 457 |
'main loop', |
| 458 |
desc=global_default(MAIN_LOOP_DESCR, "[scheduler][main loop]") |
| 459 |
): |
| 460 |
with Conf('<plugin name>', desc=( |
| 461 |
global_default( |
| 462 |
MAIN_LOOP_PLUGIN_DESCR, |
| 463 |
"[scheduler][main loop][<plugin name>]" |
| 464 |
) |
| 465 |
)): |
| 466 |
Conf('interval', VDR.V_INTERVAL, desc=( |
| 467 |
global_default( |
| 468 |
MAIN_LOOP_PLUGIN_INTERVAL_DESCR, |
| 469 |
"[scheduler][main loop][<plugin name>]interval" |
| 470 |
) |
| 471 |
)) |
| 472 |
|
| 473 |
with Conf( |
| 474 |
'events', desc=global_default(EVENTS_DESCR, '[scheduler][events]') |
| 475 |
): |
| 476 |
for item, val in EVENTS_SETTINGS.items(): |
| 477 |
if isinstance(val, dict): |
| 478 |
val = val.copy() |
| 479 |
desc: str = val.pop('desc') |
| 480 |
else: |
| 481 |
desc = val |
| 482 |
val = {} |
| 483 |
desc = global_default(desc, f"[scheduler][events]{item}") |
| 484 |
vdr_type = VDR.V_STRING_LIST |
| 485 |
default: Any = Conf.UNSET |
| 486 |
if item in {'handlers', 'handler events', 'mail events'}: |
| 487 |
# Note: default of None for V_STRING_LIST is used to |
| 488 |
# differentiate between not set vs set to empty |
| 489 |
default = None |
| 490 |
elif item.endswith("handlers"): |
| 491 |
desc = desc + '\n\n' + dedent(f''' |
| 492 |
.. rubric:: Examples: |
| 493 |
|
| 494 |
.. code-block:: cylc |
| 495 |
|
| 496 |
# configure a single event handler |
| 497 |
{item} = echo foo |
| 498 |
|
| 499 |
# provide context to the handler |
| 500 |
{item} = echo %(workflow)s |
| 501 |
|
| 502 |
# configure multiple event handlers |
| 503 |
# (which will run in parallel) |
| 504 |
{item} = \\ |
| 505 |
'echo %(workflow)s %(event)s', \\ |
| 506 |
'my_exe %(event)s %(message)s', \\ |
| 507 |
'curl -X PUT -d event=%(event)s host:port' |
| 508 |
''') |
| 509 |
elif item.startswith("abort on"): |
| 510 |
vdr_type = VDR.V_BOOLEAN |
| 511 |
elif item.endswith("timeout"): |
| 512 |
vdr_type = VDR.V_INTERVAL |
| 513 |
Conf(item, vdr_type, default, desc=desc, **val) |
| 514 |
|
| 515 |
Conf('expected task failures', VDR.V_STRING_LIST, desc=''' |
| 516 |
(For Cylc developers writing a functional tests only) |
| 517 |
List of tasks that are expected to fail in the test. |
| 518 |
''') |
| 519 |
|
| 520 |
with Conf('mail', desc=( |
| 521 |
global_default(MAIL_DESCR, "[scheduler][mail]") |
| 522 |
)): |
| 523 |
Conf('footer', VDR.V_STRING, desc=( |
| 524 |
global_default(MAIL_FOOTER_DESCR, "[scheduler][mail]footer") |
| 525 |
)) |
| 526 |
Conf('to', VDR.V_STRING, desc=( |
| 527 |
global_default(MAIL_TO_DESCR, "[scheduler][mail]to") |
| 528 |
)) |
| 529 |
Conf('from', VDR.V_STRING, desc=( |
| 530 |
global_default(MAIL_FROM_DESCR, "[scheduler][mail]from") |
| 531 |
)) |
| 532 |
Conf('task event batch interval', VDR.V_INTERVAL, desc=( |
| 533 |
global_default( |
| 534 |
MAIL_INTERVAL_DESCR, |
| 535 |
"[scheduler][mail]task event batch interval" |
| 536 |
) |
| 537 |
)) |
| 538 |
|
| 539 |
with Conf('task parameters', desc=f''' |
| 540 |
Set task parameters and parameter templates. |
| 541 |
|
| 542 |
Define parameter values here for use in expanding |
| 543 |
:ref:`parameterized tasks <User Guide Param>`. |
| 544 |
|
| 545 |
.. versionchanged:: 8.0.0 |
| 546 |
|
| 547 |
{REPLACES}``[cylc][parameters]``. |
| 548 |
'''): |
| 549 |
Conf('<parameter>', VDR.V_PARAMETER_LIST, desc=''' |
| 550 |
A custom parameter to use in a workflow. |
| 551 |
|
| 552 |
.. rubric:: Examples: |
| 553 |
|
| 554 |
- ``run = control, test1, test2`` |
| 555 |
- ``mem = 1..5`` (equivalent to ``1, 2, 3, 4, 5``). |
| 556 |
- ``mem = -11..-7..2`` (equivalent to ``-11, -9, -7``). |
| 557 |
''') |
| 558 |
with Conf('templates', desc=f''' |
| 559 |
Cylc will expand each parameterized task name using a string |
| 560 |
template. |
| 561 |
|
| 562 |
You can set templates for any parameter name here to override the |
| 563 |
default template. |
| 564 |
|
| 565 |
.. versionchanged:: 8.0.0 |
| 566 |
|
| 567 |
{REPLACES}``[cylc][parameter templates]``. |
| 568 |
'''): |
| 569 |
Conf('<parameter>', VDR.V_STRING, desc=''' |
| 570 |
A template for a parameter. |
| 571 |
|
| 572 |
For example: |
| 573 |
|
| 574 |
If you set: |
| 575 |
|
| 576 |
.. code-block:: cylc |
| 577 |
|
| 578 |
[task parameters] |
| 579 |
myparameter = 1..3 |
| 580 |
[[templates]] |
| 581 |
myparameter = _run_%(myparameter)s |
| 582 |
|
| 583 |
task name ``foo<myparameter>`` becomes ``foo_run_3`` for |
| 584 |
``run == 3``. |
| 585 |
|
| 586 |
.. note:: |
| 587 |
|
| 588 |
The default parameter templates are: |
| 589 |
|
| 590 |
For integer parameters: |
| 591 |
``_p%(p)0Nd`` |
| 592 |
where ``N`` is the number of digits of the maximum |
| 593 |
integer value, i.e. If the largest parameter value is |
| 594 |
3142 then N = 4. |
| 595 |
|
| 596 |
Default for non-integer parameters: |
| 597 |
``_%(p)s`` e.g. ``foo<run>`` becomes ``foo_top`` for |
| 598 |
``run`` value ``top``. |
| 599 |
''') |
| 600 |
|
| 601 |
with Conf('scheduling', desc=''' |
| 602 |
This section allows Cylc to determine when tasks are ready to run. |
| 603 |
|
| 604 |
Any cycle points defined here without a time zone will use the |
| 605 |
time zone from |
| 606 |
:cylc:conf:`flow.cylc[scheduler]cycle point time zone`. |
| 607 |
'''): |
| 608 |
Conf('initial cycle point', VDR.V_CYCLE_POINT, desc=''' |
| 609 |
The earliest cycle point at which any task can run. |
| 610 |
|
| 611 |
In a cold start each cycling task (unless specifically excluded |
| 612 |
under :cylc:conf:`[..][special tasks]`) will be loaded into the |
| 613 |
workflow with this cycle point, or with the closest subsequent |
| 614 |
valid cycle point for the task. |
| 615 |
|
| 616 |
In integer cycling, the default is ``1``. |
| 617 |
|
| 618 |
The string ``now`` converts to the current datetime on the workflow |
| 619 |
host when first starting the workflow (with precision determined |
| 620 |
by :cylc:conf:`flow.cylc[scheduler]cycle point format`). |
| 621 |
|
| 622 |
For more information on setting the initial cycle point relative |
| 623 |
to the current time see :ref:`setting-the-icp-relative-to-now`. |
| 624 |
|
| 625 |
This item can be overridden on the command line using |
| 626 |
``cylc play --initial-cycle-point`` or ``--icp``. |
| 627 |
|
| 628 |
.. rubric:: Examples: |
| 629 |
|
| 630 |
``2000-01-01T00:00Z`` |
| 631 |
The 1st of January at midnight. |
| 632 |
``2000`` |
| 633 |
Shorthand for ``2000-01-01T00:00``. |
| 634 |
``now`` |
| 635 |
The exact time when the workflow is started. By default this is |
| 636 |
to the minute, e.g: ``2001-02-03T12:34``. |
| 637 |
``previous(T-00)`` |
| 638 |
The hour when the workflow was started. I.e, The time when the |
| 639 |
workflow is started with the minute cut off. |
| 640 |
``previous(T00)`` |
| 641 |
The day when the workflow was started. I.e, the time when the |
| 642 |
workflow was started with the hour and minute cut off. |
| 643 |
``next(T00)`` |
| 644 |
The day after the workflow was started (at midnight). |
| 645 |
''') |
| 646 |
# NOTE: final cycle point is not a V_CYCLE_POINT to allow expressions |
| 647 |
# such as '+P1Y' (relative to initial cycle point) |
| 648 |
Conf('final cycle point', VDR.V_CYCLE_POINT_WITH_OFFSETS, desc=''' |
| 649 |
The (optional) last cycle point at which tasks are run. |
| 650 |
|
| 651 |
Once all tasks have reached this cycle point, the |
| 652 |
workflow will shut down. |
| 653 |
|
| 654 |
This item can be overridden on the command line using |
| 655 |
``cylc play --final-cycle-point`` or ``--fcp``. |
| 656 |
|
| 657 |
.. rubric:: Examples: |
| 658 |
|
| 659 |
``2000-01-01T00:00Z`` |
| 660 |
The 1st of January at midnight. |
| 661 |
``2000`` |
| 662 |
Shorthand for ``2000-01-01T00:00``. |
| 663 |
``+P1D`` |
| 664 |
The initial cycle point plus one day. |
| 665 |
``2000 +P1D +P1Y`` |
| 666 |
The year ``2000`` plus one day and one year. |
| 667 |
''') |
| 668 |
Conf('initial cycle point constraints', VDR.V_STRING_LIST, |
| 669 |
desc=CYCLE_POINT_CONSTRAINTS.format('initial') + dedent(''' |
| 670 |
|
| 671 |
.. note:: |
| 672 |
|
| 673 |
This setting does not coerce :cylc:conf:`[..] |
| 674 |
initial cycle point = now`. |
| 675 |
''')) |
| 676 |
Conf('final cycle point constraints', VDR.V_STRING_LIST, |
| 677 |
desc=CYCLE_POINT_CONSTRAINTS.format('final')) |
| 678 |
Conf('hold after cycle point', VDR.V_CYCLE_POINT, desc=f''' |
| 679 |
Hold all tasks that pass this cycle point. |
| 680 |
|
| 681 |
Unlike the final |
| 682 |
cycle point, the workflow does not shut down once all tasks have |
| 683 |
passed this point. If this item is set you can override it on the |
| 684 |
command line using ``--hold-after``. |
| 685 |
|
| 686 |
.. versionchanged:: 8.0.0 |
| 687 |
|
| 688 |
{REPLACES}``[scheduling]hold after point``. |
| 689 |
''') |
| 690 |
Conf('stop after cycle point', VDR.V_CYCLE_POINT_WITH_OFFSETS, desc=''' |
| 691 |
Shut down the workflow after all tasks pass this cycle point. |
| 692 |
|
| 693 |
The stop cycle point can be overridden on the command line using |
| 694 |
``cylc play --stop-cycle-point=POINT`` |
| 695 |
|
| 696 |
.. note:: |
| 697 |
|
| 698 |
Not to be confused with :cylc:conf:`[..]final cycle point`: |
| 699 |
There can be more graph beyond this point, but you are |
| 700 |
choosing not to run that part of the graph. You can play |
| 701 |
the workflow and continue. |
| 702 |
|
| 703 |
.. rubric:: Examples: |
| 704 |
|
| 705 |
- ``2000`` - Shorthand for ``2000-01-01T00:00``. |
| 706 |
- ``+P1D`` - The initial cycle point plus one day. |
| 707 |
- ``2000 +P1D +P1Y`` - The year ``2000`` plus one day and one year. |
| 708 |
|
| 709 |
.. versionadded:: 8.0.0 |
| 710 |
|
| 711 |
.. versionchanged:: 8.3.0 |
| 712 |
|
| 713 |
This now supports offsets (e.g. ``+P1D``) in the same way the |
| 714 |
:cylc:conf:`[..]final cycle point` does. |
| 715 |
''') |
| 716 |
Conf('cycling mode', VDR.V_STRING, Calendar.MODE_GREGORIAN, |
| 717 |
options=list(Calendar.MODES) + ['integer'], desc=''' |
| 718 |
Choice of :term:`integer cycling` or one of several |
| 719 |
:term:`datetime cycling` calendars. |
| 720 |
|
| 721 |
Cylc runs workflows using the proleptic Gregorian calendar |
| 722 |
by default. This setting allows you to instead choose |
| 723 |
integer cycling, or one of the other supported non-Gregorian |
| 724 |
datetime calendars: 360 day (12 months of 30 days in a year), |
| 725 |
365 day (never a leap year) and 366 day (always a leap year). |
| 726 |
''') |
| 727 |
Conf('runahead limit', VDR.V_STRING, 'P4', desc=''' |
| 728 |
The runahead limit prevents a workflow from getting too far ahead |
| 729 |
of the oldest :term:`active cycle`. |
| 730 |
|
| 731 |
A cycle is considered to be active if it contains any |
| 732 |
:term:`active tasks <active task>`. |
| 733 |
|
| 734 |
An integer interval value of ``Pn`` allows up to ``n+1`` cycles |
| 735 |
to be active at once. |
| 736 |
|
| 737 |
The default runahead limit is ``P4``, which means there may be up |
| 738 |
to 5 active cycles. |
| 739 |
|
| 740 |
Datetime cycling workflows can optionally use a datetime interval |
| 741 |
value instead, in which case the number of cycles |
| 742 |
within the interval depends on the cycling intervals present. |
| 743 |
|
| 744 |
.. rubric:: Examples: |
| 745 |
|
| 746 |
``P0`` |
| 747 |
Only one cycle can be active at a time. |
| 748 |
``P2`` |
| 749 |
Allow up to two cycles ahead of the oldest active cycle. |
| 750 |
``P3D`` |
| 751 |
Allow cycles up to three days ahead of the oldest active cycle. |
| 752 |
|
| 753 |
.. seealso:: |
| 754 |
|
| 755 |
:ref:`RunaheadLimit` |
| 756 |
|
| 757 |
.. versionchanged:: 8.0.0 |
| 758 |
|
| 759 |
The integer format ``Pn`` was introduced to replace the |
| 760 |
deprecated ``[scheduling]max active cycle points = m`` |
| 761 |
(with ``n = m-1``) and unify it with the existing datetime |
| 762 |
interval ``runahead limit`` setting. |
| 763 |
''') |
| 764 |
|
| 765 |
with Conf('queues', desc=''' |
| 766 |
Internal task queues to limit job activity. |
| 767 |
|
| 768 |
Queues delay job submission in member tasks, until the active |
| 769 |
job count (for members) drops below the queue limit. |
| 770 |
|
| 771 |
There is a ``default`` queue with a configurable limit of 100, for |
| 772 |
all tasks that are not assigned to other queues. |
| 773 |
|
| 774 |
You can define custom queues to limit job activity across other |
| 775 |
groups of tasks. |
| 776 |
|
| 777 |
.. code-block:: cylc |
| 778 |
|
| 779 |
[[queues]] |
| 780 |
[[[my_queue]]] |
| 781 |
limit = 2 |
| 782 |
members = task1, task2, FAMILY1 |
| 783 |
|
| 784 |
.. seealso:: |
| 785 |
|
| 786 |
:ref:`InternalQueues`. |
| 787 |
'''): |
| 788 |
with Conf('<queue name>', desc=''' |
| 789 |
Section for configuring a single queue. |
| 790 |
''') as Queue: |
| 791 |
Conf('limit', VDR.V_INTEGER, 0, desc=''' |
| 792 |
The active job limit for this queue. 0 means no limit. |
| 793 |
''') |
| 794 |
Conf('members', VDR.V_SPACELESS_STRING_LIST, desc=''' |
| 795 |
A list of task or family names to assign to this queue. |
| 796 |
''') |
| 797 |
with Conf('default', meta=Queue, desc=''' |
| 798 |
The default queue, for all tasks not assigned to other queues. |
| 799 |
'''): |
| 800 |
Conf('limit', VDR.V_INTEGER, 100, desc=''' |
| 801 |
The job limit for the ``default`` queue. 0 means no limit. |
| 802 |
''') |
| 803 |
|
| 804 |
with Conf('special tasks', desc=''' |
| 805 |
This section is used to identify tasks with special behaviour. |
| 806 |
|
| 807 |
Family names can be used in special task lists as shorthand for |
| 808 |
listing all member tasks. |
| 809 |
'''): |
| 810 |
Conf('clock-trigger', VDR.V_STRING_LIST, desc=''' |
| 811 |
Legacy clock trigger definitions. |
| 812 |
|
| 813 |
.. deprecated:: 8.0.0 |
| 814 |
|
| 815 |
These are now auto-upgraded to the newer wall_clock xtriggers |
| 816 |
(see :ref:`Section External Triggers`). The old way defining |
| 817 |
clock-triggers will be removed in an upcoming Cylc version. |
| 818 |
|
| 819 |
Clock-triggered tasks (see :ref:`ClockTriggerTasks`) wait on a wall |
| 820 |
clock time specified as an offset from their own cycle point. |
| 821 |
|
| 822 |
Example: |
| 823 |
|
| 824 |
``foo(PT1H30M), bar(PT1.5H), baz`` |
| 825 |
''') |
| 826 |
Conf('external-trigger', VDR.V_STRING_LIST, desc=''' |
| 827 |
Legacy external trigger definition section. |
| 828 |
|
| 829 |
.. deprecated:: 8.0.0 |
| 830 |
|
| 831 |
Please read :ref:`Section External Triggers` before |
| 832 |
using the older mechanism described in this section. |
| 833 |
|
| 834 |
Externally triggered tasks (see :ref:`Old-Style External |
| 835 |
Triggers`) wait on external events reported via the |
| 836 |
``cylc ext-trigger`` command. To constrain triggers to a |
| 837 |
specific cycle point, include ``$CYLC_TASK_CYCLE_POINT`` |
| 838 |
in the trigger message string and pass the cycle point to the |
| 839 |
``cylc ext-trigger`` command. |
| 840 |
''') |
| 841 |
Conf('clock-expire', VDR.V_STRING_LIST, desc=''' |
| 842 |
Don't submit jobs if they are too late in wall clock time. |
| 843 |
|
| 844 |
Clock-expire tasks enter the ``expired`` state and skip job |
| 845 |
submission if too far behind the wall clock when they become |
| 846 |
ready to run. |
| 847 |
|
| 848 |
The expiry time is specified as an offset from the task's |
| 849 |
cycle point. The offset: |
| 850 |
|
| 851 |
* May be positive or negative |
| 852 |
* May be omitted if it is zero |
| 853 |
|
| 854 |
.. seealso:: |
| 855 |
|
| 856 |
:ref:`ClockExpireTasks`. |
| 857 |
|
| 858 |
.. rubric:: Examples: |
| 859 |
|
| 860 |
``foo(PT1H)`` - expire task ``foo`` if the current wall clock |
| 861 |
time has reached 1 hour after the task's cycle point. |
| 862 |
|
| 863 |
``bar(-PT5M)`` - expire task ``bar`` if the current wall clock |
| 864 |
time has reached 5 minutes *before* the task's cycle point. |
| 865 |
''') |
| 866 |
Conf('sequential', VDR.V_STRING_LIST, desc=''' |
| 867 |
A list of tasks which automatically depend on their own |
| 868 |
previous-cycle instance. |
| 869 |
|
| 870 |
.. tip:: |
| 871 |
|
| 872 |
Recommend best practice is now to use explicit inter-cycle |
| 873 |
triggers rather than sequential tasks. |
| 874 |
|
| 875 |
.. seealso:: |
| 876 |
|
| 877 |
:ref:`SequentialTasks`. |
| 878 |
''') |
| 879 |
|
| 880 |
Conf('sequential xtriggers', VDR.V_BOOLEAN, False, |
| 881 |
desc=''' |
| 882 |
If ``True``, tasks that only depend on xtriggers will not spawn |
| 883 |
until the xtrigger of previous (cycle point) instance is satisfied. |
| 884 |
Otherwise, they will all spawn at once out to the runahead limit. |
| 885 |
|
| 886 |
This setting can be overridden by the reserved keyword argument |
| 887 |
``sequential`` in individual xtrigger declarations. |
| 888 |
|
| 889 |
One sequential xtrigger on a parentless task with multiple |
| 890 |
xtriggers will cause sequential spawning. |
| 891 |
|
| 892 |
.. versionadded:: 8.3.0 |
| 893 |
''') |
| 894 |
with Conf('xtriggers', desc=''' |
| 895 |
This section is for *External Trigger* function declarations - |
| 896 |
see :ref:`Section External Triggers`. |
| 897 |
'''): |
| 898 |
Conf('<xtrigger name>', VDR.V_XTRIGGER, desc=''' |
| 899 |
Any user-defined event trigger function declarations and |
| 900 |
corresponding labels for use in the graph. |
| 901 |
|
| 902 |
See :ref:`Section External Triggers` for details. |
| 903 |
|
| 904 |
Example:: |
| 905 |
|
| 906 |
``my_trigger(arg1, arg2, kwarg1, kwarg2):PT10S`` |
| 907 |
''') |
| 908 |
|
| 909 |
with Conf('graph', desc=f''' |
| 910 |
The workflow graph is defined under this section. |
| 911 |
|
| 912 |
You can plot the dependency graph as you work on it, with |
| 913 |
``cylc graph``. |
| 914 |
|
| 915 |
.. seealso:: |
| 916 |
|
| 917 |
:ref:`User Guide Scheduling`. |
| 918 |
|
| 919 |
.. versionchanged:: 8.0.0 |
| 920 |
|
| 921 |
{REPLACES}``[runtime][dependencies][graph]``. |
| 922 |
'''): |
| 923 |
Conf('<recurrence>', VDR.V_STRING, desc=f''' |
| 924 |
The recurrence defines the sequence of cycle points |
| 925 |
for which the dependency graph is valid. |
| 926 |
|
| 927 |
.. seealso:: |
| 928 |
|
| 929 |
:ref:`User Guide Scheduling` |
| 930 |
|
| 931 |
Cycle points should be specified in our ISO 8601 derived |
| 932 |
sequence syntax, or as integers, in integer cycling mode: |
| 933 |
|
| 934 |
Example Recurrences: |
| 935 |
|
| 936 |
datetime cycling: |
| 937 |
* ``R1`` - once at the initial cycle point |
| 938 |
* ``T00,T06,T12,T18`` - daily at 00:00, 06:00, 12:00 |
| 939 |
& 18:00 |
| 940 |
* ``PT6H`` - every six hours starting at the initial |
| 941 |
cycle point |
| 942 |
integer cycling: |
| 943 |
* ``R1`` - once at the initial cycle point |
| 944 |
* ``P2`` - every other cycle |
| 945 |
* ``P3,P5`` - every third or fifth cycle |
| 946 |
|
| 947 |
.. note:: |
| 948 |
|
| 949 |
Unlike other Cylc configurations duplicate recurrences |
| 950 |
are additive and do not override. |
| 951 |
|
| 952 |
For example this: |
| 953 |
|
| 954 |
.. code-block:: cylc |
| 955 |
|
| 956 |
[scheduling] |
| 957 |
[[graph]] |
| 958 |
R1 = a => b |
| 959 |
R1 = c => d |
| 960 |
|
| 961 |
Is equivalent to this: |
| 962 |
|
| 963 |
.. code-block:: cylc |
| 964 |
|
| 965 |
[scheduling] |
| 966 |
[[graph]] |
| 967 |
R1 = """ |
| 968 |
a => b |
| 969 |
c => d |
| 970 |
""" |
| 971 |
|
| 972 |
See :ref:`GraphTypes` for more on recurrence expressions, |
| 973 |
and how multiple graphs combine. |
| 974 |
|
| 975 |
The value should be a dependency graph the given recurrence. |
| 976 |
Syntax examples follow; see also :ref:`User Guide Scheduling` |
| 977 |
and :ref:`TriggerTypes`. |
| 978 |
|
| 979 |
Example Graph Strings: |
| 980 |
|
| 981 |
.. code-block:: cylc-graph |
| 982 |
|
| 983 |
# baz and waz both trigger off bar |
| 984 |
foo => bar => baz & waz |
| 985 |
|
| 986 |
# bar triggers off foo[-P1D-PT6H] |
| 987 |
foo[-P1D-PT6H] => bar |
| 988 |
|
| 989 |
# faz triggers off a message output of baz |
| 990 |
baz:out1 => faz |
| 991 |
|
| 992 |
# Y triggers if X starts executing |
| 993 |
X:start => Y |
| 994 |
|
| 995 |
# Y triggers if X fails |
| 996 |
X:fail => Y |
| 997 |
|
| 998 |
# bar triggers if foo[-PT6H] fails |
| 999 |
foo[-PT6H]:fail => bar |
| 1000 |
|
| 1001 |
# Y suicides if X succeeds |
| 1002 |
X => !Y |
| 1003 |
|
| 1004 |
# Z triggers if X succeeds or fails |
| 1005 |
X | X:fail => Z |
| 1006 |
|
| 1007 |
# Z triggers if X succeeds or fails |
| 1008 |
X:finish => Z |
| 1009 |
|
| 1010 |
# general conditional triggers |
| 1011 |
(A | B & C ) | D => foo |
| 1012 |
|
| 1013 |
# bar triggers if foo is successfully submitted |
| 1014 |
foo:submit => bar |
| 1015 |
|
| 1016 |
# bar triggers if submission of foo fails |
| 1017 |
foo:submit-fail => bar |
| 1018 |
|
| 1019 |
.. versionchanged:: 8.0.0 |
| 1020 |
|
| 1021 |
{REPLACES} |
| 1022 |
``[runtime][dependencies][graph][<recurrence>]graph``. |
| 1023 |
''') |
| 1024 |
|
| 1025 |
with Conf('runtime', # noqa: SIM117 (keep same format) |
| 1026 |
desc=''' |
| 1027 |
This section is used to specify settings for tasks to be run. |
| 1028 |
|
| 1029 |
You can specify: |
| 1030 |
|
| 1031 |
- What scripts or commands you want to execute. |
| 1032 |
- Which compute resource (platform) you wish to use. |
| 1033 |
- How to run your task. |
| 1034 |
|
| 1035 |
If multiple tasks need the same settings, they can share settings by |
| 1036 |
inheriting them from one or more other tasks. |
| 1037 |
|
| 1038 |
Precedence is determined by the same C3 |
| 1039 |
linearization algorithm used to find the *method resolution order* |
| 1040 |
in Python language class hierarchies. |
| 1041 |
|
| 1042 |
.. seealso:: |
| 1043 |
|
| 1044 |
For details and examples see :ref:`User Guide Runtime`. |
| 1045 |
'''): |
| 1046 |
with Conf('<namespace>', desc=''' |
| 1047 |
The name(s) of one or more tasks or task families. |
| 1048 |
|
| 1049 |
A namespace (i.e. task or family name) or a comma-separated list |
| 1050 |
of namespace names, and repeat as needed to define all tasks in |
| 1051 |
the workflow. Names may contain letters, digits, underscores, and |
| 1052 |
hyphens. A namespace represents a group or family of tasks if |
| 1053 |
other namespaces inherit from it, or a task if no others inherit |
| 1054 |
from it. |
| 1055 |
|
| 1056 |
.. important:: |
| 1057 |
|
| 1058 |
Names may not contain ``:`` or ``.``. |
| 1059 |
|
| 1060 |
See :ref:`task namespace rules. <namespace-names>` |
| 1061 |
|
| 1062 |
.. rubric:: Examples: |
| 1063 |
|
| 1064 |
- ``[foo]`` |
| 1065 |
- ``[foo, bar, baz]`` |
| 1066 |
|
| 1067 |
If multiple names are listed the subsequent settings apply to |
| 1068 |
all. |
| 1069 |
|
| 1070 |
All tasks or task families inherit initially from ``root``, which |
| 1071 |
can be explicitly configured to provide or override default |
| 1072 |
settings for all tasks in the workflow. |
| 1073 |
'''): |
| 1074 |
Conf('completion', VDR.V_STRING, desc=''' |
| 1075 |
Define the condition for task output completion. |
| 1076 |
|
| 1077 |
The completion condition is evaluated when a task reaches |
| 1078 |
a final state - i.e. once it finished executing (``succeeded`` |
| 1079 |
or ``failed``) or it ``submit-failed``, or ``expired``. |
| 1080 |
It is a validation check which confirms that the |
| 1081 |
task has generated the outputs it was expected to. |
| 1082 |
|
| 1083 |
If the task fails this check its outputs are considered |
| 1084 |
:term:`incomplete <output completion>` and a warning will be |
| 1085 |
raised alerting you that something has gone wrong which |
| 1086 |
requires investigation. |
| 1087 |
|
| 1088 |
.. note:: |
| 1089 |
|
| 1090 |
An event hook for this warning will follow in a future |
| 1091 |
release of Cylc. |
| 1092 |
|
| 1093 |
By default, the completion condition ensures that all required |
| 1094 |
outputs, i.e. outputs which appear in the graph but are not |
| 1095 |
marked as optional with the ``?`` character, are completed. |
| 1096 |
|
| 1097 |
E.g., in this example, the task ``foo`` must generate the |
| 1098 |
required outputs ``succeeded`` and ``x`` and it may or may not |
| 1099 |
generate the optional output ``y``: |
| 1100 |
|
| 1101 |
.. code-block:: cylc-graph |
| 1102 |
|
| 1103 |
foo => bar |
| 1104 |
foo:x => x |
| 1105 |
foo:y? => y |
| 1106 |
|
| 1107 |
The default completion condition would be this: |
| 1108 |
|
| 1109 |
.. code-block:: python |
| 1110 |
|
| 1111 |
# the task must succeed and generate the custom output "x" |
| 1112 |
succeeded and x |
| 1113 |
|
| 1114 |
You can override this default to suit your needs. E.g., in this |
| 1115 |
example, the task ``foo`` has three optional outputs, ``x``, |
| 1116 |
``y`` and ``z``: |
| 1117 |
|
| 1118 |
.. code-block:: cylc-graph |
| 1119 |
|
| 1120 |
foo:x? => x |
| 1121 |
foo:y? => y |
| 1122 |
foo:z? => z |
| 1123 |
x | y | z => bar |
| 1124 |
|
| 1125 |
Because all three of these outputs are optional, if none of |
| 1126 |
them are generated, the task's outputs will still be |
| 1127 |
considered complete. |
| 1128 |
|
| 1129 |
If you wanted to require that at least one of these outputs is |
| 1130 |
generated you can configure the completion condition like so: |
| 1131 |
|
| 1132 |
.. code-block:: python |
| 1133 |
|
| 1134 |
# the task must succeed and generate at least one of the |
| 1135 |
# outputs "x" or "y" or "z": |
| 1136 |
succeeded and (x or y or z) |
| 1137 |
|
| 1138 |
.. note:: |
| 1139 |
|
| 1140 |
For the completion expression, hyphens in task outputs |
| 1141 |
must be replaced with underscores to allow evaluation by |
| 1142 |
Python, e.g.: |
| 1143 |
|
| 1144 |
.. code-block:: cylc |
| 1145 |
|
| 1146 |
[runtime] |
| 1147 |
[[foo]] |
| 1148 |
completion = succeeded and my_output # underscore |
| 1149 |
[[[outputs]]] |
| 1150 |
my-output = 'my custom task output' # hyphen |
| 1151 |
|
| 1152 |
.. note:: |
| 1153 |
|
| 1154 |
In some cases the ``succeeded`` output might not explicitly |
| 1155 |
appear in the graph, e.g: |
| 1156 |
|
| 1157 |
.. code-block:: cylc-graph |
| 1158 |
|
| 1159 |
foo:x? => x |
| 1160 |
|
| 1161 |
In these cases success is presumed to be required unless |
| 1162 |
explicitly stated otherwise, either in the graph e.g: |
| 1163 |
|
| 1164 |
.. code-block:: cylc-graph |
| 1165 |
|
| 1166 |
foo? |
| 1167 |
foo:x? => x |
| 1168 |
|
| 1169 |
Or in the completion expression e.g: |
| 1170 |
|
| 1171 |
.. code-block:: cylc |
| 1172 |
|
| 1173 |
completion = x # no reference to succeeded |
| 1174 |
# or |
| 1175 |
completion = succeeded or failed # success is optional |
| 1176 |
|
| 1177 |
|
| 1178 |
.. hint:: |
| 1179 |
|
| 1180 |
If task outputs are optional in the graph they must also |
| 1181 |
be optional in the completion condition and vice versa. |
| 1182 |
|
| 1183 |
For example this graph conflicts with the completion |
| 1184 |
statement: |
| 1185 |
|
| 1186 |
.. code-block:: cylc-graph |
| 1187 |
|
| 1188 |
# "a" must succeed |
| 1189 |
a => b |
| 1190 |
|
| 1191 |
.. code-block:: cylc |
| 1192 |
|
| 1193 |
# "a" may either succeed or fail |
| 1194 |
completion = succeeded or failed |
| 1195 |
|
| 1196 |
Which could be fixed by amending the graph like so: |
| 1197 |
|
| 1198 |
.. code-block:: cylc-graph |
| 1199 |
|
| 1200 |
# "a" may either succeed or fail |
| 1201 |
a? => b |
| 1202 |
|
| 1203 |
.. rubric:: Examples |
| 1204 |
|
| 1205 |
``succeeded`` |
| 1206 |
The task must succeed. |
| 1207 |
``succeeded or (failed and my_error)`` |
| 1208 |
The task can fail, but only if it also yields the custom |
| 1209 |
output ``my_error``. |
| 1210 |
``succeeded and (x or y or z)`` |
| 1211 |
The task must succeed and yield at least one of the |
| 1212 |
custom outputs, x, y or z. |
| 1213 |
``(a and b) or (c and d)`` |
| 1214 |
One pair of these outputs must be yielded for the task |
| 1215 |
to be complete. |
| 1216 |
|
| 1217 |
.. versionadded:: 8.3.0 |
| 1218 |
''') |
| 1219 |
Conf('platform', VDR.V_STRING, desc=''' |
| 1220 |
The platform to submit jobs to. |
| 1221 |
|
| 1222 |
The |
| 1223 |
:cylc:conf:`platform <global.cylc[platforms][<platform name>]>` |
| 1224 |
specifies the host(s) that the tasks' jobs |
| 1225 |
will run on and where (if necessary) files need to be |
| 1226 |
installed, and what job runner will be used. |
| 1227 |
|
| 1228 |
This can be: |
| 1229 |
|
| 1230 |
* A :cylc:conf:`platform <global.cylc[platforms]>`, |
| 1231 |
* a :cylc:conf:`platform group <global.cylc[platform groups]>`, |
| 1232 |
* or a command which returns a platform or platform group. |
| 1233 |
|
| 1234 |
To see what platforms have been configured at your site, run |
| 1235 |
``cylc config --platform-names``. |
| 1236 |
|
| 1237 |
.. rubric:: Commands: |
| 1238 |
|
| 1239 |
The ``platform`` can be set to a command which returns the name |
| 1240 |
of the platform to submit jobs to using the ``$()`` syntax, |
| 1241 |
i.e: |
| 1242 |
|
| 1243 |
.. code-block:: cylc |
| 1244 |
|
| 1245 |
platform = $(command) |
| 1246 |
|
| 1247 |
The configured command will be evaluated for each job |
| 1248 |
submission (i.e, different submissions of the same task may |
| 1249 |
submit on different platforms). |
| 1250 |
|
| 1251 |
Cylc batches job submissions, so when multiple jobs are |
| 1252 |
submitted at the same time, using a platform defined by the |
| 1253 |
same command, the command will be run once, and all jobs in the |
| 1254 |
batch will submit to the same platform. |
| 1255 |
|
| 1256 |
Note: do not use a command to configure a list of login nodes. |
| 1257 |
Instead, define a platform and configure the login nodes it |
| 1258 |
can use; see |
| 1259 |
:ref:`config.platforms.cluster_with_multiple_login_nodes`. |
| 1260 |
|
| 1261 |
.. rubric:: Examples: |
| 1262 |
|
| 1263 |
.. code-block:: cylc |
| 1264 |
|
| 1265 |
# run the job on the same host the Cylc scheduler runs on |
| 1266 |
platform = localhost |
| 1267 |
|
| 1268 |
# run the job on a platform (or platform group) called hpc |
| 1269 |
platform = hpc |
| 1270 |
|
| 1271 |
# run a command to select the platform (or platform group): |
| 1272 |
platform = $(select-platform) |
| 1273 |
platform = prefix-$(select-platform)-suffix |
| 1274 |
|
| 1275 |
.. versionadded:: 8.0.0 |
| 1276 |
''') |
| 1277 |
Conf('inherit', VDR.V_STRING_LIST, desc=''' |
| 1278 |
A list of the immediate parent(s) of this task or task family. |
| 1279 |
|
| 1280 |
If no parents are listed default is ``root``. |
| 1281 |
''') |
| 1282 |
Conf('script', VDR.V_STRING, desc=dedent(''' |
| 1283 |
The main custom script run from the job script. |
| 1284 |
|
| 1285 |
It can be an external command or script, or inlined scripting. |
| 1286 |
|
| 1287 |
See :ref:`Task Job Script Variables` for the list of variables |
| 1288 |
available in the task execution environment. |
| 1289 |
''') + get_script_common_text( |
| 1290 |
this='script', example='my_script.sh' |
| 1291 |
)) |
| 1292 |
Conf('init-script', VDR.V_STRING, desc=dedent(''' |
| 1293 |
Custom script run by the job script before the task |
| 1294 |
execution environment is configured. |
| 1295 |
|
| 1296 |
By running before the task execution environment is configured, |
| 1297 |
this script does not have |
| 1298 |
access to any workflow or task environment variables. It can be |
| 1299 |
an external command or script, or inlined scripting. The |
| 1300 |
original intention for this item was to allow remote tasks to |
| 1301 |
source login scripts to configure their access to cylc, but |
| 1302 |
this should no longer be necessary. |
| 1303 |
''') + get_script_common_text(this='init-script')) |
| 1304 |
Conf('env-script', VDR.V_STRING, desc=dedent(''' |
| 1305 |
Custom script run by the job script between the |
| 1306 |
cylc-defined environment (workflow and task identity, etc.) and |
| 1307 |
the user-defined task runtime environment. |
| 1308 |
|
| 1309 |
The env-script has access to the Cylc environment (and the task |
| 1310 |
environment has access to variables defined by this scripting). |
| 1311 |
It can be an external command or script, or inlined scripting. |
| 1312 |
''') + get_script_common_text(this='env-script')) |
| 1313 |
Conf('err-script', VDR.V_STRING, desc=(''' |
| 1314 |
Script run when a job error is detected. |
| 1315 |
|
| 1316 |
Custom script to be run at the end of the error trap, |
| 1317 |
which is triggered due to failure of a command in the job |
| 1318 |
script or trappable job kill. |
| 1319 |
|
| 1320 |
The output of this script will always |
| 1321 |
be sent to STDERR and ``$1`` is set to the name of the signal |
| 1322 |
caught by the error trap. The script should be fast and use |
| 1323 |
very little system resource to ensure that the error trap can |
| 1324 |
return quickly. Companion of :cylc:conf:`[..]exit-script`, |
| 1325 |
which is executed on job success. It can be an external |
| 1326 |
command or script, or inlined scripting. |
| 1327 |
''') + get_script_common_text( |
| 1328 |
this='err-script', example='echo "Uh oh, received ${1}"' |
| 1329 |
)) |
| 1330 |
Conf('exit-script', VDR.V_STRING, desc=dedent(''' |
| 1331 |
Custom script run at the very end of *successful* job |
| 1332 |
execution, just before the job script exits. |
| 1333 |
|
| 1334 |
The exit-script should execute very quickly. |
| 1335 |
Companion of :cylc:conf:`[..]err-script`, |
| 1336 |
which is executed on job failure. It can be an external |
| 1337 |
command or script, or inlined scripting. |
| 1338 |
''') + get_script_common_text( |
| 1339 |
this='exit-script', example='rm -f "$TMP_FILES"' |
| 1340 |
)) |
| 1341 |
Conf('pre-script', VDR.V_STRING, desc=dedent(''' |
| 1342 |
Custom script run by the job script immediately |
| 1343 |
before :cylc:conf:`[..]script`. |
| 1344 |
|
| 1345 |
The pre-script can be an external command or script, or |
| 1346 |
inlined scripting. |
| 1347 |
''') + get_script_common_text( |
| 1348 |
this='pre-script', |
| 1349 |
example='echo "Hello from workflow ${CYLC_WORKFLOW_ID}!"' |
| 1350 |
)) |
| 1351 |
Conf('post-script', VDR.V_STRING, desc=dedent(''' |
| 1352 |
Custom script run by the job script immediately |
| 1353 |
after :cylc:conf:`[..]script`. |
| 1354 |
|
| 1355 |
The post-script can be an external |
| 1356 |
command or script, or inlined scripting. |
| 1357 |
''') + get_script_common_text(this='post-script')) |
| 1358 |
|
| 1359 |
Conf('work sub-directory', VDR.V_STRING, desc=''' |
| 1360 |
The directory from which tasks are executed. |
| 1361 |
|
| 1362 |
Job scripts are executed from within *work directories* |
| 1363 |
created automatically under the workflow run directory. A task |
| 1364 |
can get its own work directory from ``$CYLC_TASK_WORK_DIR`` |
| 1365 |
(or ``$PWD`` if it does not ``cd`` elsewhere at |
| 1366 |
runtime). The default directory path contains task name and |
| 1367 |
cycle point, to provide a unique workspace for every instance |
| 1368 |
of every task. If several tasks need to exchange files and |
| 1369 |
simply read and write from their from current working |
| 1370 |
directory, setting ``work sub-directory`` can be used to |
| 1371 |
override the default to make them all use the same workspace. |
| 1372 |
|
| 1373 |
The top level share and work directory location can be changed |
| 1374 |
(e.g. to a large data area) by a global config setting (see |
| 1375 |
:cylc:conf:`global.cylc[install][symlink dirs]`). |
| 1376 |
|
| 1377 |
.. caution:: |
| 1378 |
|
| 1379 |
If you omit cycle point from the work sub-directory path |
| 1380 |
successive instances of the task will share the same |
| 1381 |
workspace. Consider the effect on cycle point offset |
| 1382 |
housekeeping of work directories before doing this. |
| 1383 |
|
| 1384 |
Example: |
| 1385 |
|
| 1386 |
``$CYLC_TASK_CYCLE_POINT/shared/`` |
| 1387 |
''') |
| 1388 |
Conf( |
| 1389 |
'execution polling intervals', VDR.V_INTERVAL_LIST, None, |
| 1390 |
desc=global_default( |
| 1391 |
EXECUTION_POLL_DESCR, |
| 1392 |
"[platforms][<platform name>]execution polling intervals" |
| 1393 |
) |
| 1394 |
) |
| 1395 |
Conf('execution retry delays', VDR.V_INTERVAL_LIST, None, desc=f''' |
| 1396 |
Cylc can automate resubmission of failed jobs. |
| 1397 |
|
| 1398 |
Execution retry delays is a list of ISO 8601 durations which |
| 1399 |
tell Cylc how long to wait before the next try. |
| 1400 |
|
| 1401 |
The job environment variable ``$CYLC_TASK_TRY_NUMBER`` |
| 1402 |
increments with each automatic retry, allowing you to vary task |
| 1403 |
behaviour between retries. |
| 1404 |
|
| 1405 |
Tasks only go to the ``failed`` state if job execution fails |
| 1406 |
with no retries left. |
| 1407 |
|
| 1408 |
.. versionchanged:: 8.0.0 |
| 1409 |
|
| 1410 |
{REPLACES}``[runtime][<namespace>][job]execution |
| 1411 |
retry delays``. |
| 1412 |
''') |
| 1413 |
Conf('execution time limit', VDR.V_INTERVAL, desc=f''' |
| 1414 |
Set the execution (:term:`wallclock <wallclock time>`) time |
| 1415 |
limit of a job. |
| 1416 |
|
| 1417 |
For the ``background`` and ``at`` job runners, Cylc runs the |
| 1418 |
job's script using the timeout command. For other job runners, |
| 1419 |
Cylc will convert execution time limit to a :term:`directive`. |
| 1420 |
|
| 1421 |
If a job exceeds its execution time limit, Cylc will |
| 1422 |
poll the job multiple times at the |
| 1423 |
intervals configured in :cylc:conf:`global.cylc[platforms] |
| 1424 |
[<platform name>]execution time limit polling intervals` |
| 1425 |
|
| 1426 |
.. versionchanged:: 8.0.0 |
| 1427 |
|
| 1428 |
{REPLACES}``[runtime][<namespace>][job]execution |
| 1429 |
time limit``. |
| 1430 |
''') |
| 1431 |
Conf( |
| 1432 |
'submission polling intervals', VDR.V_INTERVAL_LIST, None, |
| 1433 |
desc=global_default( |
| 1434 |
SUBMISSION_POLL_DESCR, |
| 1435 |
"[platforms][<platform name>]submission polling intervals" |
| 1436 |
) |
| 1437 |
) |
| 1438 |
Conf( |
| 1439 |
'submission retry delays', VDR.V_INTERVAL_LIST, None, |
| 1440 |
desc=global_default( |
| 1441 |
SUBMISSION_RETY_DESCR, |
| 1442 |
"[platforms][<platform name>]submission retry delays" |
| 1443 |
) |
| 1444 |
) |
| 1445 |
Conf( |
| 1446 |
'run mode', VDR.V_STRING, |
| 1447 |
options=list(TASK_CONFIG_RUN_MODES), |
| 1448 |
default=RunMode.LIVE.value, |
| 1449 |
desc=f''' |
| 1450 |
When the workflow is running in live mode, run this *task* |
| 1451 |
in one of the following modes: |
| 1452 |
|
| 1453 |
``{RunMode.LIVE.value}`` (default): |
| 1454 |
{RunMode.LIVE.describe()} |
| 1455 |
``{RunMode.SKIP.value}``: |
| 1456 |
{RunMode.SKIP.describe()} |
| 1457 |
|
| 1458 |
.. note:: |
| 1459 |
|
| 1460 |
This is primarily intended to be set at runtime via |
| 1461 |
a broadcast; Cylc will warn you about any tasks |
| 1462 |
set to run in skip mode in the workflow |
| 1463 |
configuration at validation time. |
| 1464 |
If you are using skip mode to create a dummy task, |
| 1465 |
you can ignore this warning. |
| 1466 |
|
| 1467 |
.. seealso:: |
| 1468 |
|
| 1469 |
- :ref:`task-run-modes.skip` |
| 1470 |
- :cylc:conf:`flow.cylc[runtime][<namespace>][skip]` |
| 1471 |
|
| 1472 |
.. versionadded:: 8.4.0 |
| 1473 |
|
| 1474 |
''') |
| 1475 |
with Conf('meta', desc=r''' |
| 1476 |
Metadata for the task or task family. |
| 1477 |
|
| 1478 |
The ``meta`` section contains metadata items for this task or |
| 1479 |
family namespace. The items ``title``, ``description`` and |
| 1480 |
``URL`` are pre-defined and are used by Cylc. Others can be |
| 1481 |
user-defined and passed to task event handlers to be |
| 1482 |
interpreted according to your needs. For example, the value of |
| 1483 |
an "importance" item could determine how an event handler |
| 1484 |
responds to task failure events. |
| 1485 |
|
| 1486 |
Any workflow meta item can now be passed to task event handlers |
| 1487 |
by prefixing the string template item name with ``workflow_``, |
| 1488 |
for example: |
| 1489 |
|
| 1490 |
.. code-block:: cylc |
| 1491 |
|
| 1492 |
[runtime] |
| 1493 |
[[root]] |
| 1494 |
[[[events]]] |
| 1495 |
failed handlers = """ |
| 1496 |
send-help.sh \ |
| 1497 |
%(workflow_title)s \ |
| 1498 |
%(workflow_importance)s \ |
| 1499 |
%(title)s |
| 1500 |
""" |
| 1501 |
'''): |
| 1502 |
Conf('title', VDR.V_STRING, '', desc=''' |
| 1503 |
A single line description of this task or task family. |
| 1504 |
|
| 1505 |
It is displayed by the ``cylc list`` command and can be |
| 1506 |
retrieved from running tasks with the ``cylc show`` |
| 1507 |
command. |
| 1508 |
''') |
| 1509 |
Conf('description', VDR.V_STRING, '', desc=''' |
| 1510 |
A multi-line description of this task or task family. |
| 1511 |
|
| 1512 |
It is retrievable from running tasks with the |
| 1513 |
``cylc show`` command. |
| 1514 |
''') |
| 1515 |
Conf( |
| 1516 |
'URL', VDR.V_STRING, '', desc=''' |
| 1517 |
A URL link to task documentation for this task or task |
| 1518 |
family. |
| 1519 |
|
| 1520 |
The templates ``%(workflow)s`` and |
| 1521 |
``%(task)s`` will be replaced with the actual |
| 1522 |
workflow ID and task name. |
| 1523 |
|
| 1524 |
.. deprecated:: 8.0.0 |
| 1525 |
|
| 1526 |
The ``%(suite_name)s`` template variable is |
| 1527 |
deprecated, please use ``%(workflow)s``. |
| 1528 |
|
| 1529 |
The ``%(task_name)s`` template variable is |
| 1530 |
deprecated, please use ``%(task)s``. |
| 1531 |
|
| 1532 |
See also :cylc:conf:`[meta]URL <flow.cylc[meta]URL>`. |
| 1533 |
|
| 1534 |
Example: |
| 1535 |
|
| 1536 |
``http://my-site.com/workflows/%(workflow)s/''' |
| 1537 |
'%(task)s.html``') |
| 1538 |
Conf('<custom metadata>', VDR.V_STRING, '', desc=''' |
| 1539 |
Any user-defined metadata item. |
| 1540 |
|
| 1541 |
These, like title, description and URL. can be passed to |
| 1542 |
task event handlers to be interpreted according to your |
| 1543 |
needs. For example, the value of an "importance" item could |
| 1544 |
determine how an event handler responds to task failure |
| 1545 |
events. |
| 1546 |
''') |
| 1547 |
with Conf('skip', desc=''' |
| 1548 |
Task configuration for :ref:`task-run-modes.skip`. |
| 1549 |
|
| 1550 |
.. seealso:: |
| 1551 |
|
| 1552 |
- :ref:`task-run-modes.skip` |
| 1553 |
- :cylc:conf:`flow.cylc[runtime][<namespace>]run mode` |
| 1554 |
|
| 1555 |
.. versionadded:: 8.4.0 |
| 1556 |
'''): |
| 1557 |
Conf( |
| 1558 |
'outputs', |
| 1559 |
VDR.V_STRING_LIST, |
| 1560 |
desc=''' |
| 1561 |
Outputs to be emitted by a task in skip mode. |
| 1562 |
|
| 1563 |
* By default, all required outputs will be generated |
| 1564 |
plus succeeded if success is optional. |
| 1565 |
* If skip-mode outputs is specified and does not |
| 1566 |
include either succeeded or failed then succeeded |
| 1567 |
will be produced. |
| 1568 |
* The outputs submitted and started are always |
| 1569 |
produced and do not need to be defined in here. |
| 1570 |
|
| 1571 |
.. versionadded:: 8.4.0 |
| 1572 |
''' |
| 1573 |
) |
| 1574 |
Conf( |
| 1575 |
'disable task event handlers', |
| 1576 |
VDR.V_BOOLEAN, |
| 1577 |
default=True, |
| 1578 |
desc=''' |
| 1579 |
Task event handlers are turned off by default for |
| 1580 |
skip mode tasks. Changing this setting to ``False`` |
| 1581 |
will re-enable task event handlers. |
| 1582 |
|
| 1583 |
.. versionadded:: 8.4.0 |
| 1584 |
''' |
| 1585 |
) |
| 1586 |
with Conf('simulation', desc=''' |
| 1587 |
Task configuration for workflow *simulation* and *dummy* run |
| 1588 |
modes. |
| 1589 |
|
| 1590 |
For a full description of simulation and dummy run modes see |
| 1591 |
:ref:`workflow-run-modes.simulation`. |
| 1592 |
'''): |
| 1593 |
Conf('default run length', VDR.V_INTERVAL, DurationFloat(10), |
| 1594 |
desc=''' |
| 1595 |
The default simulated job run length. |
| 1596 |
|
| 1597 |
Used if :cylc:conf:`flow.cylc[runtime][<namespace>] |
| 1598 |
execution time limit` **and** |
| 1599 |
:cylc:conf:`flow.cylc[runtime][<namespace>][simulation] |
| 1600 |
speedup factor` are not set. |
| 1601 |
''') |
| 1602 |
Conf('speedup factor', VDR.V_FLOAT, desc=''' |
| 1603 |
Simulated run length = speedup factor * execution time |
| 1604 |
limit. |
| 1605 |
|
| 1606 |
If :cylc:conf:`flow.cylc[runtime][<namespace>] |
| 1607 |
execution time limit` is set, the task |
| 1608 |
simulated run length is computed by dividing it by this |
| 1609 |
factor. |
| 1610 |
''') |
| 1611 |
Conf('time limit buffer', VDR.V_INTERVAL, DurationFloat(30), |
| 1612 |
desc=''' |
| 1613 |
For dummy jobs :cylc:conf:`flow.cylc[runtime][<namespace>] |
| 1614 |
execution time limit` is extended |
| 1615 |
by ``time limit buffer``. |
| 1616 |
|
| 1617 |
The time limit buffer is added to prevent dummy jobs |
| 1618 |
being killed after exceeding the ``execution time limit``. |
| 1619 |
''') |
| 1620 |
Conf('fail cycle points', VDR.V_STRING_LIST, desc=''' |
| 1621 |
Configure simulated or dummy jobs to fail at certain cycle |
| 1622 |
points. |
| 1623 |
|
| 1624 |
Example: |
| 1625 |
|
| 1626 |
- ``all`` - all instance of the task will fail |
| 1627 |
- ``2017-08-12T06, 2017-08-12T18`` - these instances of |
| 1628 |
the task will fail |
| 1629 |
|
| 1630 |
If you set :cylc:conf:`[..][..]execution retry delays` |
| 1631 |
the second attempt will succeed unless you set |
| 1632 |
:cylc:conf:`[..]fail try 1 only = False`. |
| 1633 |
''') |
| 1634 |
Conf('fail try 1 only', VDR.V_BOOLEAN, True, desc=''' |
| 1635 |
If ``True`` only the first run of the task |
| 1636 |
instance will fail, otherwise retries will fail too. |
| 1637 |
|
| 1638 |
Task instances must be set to fail by |
| 1639 |
:cylc:conf:`[..]fail cycle points`. |
| 1640 |
|
| 1641 |
.. note:: |
| 1642 |
|
| 1643 |
This setting is designed for use with automatic |
| 1644 |
retries. Subsequent manual submissions will not |
| 1645 |
change the outcome of the task. |
| 1646 |
''') |
| 1647 |
Conf('disable task event handlers', VDR.V_BOOLEAN, True, |
| 1648 |
desc=''' |
| 1649 |
If ``True`` configured task event handlers |
| 1650 |
will not be called in simulation or dummy modes. |
| 1651 |
''') |
| 1652 |
|
| 1653 |
with Conf('environment filter', desc=''' |
| 1654 |
This section contains environment variable inclusion and |
| 1655 |
exclusion lists that can be used to filter the inherited |
| 1656 |
environment. |
| 1657 |
|
| 1658 |
*This is not intended as an alternative to a |
| 1659 |
well-designed inheritance hierarchy that provides each task |
| 1660 |
with just the variables it needs.* |
| 1661 |
|
| 1662 |
Filters can improve workflows with tasks which inherit a lot |
| 1663 |
of environment variables: Filters can make it clear which |
| 1664 |
variables each task uses. |
| 1665 |
|
| 1666 |
You can use filters as explicit "task environment interfaces". |
| 1667 |
They make sure that variables filtered out of the inherited |
| 1668 |
environment are not used. However, using filters in this way |
| 1669 |
will make your workflow definition longer. |
| 1670 |
|
| 1671 |
.. note:: |
| 1672 |
Environment filtering is done after inheritance is |
| 1673 |
completely worked out, not at each level on the way, so |
| 1674 |
filter lists in higher-level namespaces only have an effect |
| 1675 |
if they are not overridden by descendants. |
| 1676 |
'''): |
| 1677 |
Conf('include', VDR.V_STRING_LIST, desc=''' |
| 1678 |
If given, **only** variables named in this list will be |
| 1679 |
included from the inherited environment. |
| 1680 |
|
| 1681 |
Other variables will be filtered out. Variables may also |
| 1682 |
be explicitly excluded by an ``exclude`` list. |
| 1683 |
''') |
| 1684 |
Conf('exclude', VDR.V_STRING_LIST, desc=''' |
| 1685 |
Variables named in this list will be filtered out of the |
| 1686 |
inherited environment. |
| 1687 |
|
| 1688 |
Variables may also be implicitly |
| 1689 |
excluded by omission from an ``include`` list. |
| 1690 |
''') |
| 1691 |
|
| 1692 |
with Conf('job', desc=REPLACED_BY_PLATFORMS + dedent(''' |
| 1693 |
This section configures the means by which cylc submits task |
| 1694 |
job scripts to run. |
| 1695 |
''')): |
| 1696 |
Conf('batch system', VDR.V_STRING, desc=''' |
| 1697 |
.. deprecated:: 8.0.0 |
| 1698 |
|
| 1699 |
Kept for back compatibility but replaced by |
| 1700 |
:cylc:conf:`global.cylc[platforms][<platform name>] |
| 1701 |
job runner`. |
| 1702 |
|
| 1703 |
Batch/queuing system (aka job runner) to submit task |
| 1704 |
jobs to. |
| 1705 |
''') |
| 1706 |
Conf('batch submit command template', VDR.V_STRING, desc=''' |
| 1707 |
.. deprecated:: 8.0.0 |
| 1708 |
|
| 1709 |
Kept for back compatibility but replaced by |
| 1710 |
:cylc:conf:`global.cylc[platforms][<platform name>] |
| 1711 |
job runner command template`. |
| 1712 |
|
| 1713 |
Override the default job submission command for the chosen |
| 1714 |
batch system. |
| 1715 |
''') |
| 1716 |
|
| 1717 |
with Conf('remote', desc=f''' |
| 1718 |
Job host settings. |
| 1719 |
{REPLACED_BY_PLATFORMS} |
| 1720 |
'''): |
| 1721 |
Conf('host', VDR.V_STRING, desc=f''' |
| 1722 |
Hostname or IP address of the job host. |
| 1723 |
{REPLACED_BY_PLATFORMS} |
| 1724 |
''') |
| 1725 |
Conf('owner', VDR.V_STRING, desc=""" |
| 1726 |
Your username on the job host, if different from that on |
| 1727 |
the scheduler host. |
| 1728 |
|
| 1729 |
.. warning:: |
| 1730 |
|
| 1731 |
This setting is obsolete at Cylc 8. |
| 1732 |
|
| 1733 |
See :ref:`documentation on changes to remote owner |
| 1734 |
<728.remote_owner>` |
| 1735 |
""") |
| 1736 |
Conf('retrieve job logs', VDR.V_BOOLEAN, |
| 1737 |
desc=f''' |
| 1738 |
{LOG_RETR_SETTINGS['retrieve job logs']} |
| 1739 |
{REPLACED_BY_PLATFORMS} |
| 1740 |
''') |
| 1741 |
Conf('retrieve job logs max size', VDR.V_STRING, |
| 1742 |
desc=f''' |
| 1743 |
{LOG_RETR_SETTINGS['retrieve job logs max size']} |
| 1744 |
{REPLACED_BY_PLATFORMS} |
| 1745 |
''') |
| 1746 |
Conf('retrieve job logs retry delays', |
| 1747 |
VDR.V_INTERVAL_LIST, None, |
| 1748 |
desc=f''' |
| 1749 |
{LOG_RETR_SETTINGS['retrieve job logs retry delays']} |
| 1750 |
{REPLACED_BY_PLATFORMS} |
| 1751 |
''') |
| 1752 |
with Conf('events', desc=( |
| 1753 |
global_default(TASK_EVENTS_DESCR, "[task events]") |
| 1754 |
)): |
| 1755 |
Conf('handlers', VDR.V_STRING_LIST, None, desc=( |
| 1756 |
global_default( |
| 1757 |
TASK_EVENTS_SETTINGS['handlers'], |
| 1758 |
"[task events]handlers" |
| 1759 |
) |
| 1760 |
)) |
| 1761 |
Conf('handler events', VDR.V_STRING_LIST, None, desc=( |
| 1762 |
global_default( |
| 1763 |
TASK_EVENTS_SETTINGS['handler events'], |
| 1764 |
"[task events]handler events" |
| 1765 |
) |
| 1766 |
)) |
| 1767 |
Conf('handler retry delays', VDR.V_INTERVAL_LIST, None, desc=( |
| 1768 |
global_default( |
| 1769 |
TASK_EVENTS_SETTINGS['handler retry delays'], |
| 1770 |
"[task events]handler retry delays" |
| 1771 |
) |
| 1772 |
)) |
| 1773 |
Conf('mail events', VDR.V_STRING_LIST, None, desc=( |
| 1774 |
global_default( |
| 1775 |
TASK_EVENTS_SETTINGS['mail events'], |
| 1776 |
"[task events]mail events" |
| 1777 |
) |
| 1778 |
)) |
| 1779 |
Conf('execution timeout', VDR.V_INTERVAL, desc=( |
| 1780 |
global_default( |
| 1781 |
TASK_EVENTS_SETTINGS['execution timeout'], |
| 1782 |
"[task events]execution timeout" |
| 1783 |
) |
| 1784 |
)) |
| 1785 |
Conf('submission timeout', VDR.V_INTERVAL, desc=( |
| 1786 |
global_default( |
| 1787 |
TASK_EVENTS_SETTINGS['submission timeout'], |
| 1788 |
"[task events]submission timeout" |
| 1789 |
) |
| 1790 |
)) |
| 1791 |
Conf('expired handlers', VDR.V_STRING_LIST, None, desc=''' |
| 1792 |
Handlers to run if this task has expired. |
| 1793 |
|
| 1794 |
.. seealso:: |
| 1795 |
|
| 1796 |
:ref:`task-job-states` |
| 1797 |
|
| 1798 |
.. caution:: |
| 1799 |
|
| 1800 |
Changes to the scheduling algorithm in Cylc 8 mean |
| 1801 |
this event will not be triggered until the expired task |
| 1802 |
is ready to run. Earlier expired-task detection will be |
| 1803 |
implemented in a future Cylc release. |
| 1804 |
''') |
| 1805 |
Conf('late offset', VDR.V_INTERVAL, None, desc=''' |
| 1806 |
Offset from cycle point, in real time, at which this task |
| 1807 |
is considered to be "running late" (i.e. the time by which |
| 1808 |
it would normally have started running). |
| 1809 |
|
| 1810 |
.. caution:: |
| 1811 |
|
| 1812 |
Changes to the scheduling algorithm in Cylc 8 mean |
| 1813 |
this event will not be triggered until the late task |
| 1814 |
is ready to run. Earlier late-task detection will be |
| 1815 |
implemented in a future Cylc release. |
| 1816 |
|
| 1817 |
.. seealso:: |
| 1818 |
|
| 1819 |
:cylc:conf:`flow.cylc[runtime][<namespace>][events] |
| 1820 |
late handlers`. |
| 1821 |
''') |
| 1822 |
Conf('late handlers', VDR.V_STRING_LIST, None, desc=''' |
| 1823 |
Handlers to run if this task is late. |
| 1824 |
|
| 1825 |
.. caution:: |
| 1826 |
|
| 1827 |
Due to changes to the Cylc 8 scheduling algorithm |
| 1828 |
this event is unlikely to occur until the task is about |
| 1829 |
to submit anyway. |
| 1830 |
''') |
| 1831 |
Conf('submitted handlers', VDR.V_STRING_LIST, None, desc=''' |
| 1832 |
Handlers to run when this task is submitted. |
| 1833 |
''') |
| 1834 |
Conf('started handlers', VDR.V_STRING_LIST, None, desc=''' |
| 1835 |
Handlers to run when this task starts executing. |
| 1836 |
''') |
| 1837 |
Conf('succeeded handlers', VDR.V_STRING_LIST, None, desc=''' |
| 1838 |
Handlers to run if this task succeeds. |
| 1839 |
''') |
| 1840 |
Conf('failed handlers', VDR.V_STRING_LIST, None, desc=''' |
| 1841 |
Handlers to run if this task fails. |
| 1842 |
''') |
| 1843 |
Conf('submission failed handlers', VDR.V_STRING_LIST, None, |
| 1844 |
desc=''' |
| 1845 |
Handlers to run if submission of this task fails. |
| 1846 |
''') |
| 1847 |
Conf('warning handlers', VDR.V_STRING_LIST, None, desc=''' |
| 1848 |
Handlers to run if this task runs ``cylc message`` |
| 1849 |
with severity level "WARNING". |
| 1850 |
''') |
| 1851 |
Conf('critical handlers', VDR.V_STRING_LIST, None, desc=''' |
| 1852 |
Handlers to run if this task runs ``cylc message`` |
| 1853 |
with severity level "CRITICAL". |
| 1854 |
''') |
| 1855 |
Conf('retry handlers', VDR.V_STRING_LIST, None, desc=''' |
| 1856 |
Handlers to run if this task failed but is retrying. |
| 1857 |
''') |
| 1858 |
Conf('submission retry handlers', VDR.V_STRING_LIST, None, |
| 1859 |
desc=''' |
| 1860 |
Handlers to run if a job failed to submit but is |
| 1861 |
retrying. |
| 1862 |
|
| 1863 |
.. seealso:: |
| 1864 |
|
| 1865 |
:ref:`task-job-states` |
| 1866 |
|
| 1867 |
''') |
| 1868 |
Conf('execution timeout handlers', VDR.V_STRING_LIST, None, |
| 1869 |
desc=''' |
| 1870 |
Handlers to run if this task execution exceeds |
| 1871 |
:cylc:conf:`flow.cylc[runtime][<namespace>] |
| 1872 |
execution time limit`. |
| 1873 |
''') |
| 1874 |
Conf('submission timeout handlers', VDR.V_STRING_LIST, None, |
| 1875 |
desc=''' |
| 1876 |
Handlers to run if this task exceeds |
| 1877 |
:cylc:conf:`flow.cylc[runtime][<namespace>][events] |
| 1878 |
submission timeout` in the submitted state. |
| 1879 |
''') |
| 1880 |
Conf('custom handlers', VDR.V_STRING_LIST, None, desc=''' |
| 1881 |
Handlers to run if this task runs ``cylc message`` |
| 1882 |
with severity level "CUSTOM". |
| 1883 |
''') |
| 1884 |
|
| 1885 |
with Conf('mail', desc=''' |
| 1886 |
Email notification settings for task events. |
| 1887 |
|
| 1888 |
.. versionadded:: 8.0.0 |
| 1889 |
'''): |
| 1890 |
Conf('from', VDR.V_STRING, desc=f''' |
| 1891 |
Specify an alternate ``from:`` email address for event |
| 1892 |
notifications. |
| 1893 |
|
| 1894 |
.. versionchanged:: 8.0.0 |
| 1895 |
|
| 1896 |
{REPLACES}``[runtime][task][events]mail from`` |
| 1897 |
''') |
| 1898 |
Conf('to', VDR.V_STRING, desc=f''' |
| 1899 |
A list of email addresses to send task event |
| 1900 |
notifications. |
| 1901 |
|
| 1902 |
The list can be any address accepted by the |
| 1903 |
``mail`` command. |
| 1904 |
|
| 1905 |
.. versionchanged:: 8.0.0 |
| 1906 |
|
| 1907 |
{REPLACES}``[runtime][task][events]mail to`` |
| 1908 |
''') |
| 1909 |
|
| 1910 |
with Conf('workflow state polling', desc=f''' |
| 1911 |
Deprecated support for automatic workflow state polling tasks |
| 1912 |
as described in :ref:`WorkflowStatePolling`. Note the Cylc 7 |
| 1913 |
"user" and "host" config items are not supported. |
| 1914 |
|
| 1915 |
.. versionchanged:: 8.0.0 |
| 1916 |
|
| 1917 |
{REPLACES}``[runtime][<namespace>]suite state polling``. |
| 1918 |
|
| 1919 |
.. deprecated:: 8.3.0 |
| 1920 |
|
| 1921 |
Please use the :ref:`workflow_state xtrigger |
| 1922 |
<Built-in Workflow State Triggers>` instead. |
| 1923 |
'''): |
| 1924 |
Conf('interval', VDR.V_INTERVAL, desc=''' |
| 1925 |
Polling interval. |
| 1926 |
''') |
| 1927 |
Conf('max-polls', VDR.V_INTEGER, desc=''' |
| 1928 |
Maximum number of polls to attempt before the task fails. |
| 1929 |
''') |
| 1930 |
Conf('message', VDR.V_STRING, desc=''' |
| 1931 |
Target task output (task message, not trigger name). |
| 1932 |
''') |
| 1933 |
Conf('alt-cylc-run-dir', VDR.V_STRING, desc=''' |
| 1934 |
The cylc-run directory location of the target workflow. |
| 1935 |
Use to poll workflows owned by other users. |
| 1936 |
''') |
| 1937 |
Conf('verbose mode', VDR.V_BOOLEAN, desc=''' |
| 1938 |
Run the ``cylc workflow-state`` command in verbose mode. |
| 1939 |
''') |
| 1940 |
|
| 1941 |
with Conf('environment', desc=''' |
| 1942 |
The user defined task execution environment. |
| 1943 |
|
| 1944 |
Variables defined here can refer to cylc workflow and task |
| 1945 |
identity variables, which are exported earlier in the job |
| 1946 |
script. Variable assignment expressions can use cylc |
| 1947 |
utility commands because access to cylc is also configured |
| 1948 |
earlier in the script. |
| 1949 |
|
| 1950 |
.. seealso:: |
| 1951 |
|
| 1952 |
:ref:`TaskExecutionEnvironment`. |
| 1953 |
|
| 1954 |
You can also specify job environment templates here for |
| 1955 |
:ref:`parameterized tasks <User Guide Param>`. |
| 1956 |
'''): |
| 1957 |
Conf('<variable>', VDR.V_STRING, desc=r''' |
| 1958 |
A custom user defined variable for a task execution |
| 1959 |
environment. |
| 1960 |
|
| 1961 |
The order of definition is preserved that each variable can |
| 1962 |
refer to previously defined |
| 1963 |
variables. Values are passed through to the job |
| 1964 |
script without evaluation or manipulation by Cylc |
| 1965 |
(with the exception of valid Python string templates |
| 1966 |
that match parameterized task names - see below), so any |
| 1967 |
variable assignment expression that is legal in the job |
| 1968 |
submission shell can be used. White space around the |
| 1969 |
``=`` is allowed (as far as cylc's flow.cylc parser is |
| 1970 |
concerned these are just normal configuration items). |
| 1971 |
|
| 1972 |
Examples:: |
| 1973 |
|
| 1974 |
FOO = $HOME/bar/baz |
| 1975 |
BAR = ${FOO}$GLOBALVAR |
| 1976 |
BAZ = $( echo "hello world" ) |
| 1977 |
WAZ = ${FOO%.jpg}.png |
| 1978 |
NEXT_CYCLE = $( cylc cycle-point --offset=PT6H ) |
| 1979 |
ZAZ = "${FOO#bar}" |
| 1980 |
# ^ quoted to escape the flow.cylc comment character |
| 1981 |
DICE = [$((($RANDOM % 6) + 1)) $((($RANDOM % 6) + 1))] |
| 1982 |
|
| 1983 |
For parameter environment templates, use Python string |
| 1984 |
templates for parameter substitution. This is only |
| 1985 |
relevant for |
| 1986 |
:ref:`parameterized tasks <User Guide Param>`. |
| 1987 |
The job script will export the named variables specified |
| 1988 |
here (in addition to the standard ``CYLC_TASK_PARAM_<key>`` |
| 1989 |
variables), with the template strings substituted with |
| 1990 |
the parameter values. |
| 1991 |
|
| 1992 |
Examples:: |
| 1993 |
|
| 1994 |
MYNUM = %(i)d |
| 1995 |
MYITEM = %(item)s |
| 1996 |
MYFILE = /path/to/%(i)03d/%(item)s |
| 1997 |
|
| 1998 |
.. note:: |
| 1999 |
|
| 2000 |
As with other Cylc configurations, leading or trailing |
| 2001 |
whitespace will be stripped, so the following two |
| 2002 |
examples are equivalent: |
| 2003 |
|
| 2004 |
.. list-table:: |
| 2005 |
:class: grid-table |
| 2006 |
|
| 2007 |
* - .. code-block:: cylc |
| 2008 |
|
| 2009 |
[environment] |
| 2010 |
FOO = " a " |
| 2011 |
BAR = """ |
| 2012 |
$(foo bar baz) |
| 2013 |
""" |
| 2014 |
- .. code-block:: cylc |
| 2015 |
|
| 2016 |
[environment] |
| 2017 |
FOO = "a" |
| 2018 |
BAR = "$(foo bar baz)" |
| 2019 |
|
| 2020 |
If leading or trailing whitespace is required, consider |
| 2021 |
using the ``\0`` escape character, or set the variable |
| 2022 |
in :cylc:conf:`[..][..]env-script`. |
| 2023 |
|
| 2024 |
.. versionchanged:: 7.8.7/7.9.2 |
| 2025 |
|
| 2026 |
Parameter environment templates (previously in |
| 2027 |
``[runtime][X][parameter environment templates]``) have |
| 2028 |
moved here. |
| 2029 |
''') |
| 2030 |
|
| 2031 |
with Conf('directives', desc=( |
| 2032 |
global_default( |
| 2033 |
DIRECTIVES_DESCR, |
| 2034 |
"[platforms][<platform name>][directives]" |
| 2035 |
) |
| 2036 |
)): |
| 2037 |
Conf('<directive>', VDR.V_STRING, desc=DIRECTIVES_ITEM_DESCR) |
| 2038 |
|
| 2039 |
with Conf('outputs', desc=''' |
| 2040 |
Register custom task outputs for use in message triggering in |
| 2041 |
this section (:ref:`MessageTriggers`) |
| 2042 |
'''): |
| 2043 |
Conf('<output>', VDR.V_STRING, desc=''' |
| 2044 |
Define custom task outputs (aka :ref:`MessageTriggers`). |
| 2045 |
|
| 2046 |
:term:`Custom outputs <custom output>` allow you to extend |
| 2047 |
the built-in task outputs e.g. ``succeeded`` and ``failed`` |
| 2048 |
in order to provide more detailed information about task |
| 2049 |
state. Custom outputs can be used to express dependencies |
| 2050 |
in the graph as with built-in outputs. |
| 2051 |
|
| 2052 |
Custom outputs are defined in the form: |
| 2053 |
|
| 2054 |
.. code-block:: cylc |
| 2055 |
|
| 2056 |
output = message |
| 2057 |
|
| 2058 |
Where ``output`` is the name of the output as it is used in |
| 2059 |
the graph, and ``message`` is the task message sent by |
| 2060 |
the ``cylc message`` command which tells Cylc that this |
| 2061 |
output has been completed. See :ref:`MessageTriggers` for |
| 2062 |
more details. |
| 2063 |
|
| 2064 |
Examples: |
| 2065 |
|
| 2066 |
.. code-block:: cylc |
| 2067 |
|
| 2068 |
out1 = "sea state products ready" |
| 2069 |
out2 = "NWP restart files completed" |
| 2070 |
|
| 2071 |
Custom outputs must satisfy these rules: |
| 2072 |
|
| 2073 |
.. autoclass:: cylc.flow.unicode_rules.TaskOutputValidator |
| 2074 |
:noindex: |
| 2075 |
|
| 2076 |
Task messages must satisfy these rules: |
| 2077 |
|
| 2078 |
.. autoclass:: cylc.flow.unicode_rules.TaskMessageValidator |
| 2079 |
:noindex: |
| 2080 |
''') |
| 2081 |
|
| 2082 |
with Conf('parameter environment templates', desc=''' |
| 2083 |
.. deprecated:: 7.8.7/7.9.2 |
| 2084 |
|
| 2085 |
Parameter environment templates have moved to |
| 2086 |
:cylc:conf:`flow.cylc[runtime][<namespace>][environment]`. |
| 2087 |
|
| 2088 |
This was done to allow users to control the order of |
| 2089 |
definition of the variables. This section will be removed |
| 2090 |
in a future version of Cylc 8. |
| 2091 |
|
| 2092 |
For the time being, the contents of this section will be |
| 2093 |
prepended to the ``[environment]`` section when running |
| 2094 |
a workflow. |
| 2095 |
'''): |
| 2096 |
Conf('<parameter>', VDR.V_STRING, desc=''' |
| 2097 |
.. deprecated:: 7.8.7/7.9.2 |
| 2098 |
|
| 2099 |
Parameter environment templates have moved to |
| 2100 |
:cylc:conf:`flow.cylc[runtime] |
| 2101 |
[<namespace>][environment]`. |
| 2102 |
''') |
| 2103 |
|
| 2104 |
|
| 2105 |
def upg( |
| 2106 |
cfg: dict, descr: str, broadcast: bool | Literal["cancel"] = False |
| 2107 |
) -> upgrader: |
| 2108 |
"""Upgrade old workflow configuration. |
| 2109 |
|
| 2110 |
NOTE: We are silencing deprecation (and only deprecation) warnings |
| 2111 |
when in Cylc 7 compat mode to help support Cylc 7/8 compatible workflows |
| 2112 |
(which would loose Cylc 7 compatibility if users were to follow the |
| 2113 |
warnings and upgrade the syntax). |
| 2114 |
|
| 2115 |
Args: |
| 2116 |
broadcast: |
| 2117 |
If truthy, tailors warning messages for the context of broadcasts. |
| 2118 |
If "cancel", extra validation steps which inspect configuration |
| 2119 |
values will be skipped. This is used for |
| 2120 |
"cylc broadcast --cancel" where the values are not known. |
| 2121 |
See https://github.com/cylc/cylc-flow/issues/6950. |
| 2122 |
|
| 2123 |
""" |
| 2124 |
u = upgrader(cfg, descr, broadcast=bool(broadcast)) |
| 2125 |
|
| 2126 |
u.obsolete( |
| 2127 |
'7.8.0', ['runtime', '__MANY__', 'suite state polling', 'template'] |
| 2128 |
) |
| 2129 |
u.obsolete('7.8.1', ['cylc', 'events', 'reset timer']) |
| 2130 |
u.obsolete('7.8.1', ['cylc', 'events', 'reset inactivity timer']) |
| 2131 |
u.obsolete('8.0.0', ['cylc', 'force run mode']) |
| 2132 |
u.obsolete('7.8.1', ['runtime', '__MANY__', 'events', 'reset timer']) |
| 2133 |
u.obsolete('8.0.0', ['cylc', 'authentication'], is_section=True) |
| 2134 |
u.obsolete('8.0.0', ['cylc', 'include at start-up']) |
| 2135 |
u.obsolete('8.0.0', ['cylc', 'exclude at start-up']) |
| 2136 |
u.obsolete('8.0.0', ['cylc', 'log resolved dependencies']) |
| 2137 |
u.obsolete('8.0.0', ['cylc', 'required run mode']) |
| 2138 |
u.obsolete( |
| 2139 |
'8.0.0', |
| 2140 |
['cylc', 'health check interval']) |
| 2141 |
u.obsolete('8.0.0', ['runtime', '__MANY__', 'events', 'mail retry delays']) |
| 2142 |
u.obsolete('8.0.0', ['runtime', '__MANY__', 'extra log files']) |
| 2143 |
u.obsolete('8.0.0', ['runtime', '__MANY__', 'job', 'shell']) |
| 2144 |
u.obsolete( |
| 2145 |
'8.0.0', |
| 2146 |
['runtime', '__MANY__', 'remote', 'suite definition directory'] |
| 2147 |
) |
| 2148 |
u.obsolete('8.0.0', ['cylc', 'abort if any task fails']) |
| 2149 |
u.obsolete('8.0.0', ['cylc', 'disable automatic shutdown']) |
| 2150 |
u.obsolete('8.0.0', ['cylc', 'environment'], is_section=True) |
| 2151 |
u.obsolete('8.0.0', ['cylc', 'reference test'], is_section=True) |
| 2152 |
u.obsolete( |
| 2153 |
'8.0.0', |
| 2154 |
['cylc', 'simulation', 'disable suite event handlers']) |
| 2155 |
u.obsolete('8.0.0', ['cylc', 'simulation'], is_section=True) |
| 2156 |
u.obsolete('8.0.0', ['visualization'], is_section=True) |
| 2157 |
u.obsolete('8.0.0', ['scheduling', 'spawn to max active cycle points']) |
| 2158 |
u.deprecate( |
| 2159 |
'8.0.0', |
| 2160 |
['cylc', 'task event mail interval'], |
| 2161 |
['cylc', 'mail', 'task event batch interval'], |
| 2162 |
silent=cylc.flow.flags.cylc7_back_compat, |
| 2163 |
) |
| 2164 |
u.deprecate( |
| 2165 |
'8.0.0', |
| 2166 |
['runtime', '__MANY__', 'suite state polling'], |
| 2167 |
['runtime', '__MANY__', 'workflow state polling'], |
| 2168 |
silent=cylc.flow.flags.cylc7_back_compat, |
| 2169 |
is_section=True, |
| 2170 |
) |
| 2171 |
u.obsolete( |
| 2172 |
'8.0.0', ['runtime', '__MANY__', 'workflow state polling', 'host']) |
| 2173 |
u.obsolete( |
| 2174 |
'8.0.0', ['runtime', '__MANY__', 'workflow state polling', 'user']) |
| 2175 |
|
| 2176 |
u.deprecate( |
| 2177 |
'8.3.0', |
| 2178 |
['runtime', '__MANY__', 'workflow state polling', 'run-dir'], |
| 2179 |
['runtime', '__MANY__', 'workflow state polling', 'alt-cylc-run-dir'], |
| 2180 |
silent=cylc.flow.flags.cylc7_back_compat, |
| 2181 |
) |
| 2182 |
|
| 2183 |
u.deprecate( |
| 2184 |
'8.0.0', |
| 2185 |
['cylc', 'parameters'], |
| 2186 |
['task parameters'], |
| 2187 |
silent=cylc.flow.flags.cylc7_back_compat, |
| 2188 |
is_section=True, |
| 2189 |
) |
| 2190 |
u.deprecate( |
| 2191 |
'8.0.0', |
| 2192 |
['cylc', 'parameter templates'], |
| 2193 |
['task parameters', 'templates'], |
| 2194 |
silent=cylc.flow.flags.cylc7_back_compat, |
| 2195 |
is_section=True, |
| 2196 |
) |
| 2197 |
# Whole workflow task mail settings |
| 2198 |
for mail_setting in ['to', 'from', 'footer']: |
| 2199 |
u.deprecate( |
| 2200 |
'8.0.0', |
| 2201 |
['cylc', 'events', f'mail {mail_setting}'], |
| 2202 |
['cylc', 'mail', mail_setting], |
| 2203 |
silent=cylc.flow.flags.cylc7_back_compat, |
| 2204 |
) |
| 2205 |
# Task mail settings in [runtime][TASK] |
| 2206 |
for mail_setting in ['to', 'from']: |
| 2207 |
u.deprecate( |
| 2208 |
'8.0.0', |
| 2209 |
['runtime', '__MANY__', 'events', f'mail {mail_setting}'], |
| 2210 |
['runtime', '__MANY__', 'mail', mail_setting], |
| 2211 |
silent=cylc.flow.flags.cylc7_back_compat, |
| 2212 |
) |
| 2213 |
u.deprecate( |
| 2214 |
'8.0.0', |
| 2215 |
['cylc', 'events', 'mail smtp'], |
| 2216 |
None, # This is really a .obsolete(), just with a custom message |
| 2217 |
cvtr=converter(lambda x: x, ( |
| 2218 |
'DELETED (OBSOLETE) - use "global.cylc[scheduler][mail]smtp" ' |
| 2219 |
'instead') |
| 2220 |
), |
| 2221 |
silent=cylc.flow.flags.cylc7_back_compat, |
| 2222 |
) |
| 2223 |
u.deprecate( |
| 2224 |
'8.0.0', |
| 2225 |
['runtime', '__MANY__', 'events', 'mail smtp'], |
| 2226 |
None, |
| 2227 |
cvtr=converter(lambda x: x, ( |
| 2228 |
'DELETED (OBSOLETE) - use "global.cylc[scheduler][mail]smtp" ' |
| 2229 |
'instead') |
| 2230 |
), |
| 2231 |
silent=cylc.flow.flags.cylc7_back_compat, |
| 2232 |
) |
| 2233 |
u.deprecate( |
| 2234 |
'8.0.0', |
| 2235 |
['scheduling', 'max active cycle points'], |
| 2236 |
['scheduling', 'runahead limit'], |
| 2237 |
cvtr=converter( |
| 2238 |
lambda x: f'P{int(x) - 1}' if x != '' else '', |
| 2239 |
'"{old}" -> "{new}"' |
| 2240 |
), |
| 2241 |
silent=cylc.flow.flags.cylc7_back_compat, |
| 2242 |
) |
| 2243 |
u.deprecate( |
| 2244 |
'8.0.0', |
| 2245 |
['scheduling', 'hold after point'], |
| 2246 |
['scheduling', 'hold after cycle point'], |
| 2247 |
silent=cylc.flow.flags.cylc7_back_compat, |
| 2248 |
) |
| 2249 |
|
| 2250 |
for job_setting in [ |
| 2251 |
'execution polling intervals', |
| 2252 |
'execution retry delays', |
| 2253 |
'execution time limit', |
| 2254 |
'submission polling intervals', |
| 2255 |
'submission retry delays' |
| 2256 |
]: |
| 2257 |
u.deprecate( |
| 2258 |
'8.0.0', |
| 2259 |
['runtime', '__MANY__', 'job', job_setting], |
| 2260 |
['runtime', '__MANY__', job_setting], |
| 2261 |
silent=cylc.flow.flags.cylc7_back_compat, |
| 2262 |
) |
| 2263 |
|
| 2264 |
# Workflow timeout is now measured from start of run. |
| 2265 |
# The old timeout was measured from start of stall. |
| 2266 |
for old, new in [ |
| 2267 |
('timeout', 'stall timeout'), |
| 2268 |
('abort on timeout', 'abort on stall timeout'), |
| 2269 |
('inactivity', 'inactivity timeout'), |
| 2270 |
('abort on inactivity', 'abort on inactivity timeout'), |
| 2271 |
('startup handler', 'startup handlers'), |
| 2272 |
('shutdown handler', 'shutdown handlers'), |
| 2273 |
('timeout handler', 'stall timeout handlers'), |
| 2274 |
('stalled handler', 'stall handlers'), |
| 2275 |
('aborted handler', 'abort handlers'), |
| 2276 |
('inactivity handler', 'inactivity timeout handlers'), |
| 2277 |
]: |
| 2278 |
u.deprecate( |
| 2279 |
'8.0.0', |
| 2280 |
['cylc', 'events', old], |
| 2281 |
['cylc', 'events', new], |
| 2282 |
silent=cylc.flow.flags.cylc7_back_compat, |
| 2283 |
) |
| 2284 |
|
| 2285 |
for old in [ |
| 2286 |
"expired handler", |
| 2287 |
"late handler", |
| 2288 |
"submitted handler", |
| 2289 |
"started handler", |
| 2290 |
"succeeded handler", |
| 2291 |
"failed handler", |
| 2292 |
"submission failed handler", |
| 2293 |
"warning handler", |
| 2294 |
"critical handler", |
| 2295 |
"retry handler", |
| 2296 |
"submission retry handler", |
| 2297 |
"execution timeout handler", |
| 2298 |
"submission timeout handler", |
| 2299 |
"custom handler" |
| 2300 |
]: |
| 2301 |
u.deprecate( |
| 2302 |
'8.0.0', |
| 2303 |
['runtime', '__MANY__', 'events', old], |
| 2304 |
['runtime', '__MANY__', 'events', f"{old}s"], |
| 2305 |
silent=cylc.flow.flags.cylc7_back_compat, |
| 2306 |
) |
| 2307 |
|
| 2308 |
for old in [ |
| 2309 |
'abort on stalled', |
| 2310 |
'abort if startup handler fails', |
| 2311 |
'abort if shutdown handler fails', |
| 2312 |
'abort if timeout handler fails', |
| 2313 |
'abort if inactivity handler fails', |
| 2314 |
'abort if stalled handler fails', |
| 2315 |
]: |
| 2316 |
u.obsolete('8.0.0', ['cylc', 'events', old]) |
| 2317 |
|
| 2318 |
u.deprecate( |
| 2319 |
'8.0.0', |
| 2320 |
['cylc'], |
| 2321 |
['scheduler'], |
| 2322 |
silent=cylc.flow.flags.cylc7_back_compat, |
| 2323 |
is_section=True, |
| 2324 |
) |
| 2325 |
u.upgrade() |
| 2326 |
|
| 2327 |
if broadcast != "cancel": |
| 2328 |
upgrade_graph_section(cfg, descr) |
| 2329 |
upgrade_param_env_templates(cfg, descr) |
| 2330 |
warn_about_depr_platform(cfg) |
| 2331 |
warn_about_depr_event_handler_tmpl(cfg) |
| 2332 |
|
| 2333 |
return u |
| 2334 |
|
| 2335 |
|
| 2336 |
def upgrade_graph_section(cfg: Dict[str, Any], descr: str) -> None: |
| 2337 |
"""Upgrade Cylc 7 `[scheduling][dependencies][X]graph` format to |
| 2338 |
`[scheduling][graph]X`.""" |
| 2339 |
# Parsec upgrader cannot do this type of move |
| 2340 |
with contextlib.suppress(KeyError): |
| 2341 |
note = '' |
| 2342 |
if 'dependencies' in cfg['scheduling']: |
| 2343 |
if ['graph'] == cfg['scheduling']['dependencies'].keys(): |
| 2344 |
msg_old = '[scheduling][dependencies]graph' |
| 2345 |
msg_new = '[scheduling][graph]R1' |
| 2346 |
list_cp = False |
| 2347 |
else: |
| 2348 |
note = ( |
| 2349 |
'\n ([scheduling][dependencies]graph moves to' |
| 2350 |
' [scheduling][graph]R1)' |
| 2351 |
if 'graph' in cfg['scheduling']['dependencies'] else '') |
| 2352 |
msg_old = '[scheduling][dependencies][X]graph' |
| 2353 |
msg_new = '[scheduling][graph]X - for X in:' |
| 2354 |
list_cp = True |
| 2355 |
|
| 2356 |
if 'graph' in cfg['scheduling']: |
| 2357 |
raise UpgradeError( |
| 2358 |
f'Cannot upgrade deprecated item "{msg_old} -> {msg_new}" ' |
| 2359 |
f'because {msg_new[:-1]} already exists.' |
| 2360 |
) |
| 2361 |
else: |
| 2362 |
keys: Set[str] = set() |
| 2363 |
cfg['scheduling'].setdefault('graph', {}) |
| 2364 |
cfg['scheduling']['graph'].update( |
| 2365 |
cfg['scheduling'].pop('dependencies') |
| 2366 |
) |
| 2367 |
graphdict: Dict[str, Any] = cfg['scheduling']['graph'] |
| 2368 |
for key, value in graphdict.copy().items(): |
| 2369 |
if isinstance(value, dict) and 'graph' in value: |
| 2370 |
graphdict[key] = value['graph'] |
| 2371 |
keys.add(key) |
| 2372 |
elif key == 'graph' and isinstance(value, str): |
| 2373 |
graphdict[key] = value |
| 2374 |
keys.add(key) |
| 2375 |
if keys and not cylc.flow.flags.cylc7_back_compat: |
| 2376 |
msg = ( |
| 2377 |
'graph items were automatically upgraded ' |
| 2378 |
f'in "{descr}":\n' |
| 2379 |
f' * (8.0.0) {msg_old} -> {msg_new}' |
| 2380 |
) |
| 2381 |
if list_cp: |
| 2382 |
msg += f"\n {', '.join(sorted(keys))}" |
| 2383 |
LOG.warning(msg + note) |
| 2384 |
|
| 2385 |
|
| 2386 |
def upgrade_param_env_templates(cfg, descr): |
| 2387 |
"""Prepend contents of `[runtime][X][parameter environment templates]` to |
| 2388 |
`[runtime][X][environment]`.""" |
| 2389 |
|
| 2390 |
if 'runtime' in cfg: |
| 2391 |
dep = '[runtime][%s][parameter environment templates]' |
| 2392 |
new = '[runtime][%s][environment]' |
| 2393 |
first_warn = True |
| 2394 |
for task_name, task_items in cfg['runtime'].items(): |
| 2395 |
if 'parameter environment templates' not in task_items: |
| 2396 |
continue |
| 2397 |
if not cylc.flow.flags.cylc7_back_compat: |
| 2398 |
if first_warn: |
| 2399 |
LOG.warning(upgrader.depr_msg) |
| 2400 |
first_warn = False |
| 2401 |
LOG.warning( |
| 2402 |
f' * (8.0.0) {dep % task_name} contents prepended to ' |
| 2403 |
f'{new % task_name}' |
| 2404 |
) |
| 2405 |
for key, val in reversed( |
| 2406 |
task_items['parameter environment templates'].items()): |
| 2407 |
if 'environment' in task_items: |
| 2408 |
if key in task_items['environment']: |
| 2409 |
LOG.warning( |
| 2410 |
f' *** {dep % task_name} {key} ignored as {key} ' |
| 2411 |
f'already exists in {new % task_name}' |
| 2412 |
) |
| 2413 |
continue |
| 2414 |
else: |
| 2415 |
task_items['environment'] = OrderedDictWithDefaults() |
| 2416 |
task_items['environment'].prepend(key, val) |
| 2417 |
task_items.pop('parameter environment templates') |
| 2418 |
|
| 2419 |
|
| 2420 |
def warn_about_depr_platform(cfg): |
| 2421 |
"""Validate platforms config. |
| 2422 |
|
| 2423 |
- Warn if deprecated host or batch system appear in config. |
| 2424 |
- Raise if platforms section is also present. |
| 2425 |
- Or raise if using invalid subshell syntax for platform def. |
| 2426 |
""" |
| 2427 |
if 'runtime' not in cfg: |
| 2428 |
return |
| 2429 |
for task_name, task_cfg in cfg['runtime'].items(): |
| 2430 |
if 'platform' in task_cfg and task_cfg['platform']: |
| 2431 |
fail_if_platform_and_host_conflict(task_cfg, task_name) |
| 2432 |
# Fail if backticks subshell e.g. platform = `foo`: |
| 2433 |
is_platform_definition_subshell(task_cfg['platform']) |
| 2434 |
elif not cylc.flow.flags.cylc7_back_compat: |
| 2435 |
depr = get_platform_deprecated_settings(task_cfg, task_name) |
| 2436 |
if depr: |
| 2437 |
msg = "\n".join(depr) |
| 2438 |
LOG.warning( |
| 2439 |
"deprecated settings found " |
| 2440 |
f"(please replace with [runtime][{task_name}]platform):" |
| 2441 |
f"\n{msg}" |
| 2442 |
) |
| 2443 |
|
| 2444 |
|
| 2445 |
def warn_about_depr_event_handler_tmpl(cfg): |
| 2446 |
"""Warn if deprecated template strings appear in event handlers.""" |
| 2447 |
if 'runtime' not in cfg or cylc.flow.flags.cylc7_back_compat: |
| 2448 |
return |
| 2449 |
deprecation_msg = ( |
| 2450 |
'The event handler template variable "%({0})s" is deprecated - ' |
| 2451 |
'use "%({1})s" instead.') |
| 2452 |
for task in cfg['runtime']: |
| 2453 |
if 'events' not in cfg['runtime'][task]: |
| 2454 |
continue |
| 2455 |
for handler in cfg['runtime'][task]['events'].values(): |
| 2456 |
if f'%({EventData.JobID_old.value})' in handler: |
| 2457 |
LOG.warning( |
| 2458 |
deprecation_msg.format(EventData.JobID_old.value, |
| 2459 |
EventData.JobID.value) |
| 2460 |
) |
| 2461 |
if f'%({EventData.JobRunnerName_old.value})' in handler: |
| 2462 |
LOG.warning( |
| 2463 |
deprecation_msg.format(EventData.JobRunnerName_old.value, |
| 2464 |
EventData.JobRunnerName.value) |
| 2465 |
) |
| 2466 |
if f'%({EventData.Suite.value})' in handler: |
| 2467 |
LOG.warning( |
| 2468 |
deprecation_msg.format(EventData.Suite.value, |
| 2469 |
EventData.Workflow.value) |
| 2470 |
) |
| 2471 |
if f'%({EventData.SuiteUUID.value})' in handler: |
| 2472 |
LOG.warning( |
| 2473 |
deprecation_msg.format(EventData.SuiteUUID.value, |
| 2474 |
EventData.UUID.value) |
| 2475 |
) |
| 2476 |
|
| 2477 |
|
| 2478 |
class RawWorkflowConfig(ParsecConfig): |
| 2479 |
"""Raw workflow configuration.""" |
| 2480 |
|
| 2481 |
def __init__(self, fpath, output_fname, tvars, options): |
| 2482 |
"""Return the default instance.""" |
| 2483 |
ParsecConfig.__init__( |
| 2484 |
self, SPEC, upg, output_fname, tvars, cylc_config_validate, |
| 2485 |
options |
| 2486 |
) |
| 2487 |
self.loadcfg(fpath, "workflow definition") |