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

Fix reload with stop point #2546

Merged
merged 1 commit into from
Jan 23, 2018
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
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']
Copy link
Collaborator

@sadielbartholomew sadielbartholomew Jan 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This highlights the usefulness of a revamped suite log as outlined in #1032 - with a line (or a note in the 'stopping' notification near the end) conveying the setting of a stop point via a cylc stop <suite name> <stop point> command it would be clear the suite doesn't shutdown erroneously before the FCP.

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