Skip to content

Commit

Permalink
Fix reload with stop point
Browse files Browse the repository at this point in the history
Reload will no longer reset existing stop point.
  • Loading branch information
matthewrmshin committed Jan 19, 2018
1 parent baab788 commit 57ebff0
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 8 deletions.
13 changes: 5 additions & 8 deletions lib/cylc/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,11 @@ def command_reload_suite(self):
self.task_events_mgr.broadcast_mgr.linearized_ancestors = (
self.config.get_linearized_ancestors())
self.suite_db_mgr.put_runtime_inheritance(self.config)
self.pool.set_do_reload(self.config, self.final_point)
if self.stop_point is None:
stop_point = self.final_point
else:
stop_point = self.stop_point
self.pool.set_do_reload(self.config, stop_point)
self.task_events_mgr.mail_interval = self._get_cylc_conf(
"task event mail interval")
self.task_events_mgr.mail_footer = self._get_events_conf("mail footer")
Expand Down Expand Up @@ -1598,13 +1602,6 @@ def release_suite(self):
sdm = self.suite_db_mgr
sdm.db_deletes_map[sdm.TABLE_SUITE_PARAMS].append({"key": "is_held"})

def clear_stop_times(self):
"""Clear attributes associated with stop time."""
self.stop_point = None
self.stop_clock_time = None
self.stop_clock_time_string = None
self.stop_task = None

def paused(self):
"""Is the suite paused?"""
return self.pool.is_held
Expand Down
43 changes: 43 additions & 0 deletions tests/reload/20-stop-point.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
# THIS FILE IS PART OF THE CYLC SUITE ENGINE.
# Copyright (C) 2008-2018 NIWA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#-------------------------------------------------------------------------------
# Test set stop point then reload. Reload should not reset stop point.
. "$(dirname "$0")/test_header"

set_test_number 3
install_suite "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"

run_ok "${TEST_NAME_BASE}-validate" cylc validate "${SUITE_NAME}"
suite_run_ok "${TEST_NAME_BASE}-run" \
cylc run --debug --no-detach --reference-test "${SUITE_NAME}"
if ! which sqlite3 > /dev/null; then
skip 1 "sqlite3 not installed?"
purge_suite "${SUITE_NAME}"
exit 0
fi
sqlite3 "${SUITE_RUN_DIR}/.service/db" \
'SELECT cycle,name,run_status FROM task_jobs' | sort >'db.out'
cmp_ok 'db.out' <<'__OUT__'
1|reload|0
1|set-stop-point|0
1|t1|0
2|t1|0
3|t1|0
__OUT__

purge_suite "${SUITE_NAME}"
exit
7 changes: 7 additions & 0 deletions tests/reload/20-stop-point/reference.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
2016-07-08T14:53:12+01 INFO - Initial point: 1
2016-07-08T14:53:12+01 INFO - Final point: 5
2016-07-08T14:53:12+01 INFO - [set-stop-point.1] -triggered off []
2016-07-08T14:53:19+01 INFO - [reload.1] -triggered off ['set-stop-point.1']
2016-07-08T14:53:19+01 INFO - [t1.1] -triggered off ['reload.1']
2016-07-08T14:53:19+01 INFO - [t1.2] -triggered off ['t1.1']
2016-07-08T14:53:19+01 INFO - [t1.3] -triggered off ['t1.2']
33 changes: 33 additions & 0 deletions tests/reload/20-stop-point/suite.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!Jinja2
[cylc]
[[events]]
abort on stalled = True
[[reference test]]
live mode suite timeout = PT1M
required run mode = live
[scheduling]
cycling mode = integer
initial cycle point = 1
final cycle point = 5
[[dependencies]]
[[[R1]]]
graph="set-stop-point => reload => t1"
[[[P1]]]
graph="t1[-P1] => t1"

[runtime]
[[set-stop-point]]
script=cylc stop "${CYLC_SUITE_NAME}" '3'
[[reload]]
script="""
wait "${CYLC_TASK_MESSAGE_STARTED_PID}" 2>/dev/null || true
cylc reload "${CYLC_SUITE_NAME}"
LOG="${CYLC_SUITE_LOG_DIR}/log"
while ! grep -q 'Reload completed' "${LOG}"; do
sleep 1 # make sure reload completes
done
"""
[[[job]]]
execution time limit = PT1M
[[t1]]
script=true

0 comments on commit 57ebff0

Please sign in to comment.