diff --git a/lib/cylc/config.py b/lib/cylc/config.py index b30bc57eeb6..5e554ab964e 100644 --- a/lib/cylc/config.py +++ b/lib/cylc/config.py @@ -151,12 +151,15 @@ def __init__( self, suite, fpath, template_vars=[], 'dependencies', {}) if dependency_map.get('graph'): # There is an async graph setting. + # If it is by itself, it is integer shorthand. + # If there are cycling graphs as well, it is handled as + # backwards-compatiblity for mixed-async suites. + just_has_async_graph = True for item, value in dependency_map.items(): - if item == 'graph': - continue - if value.get('graph'): + if item != 'graph' and value.get('graph'): + just_has_async_graph = False break - else: + if just_has_async_graph: # There aren't any other graphs, so set integer cycling. self.cfg['scheduling']['cycling mode'] = ( INTEGER_CYCLING_TYPE @@ -216,7 +219,19 @@ def __init__( self, suite, fpath, template_vars=[], # after the call to init_cyclers, we can start getting proper points. init_cyclers(self.cfg) + if self.cfg['scheduling']['initial cycle point'] is not None: + initial_point = get_point( + self.cfg['scheduling']['initial cycle point']).standardise() + self.cfg['scheduling']['initial cycle point'] = str(initial_point) + + if self.cfg['scheduling']['final cycle point'] is not None: + final_point = get_point( + self.cfg['scheduling']['final cycle point']).standardise() + self.cfg['scheduling']['final cycle point'] = str(final_point) + self.cli_start_point = get_point(self._cli_start_string) + if self.cli_start_point is not None: + self.cli_start_point.standardise() flags.back_comp_cycling = ( get_backwards_compatibility_mode()) diff --git a/lib/cylc/scheduler.py b/lib/cylc/scheduler.py index 77d9559befe..0a5cd09df07 100644 --- a/lib/cylc/scheduler.py +++ b/lib/cylc/scheduler.py @@ -662,10 +662,16 @@ def configure_suite( self, reconfigure=False ): self._start_string or self._cli_start_string or self.config.cfg['scheduling']['initial cycle point'] ) + if self.start_point is not None: + self.start_point.standardise() + self.stop_point = get_point( self.options.stop_string or self.config.cfg['scheduling']['final cycle point'] ) + if self.stop_point is not None: + self.stop_point.standardise() + if (not self.start_point and not self.is_restart and self.config.cycling_tasks): print >> sys.stderr, 'WARNING: No initial cycle point provided - no cycling tasks will be loaded.' diff --git a/tests/jobscript/00-torture.t b/tests/jobscript/00-torture.t index 88389858945..096bad1853f 100644 --- a/tests/jobscript/00-torture.t +++ b/tests/jobscript/00-torture.t @@ -35,4 +35,3 @@ echo "" >> jobfile sed 's/##suitename##/'$SUITE_NAME'/' $TEST_SOURCE_DIR/torture/foo.ref-jobfile > reffile cmp_ok jobfile reffile purge_suite $SUITE_NAME -rm -rf $(cylc get-global-config --print-run-dir)/$SUITE_NAME-submit diff --git a/tests/jobscript/01-multi.t b/tests/jobscript/01-multi.t index 8e0b00292dd..4ad71bd8e7a 100644 --- a/tests/jobscript/01-multi.t +++ b/tests/jobscript/01-multi.t @@ -94,6 +94,3 @@ grep -A1 "TASK COMMAND SCRIPTING" exp.jobfile > exp.task_cmd cmp_ok exp.task_cmd $TEST_SOURCE_DIR/multi/exp.cmd purge_suite $SUITE_NAME -if [[ -n $SUITE_NAME ]]; then - rm -rf $(cylc get-global-config --print-run-dir)/$SUITE_NAME-submit -fi diff --git a/tests/jobscript/02-cycling.t b/tests/jobscript/02-cycling.t new file mode 100644 index 00000000000..743f1d84382 --- /dev/null +++ b/tests/jobscript/02-cycling.t @@ -0,0 +1,35 @@ +#!/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 . +#------------------------------------------------------------------------------- +# job script torture test and check jobscript is generated correctly +. $(dirname $0)/test_header +#------------------------------------------------------------------------------- +set_test_number 4 +#------------------------------------------------------------------------------- +install_suite $TEST_NAME_BASE cycling +#------------------------------------------------------------------------------- +TEST_NAME=$TEST_NAME_BASE-validate +run_ok $TEST_NAME cylc validate $SUITE_NAME +#------------------------------------------------------------------------------- +TEST_NAME=$TEST_NAME_BASE-run +suite_run_ok $TEST_NAME cylc run --reference-test --debug $SUITE_NAME +#------------------------------------------------------------------------------- +TEST_NAME=$TEST_NAME_BASE-foo-jobscript-match +run_ok $TEST_NAME cylc jobscript $SUITE_NAME foo.20140203T00+13 +sed -n '/_POINT=/p' $TEST_NAME.stdout > jobfile +cmp_ok jobfile $TEST_SOURCE_DIR/cycling/foo.ref-jobfile +purge_suite $SUITE_NAME diff --git a/tests/jobscript/cycling/bin/foo.sh b/tests/jobscript/cycling/bin/foo.sh new file mode 100755 index 00000000000..20e052b7f47 --- /dev/null +++ b/tests/jobscript/cycling/bin/foo.sh @@ -0,0 +1,2 @@ +#!/bin/bash +echo "Hello from $0" diff --git a/tests/jobscript/cycling/foo.ref-jobfile b/tests/jobscript/cycling/foo.ref-jobfile new file mode 100644 index 00000000000..be5f5b9b696 --- /dev/null +++ b/tests/jobscript/cycling/foo.ref-jobfile @@ -0,0 +1,3 @@ +export CYLC_SUITE_FINAL_CYCLE_POINT=20140204T1200+13 +export CYLC_SUITE_INITIAL_CYCLE_POINT=20140201T0500+13 +export CYLC_TASK_CYCLE_POINT=20140203T0000+13 diff --git a/tests/jobscript/cycling/reference.log b/tests/jobscript/cycling/reference.log new file mode 100644 index 00000000000..e202571fa93 --- /dev/null +++ b/tests/jobscript/cycling/reference.log @@ -0,0 +1,35 @@ +2014-07-16T12:18:22+01 INFO - Thread-2 start (Event Handlers) +2014-07-16T12:18:22+01 INFO - Thread-3 start (Poll & Kill Commands) +2014-07-16T12:18:22+01 INFO - port:7767 +2014-07-16T12:18:22+01 INFO - Suite starting at 2014-07-16T12:18:22+01 +2014-07-16T12:18:22+01 INFO - Log event clock: real time +2014-07-16T12:18:22+01 INFO - Run mode: live +2014-07-16T12:18:22+01 INFO - Start tag: 20140201T0500+13 +2014-07-16T12:18:22+01 INFO - Stop tag: 20140204T1200+13 +2014-07-16T12:18:22+01 INFO - Thread-4 start (Job Submission) +2014-07-16T12:18:22+01 INFO - Thread-5 start (Request Handling) +2014-07-16T12:18:22+01 INFO - Cold Start 20140201T0500+13 +2014-07-16T12:18:22+01 INFO - [foo.20140202T0000+13] -triggered off [] +2014-07-16T12:18:23+01 INFO - [foo.20140202T0000+13] -(current:ready)> foo.20140202T0000+13 submitting now +2014-07-16T12:18:24+01 INFO - [foo.20140202T0000+13] -(current:ready)> foo.20140202T0000+13 submission succeeded +2014-07-16T12:18:24+01 INFO - [foo.20140202T0000+13] -(current:submitted)> foo.20140202T0000+13 submit_method_id=3368 +2014-07-16T12:18:25+01 INFO - [foo.20140202T0000+13] -(current:submitted)> foo.20140202T0000+13 started at 2014-07-16T12:18:24+01 +2014-07-16T12:18:26+01 INFO - [foo.20140203T0000+13] -triggered off [] +2014-07-16T12:18:26+01 INFO - [foo.20140202T0000+13] -(current:running)> foo.20140202T0000+13 succeeded at 2014-07-16T12:18:25+01 +2014-07-16T12:18:27+01 INFO - [foo.20140203T0000+13] -(current:ready)> foo.20140203T0000+13 submitting now +2014-07-16T12:18:27+01 INFO - [foo.20140203T0000+13] -(current:ready)> foo.20140203T0000+13 submission succeeded +2014-07-16T12:18:27+01 INFO - [foo.20140203T0000+13] -(current:submitted)> foo.20140203T0000+13 submit_method_id=3566 +2014-07-16T12:18:28+01 INFO - [foo.20140203T0000+13] -(current:submitted)> foo.20140203T0000+13 started at 2014-07-16T12:18:28+01 +2014-07-16T12:18:29+01 INFO - [foo.20140204T0000+13] -triggered off [] +2014-07-16T12:18:29+01 INFO - [foo.20140203T0000+13] -(current:running)> foo.20140203T0000+13 succeeded at 2014-07-16T12:18:28+01 +2014-07-16T12:18:30+01 INFO - [foo.20140204T0000+13] -(current:ready)> foo.20140204T0000+13 submitting now +2014-07-16T12:18:30+01 INFO - [foo.20140204T0000+13] -(current:ready)> foo.20140204T0000+13 submission succeeded +2014-07-16T12:18:30+01 INFO - [foo.20140204T0000+13] -(current:submitted)> foo.20140204T0000+13 submit_method_id=3780 +2014-07-16T12:18:31+01 INFO - [foo.20140205T0000+13] -holding (beyond suite stop point) 20140204T1200+13 +2014-07-16T12:18:31+01 INFO - [foo.20140204T0000+13] -(current:submitted)> foo.20140204T0000+13 started at 2014-07-16T12:18:31+01 +2014-07-16T12:18:32+01 INFO - [foo.20140204T0000+13] -(current:running)> foo.20140204T0000+13 succeeded at 2014-07-16T12:18:32+01 +2014-07-16T12:18:32+01 INFO - Stopping: + + all tasks have spawned past the final cycle 20140204T1200+13 +2014-07-16T12:18:33+01 INFO - Thread-2 exit (Event Handlers) +2014-07-16T12:18:33+01 INFO - Thread-3 exit (Poll & Kill Commands) +2014-07-16T12:18:33+01 INFO - Thread-4 exit (Job Submission) diff --git a/tests/jobscript/cycling/suite.rc b/tests/jobscript/cycling/suite.rc new file mode 100644 index 00000000000..1de4fd451b5 --- /dev/null +++ b/tests/jobscript/cycling/suite.rc @@ -0,0 +1,29 @@ + +title = "job script cycling test" + +description = """Test the output of cycling environment variables""" + +[cylc] + cycle point time zone = +13 + [[reference test]] + live mode suite timeout = 0.5 + dummy mode suite timeout = 0.5 + simulation mode suite timeout = 0.5 + +[scheduling] + initial cycle point = 20140201T05 + final cycle point = 20140204T11+12 + [[dependencies]] + [[[T00]]] + graph = "foo" +[runtime] + [[foo]] + initial scripting = echo HELLO FROM INITIAL SCRIPTING + pre-command scripting = echo HELLO FROM PRE-COMMAND SCRIPTING + command scripting = echo HELLO FROM COMMAND SCRIPTING + post-command scripting = echo HELLO FROM POST-COMMAND SCRIPTING + [[[remote]]] + # force use of ssh job submission to disconnect local tasks + # from the submitting suite environment. + host = localhost +