|
18 | 18 | import contextlib
|
19 | 19 | import re
|
20 | 20 | from textwrap import dedent
|
21 |
| -from typing import Any, Dict, Optional, Set |
| 21 | +from typing import ( |
| 22 | + Any, |
| 23 | + Dict, |
| 24 | + Optional, |
| 25 | + Set, |
| 26 | +) |
22 | 27 |
|
23 | 28 | from metomi.isodatetime.data import Calendar
|
24 | 29 |
|
25 | 30 | from cylc.flow import LOG
|
26 | 31 | from cylc.flow.cfgspec.globalcfg import (
|
27 | 32 | DIRECTIVES_DESCR,
|
28 | 33 | DIRECTIVES_ITEM_DESCR,
|
29 |
| - LOG_RETR_SETTINGS, |
30 | 34 | EVENTS_DESCR,
|
31 | 35 | EVENTS_SETTINGS,
|
32 | 36 | EXECUTION_POLL_DESCR,
|
| 37 | + LOG_RETR_SETTINGS, |
33 | 38 | MAIL_DESCR,
|
34 | 39 | MAIL_FOOTER_DESCR,
|
35 | 40 | MAIL_FROM_DESCR,
|
|
47 | 52 | UTC_MODE_DESCR,
|
48 | 53 | )
|
49 | 54 | import cylc.flow.flags
|
50 |
| -from cylc.flow.parsec.exceptions import UpgradeError |
51 |
| -from cylc.flow.parsec.config import ParsecConfig, ConfigNode as Conf |
52 | 55 | from cylc.flow.parsec.OrderedDict import OrderedDictWithDefaults
|
53 |
| -from cylc.flow.parsec.upgrade import upgrader, converter |
| 56 | +from cylc.flow.parsec.config import ( |
| 57 | + ConfigNode as Conf, |
| 58 | + ParsecConfig, |
| 59 | +) |
| 60 | +from cylc.flow.parsec.exceptions import UpgradeError |
| 61 | +from cylc.flow.parsec.upgrade import ( |
| 62 | + converter, |
| 63 | + upgrader, |
| 64 | +) |
54 | 65 | from cylc.flow.parsec.validate import (
|
55 |
| - DurationFloat, CylcConfigValidator as VDR, cylc_config_validate) |
| 66 | + CylcConfigValidator as VDR, |
| 67 | + DurationFloat, |
| 68 | + cylc_config_validate, |
| 69 | +) |
56 | 70 | from cylc.flow.platforms import (
|
57 |
| - fail_if_platform_and_host_conflict, get_platform_deprecated_settings, |
58 |
| - is_platform_definition_subshell) |
59 |
| -from cylc.flow.run_modes import RunMode |
| 71 | + fail_if_platform_and_host_conflict, |
| 72 | + get_platform_deprecated_settings, |
| 73 | + is_platform_definition_subshell, |
| 74 | +) |
| 75 | +from cylc.flow.run_modes import ( |
| 76 | + TASK_CONFIG_RUN_MODES, |
| 77 | + RunMode, |
| 78 | +) |
60 | 79 | from cylc.flow.task_events_mgr import EventData
|
61 |
| -from cylc.flow.run_modes import TASK_CONFIG_RUN_MODES |
62 | 80 |
|
63 | 81 |
|
64 | 82 | # Regex to check whether a string is a command
|
@@ -393,9 +411,16 @@ def get_script_common_text(this: str, example: Optional[str] = None):
|
393 | 411 | )
|
394 | 412 | ))
|
395 | 413 |
|
396 |
| - with Conf('events', |
397 |
| - desc=global_default(EVENTS_DESCR, '[scheduler][events]')): |
398 |
| - for item, desc in EVENTS_SETTINGS.items(): |
| 414 | + with Conf( |
| 415 | + 'events', desc=global_default(EVENTS_DESCR, '[scheduler][events]') |
| 416 | + ): |
| 417 | + for item, val in EVENTS_SETTINGS.items(): |
| 418 | + if isinstance(val, dict): |
| 419 | + val = val.copy() |
| 420 | + desc: str = val.pop('desc') |
| 421 | + else: |
| 422 | + desc = val |
| 423 | + val = {} |
399 | 424 | desc = global_default(desc, f"[scheduler][events]{item}")
|
400 | 425 | vdr_type = VDR.V_STRING_LIST
|
401 | 426 | default: Any = Conf.UNSET
|
@@ -426,7 +451,7 @@ def get_script_common_text(this: str, example: Optional[str] = None):
|
426 | 451 | vdr_type = VDR.V_BOOLEAN
|
427 | 452 | elif item.endswith("timeout"):
|
428 | 453 | vdr_type = VDR.V_INTERVAL
|
429 |
| - Conf(item, vdr_type, default, desc=desc) |
| 454 | + Conf(item, vdr_type, default, desc=desc, **val) |
430 | 455 |
|
431 | 456 | Conf('expected task failures', VDR.V_STRING_LIST, desc='''
|
432 | 457 | (For Cylc developers writing a functional tests only)
|
@@ -2190,13 +2215,15 @@ def upg(cfg, descr):
|
2190 | 2215 | silent=cylc.flow.flags.cylc7_back_compat,
|
2191 | 2216 | )
|
2192 | 2217 |
|
2193 |
| - u.obsolete('8.0.0', ['cylc', 'events', 'abort on stalled']) |
2194 |
| - u.obsolete('8.0.0', ['cylc', 'events', 'abort if startup handler fails']) |
2195 |
| - u.obsolete('8.0.0', ['cylc', 'events', 'abort if shutdown handler fails']) |
2196 |
| - u.obsolete('8.0.0', ['cylc', 'events', 'abort if timeout handler fails']) |
2197 |
| - u.obsolete('8.0.0', ['cylc', 'events', |
2198 |
| - 'abort if inactivity handler fails']) |
2199 |
| - u.obsolete('8.0.0', ['cylc', 'events', 'abort if stalled handler fails']) |
| 2218 | + for old in [ |
| 2219 | + 'abort on stalled', |
| 2220 | + 'abort if startup handler fails', |
| 2221 | + 'abort if shutdown handler fails', |
| 2222 | + 'abort if timeout handler fails', |
| 2223 | + 'abort if inactivity handler fails', |
| 2224 | + 'abort if stalled handler fails', |
| 2225 | + ]: |
| 2226 | + u.obsolete('8.0.0', ['cylc', 'events', old]) |
2200 | 2227 |
|
2201 | 2228 | u.deprecate(
|
2202 | 2229 | '8.0.0',
|
@@ -2279,10 +2306,7 @@ def upgrade_param_env_templates(cfg, descr):
|
2279 | 2306 | continue
|
2280 | 2307 | if not cylc.flow.flags.cylc7_back_compat:
|
2281 | 2308 | if first_warn:
|
2282 |
| - LOG.warning( |
2283 |
| - 'deprecated items automatically upgraded in ' |
2284 |
| - f'"{descr}":' |
2285 |
| - ) |
| 2309 | + LOG.warning(upgrader.DEPR_MSG) |
2286 | 2310 | first_warn = False
|
2287 | 2311 | LOG.warning(
|
2288 | 2312 | f' * (8.0.0) {dep % task_name} contents prepended to '
|
|
0 commit comments