Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warning about recurrence fmt 1 in Cylc7 back-compat mode #54

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"