Skip to content

Commit

Permalink
Merge pull request #54 from MetRonnie/iso-fmt-1-warn
Browse files Browse the repository at this point in the history
Add warning about recurrence fmt 1 in Cylc7 back-compat mode
  • Loading branch information
oliver-sanders authored Apr 21, 2022
2 parents 6a3f434 + 2a8e661 commit ba2c577
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
10 changes: 10 additions & 0 deletions cylc/flow/time_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
CylcMissingFinalCyclePointError,
CylcTimeSyntaxError,
)
import cylc.flow.flags

if TYPE_CHECKING:
from metomi.isodatetime.data import TimePoint
Expand Down Expand Up @@ -299,6 +300,15 @@ def parse_recurrence(self, expression,
f"recurrence {expression}."
)

if cylc.flow.flags.cylc7_back_compat and format_num == 1:
LOG.warning(
f"The recurrence '{expression}' is unlikely to behave "
"the same way as in Cylc 7 as that implementation was "
"incorrect (see https://cylc.github.io/cylc-doc/latest/"
"html/user-guide/writing-workflows/scheduling.html"
"#format-1-r-limit-datetime-datetime)"
)

return TimeRecurrence(
repetitions=repetitions,
start_point=start_point,
Expand Down
12 changes: 9 additions & 3 deletions tests/functional/deprecations/03-suiterc.t
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@
#------------------------------------------------------------------------------
# Test backwards compatibility for suite.rc files

# Includes a test for warning about recurrence format 1 which changed
# implementation - https://github.com/cylc/cylc-flow/pull/4554

. "$(dirname "$0")/test_header"
set_test_number 2
set_test_number 3

init_suiterc() {
local TEST_NAME="$1"
Expand All @@ -33,13 +36,16 @@ init_suiterc "${TEST_NAME_BASE}" <<'__FLOW__'
[scheduler]
allow implicit tasks = True
[scheduling]
initial cycle point = 2000
[[graph]]
R1 = foo => bar
R2/2000/2001 = foo => bar
__FLOW__

MSG=$(python -c 'from cylc.flow.workflow_files import SUITERC_DEPR_MSG;
print(SUITERC_DEPR_MSG)')

TEST_NAME="${TEST_NAME_BASE}-validate"
run_ok "${TEST_NAME}" cylc validate .
grep_ok "$MSG" "${TEST_NAME_BASE}-validate.stderr"
grep_ok "$MSG" "${TEST_NAME}.stderr"
grep_ok "The recurrence 'R2/2000/2001' is unlikely to behave the same way as in Cylc 7 " \
"${TEST_NAME}.stderr"

0 comments on commit ba2c577

Please sign in to comment.