Skip to content

Commit

Permalink
Merge pull request #1035 from benfitzpatrick/1021.no_clock_tr_360
Browse files Browse the repository at this point in the history
#1021: disallow clock triggers for non-iso8601 cyclers
  • Loading branch information
arjclark committed Jul 29, 2014
2 parents 34c5b22 + 8da095f commit fd7d71a
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/cylc/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
init_cyclers, INTEGER_CYCLING_TYPE,
ISO8601_CYCLING_TYPE,
get_backwards_compatibility_mode)
from isodatetime.data import Calendar
from envvar import check_varnames, expandvars
from copy import deepcopy, copy
from output import outputx
Expand Down Expand Up @@ -253,6 +254,13 @@ def __init__( self, suite, fpath, template_vars=[],
else:
m = re.match( CLOCK_OFFSET_RE, item )
if m:
if (self.cfg['scheduling']['cycling mode'] !=
Calendar.MODE_GREGORIAN):
raise SuiteConfigError(
"ERROR: clock-triggered tasks require " +
"[scheduling]cycling mode=%s" %
Calendar.MODE_GREGORIAN
)
name, offset = m.groups()
try:
float( offset )
Expand Down
31 changes: 31 additions & 0 deletions tests/special/07-clock-triggered-360.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
#C: THIS FILE IS PART OF THE CYLC SUITE ENGINE.
#C: Copyright (C) 2008-2014 Hilary Oliver, NIWA
#C:
#C: This program is free software: you can redistribute it and/or modify
#C: it under the terms of the GNU General Public License as published by
#C: the Free Software Foundation, either version 3 of the License, or
#C: (at your option) any later version.
#C:
#C: This program is distributed in the hope that it will be useful,
#C: but WITHOUT ANY WARRANTY; without even the implied warranty of
#C: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#C: GNU General Public License for more details.
#C:
#C: You should have received a copy of the GNU General Public License
#C: along with this program. If not, see <http://www.gnu.org/licenses/>.
#-------------------------------------------------------------------------------
# Test clock triggering is working
. $(dirname $0)/test_header
#-------------------------------------------------------------------------------
set_test_number 2
#-------------------------------------------------------------------------------
install_suite $TEST_NAME_BASE clock-360
#-------------------------------------------------------------------------------
TEST_NAME=$TEST_NAME_BASE-validate
run_fail $TEST_NAME cylc validate $SUITE_NAME
cat $TEST_NAME.stderr >/dev/tty
grep_ok "ERROR: clock-triggered tasks require \[scheduling\]cycling mode=" \
$TEST_NAME.stderr
#-------------------------------------------------------------------------------
purge_suite $SUITE_NAME
19 changes: 19 additions & 0 deletions tests/special/clock-360/suite.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!Jinja2
[cylc]
UTC mode = True
[[event hooks]]
abort on timeout = True
timeout = 0.5
[scheduling]
initial cycle time = 20130101T00
final cycle time = 20150101T00
cycling mode = 360day
[[special tasks]]
clock-triggered = clock(0)
[[dependencies]]
[[[T00]]]
graph = "clock"
[runtime]
[[clock]]
command scripting = true

0 comments on commit fd7d71a

Please sign in to comment.