Skip to content

Commit

Permalink
Correctly store stop_point for restart
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewrmshin committed May 1, 2019
1 parent 4fa4e95 commit 618f8ea
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 37 deletions.
48 changes: 11 additions & 37 deletions lib/cylc/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,35 +546,10 @@ def _load_suite_params_2(self, row_idx, row):
if key == "is_held":
self.pool.is_held = bool(value)
LOG.info("+ hold suite = %s" % (bool(value),))
return
for key_str, self_attr, option_ignore_attr in [
("initial", "start_point", "ignore_start_point"),
("final", "stop_point", "ignore_stop_point")]:
if key != key_str + "_point" or value is None or value == 'None':
continue
# the suite_params table prescribes a start/stop cycle
# (else we take whatever the suite.rc file gives us)
point = get_point(value)
my_point = getattr(self, self_attr)
if getattr(self.options, option_ignore_attr):
# ignore it and take whatever the suite.rc file gives us
if my_point is not None:
LOG.warning(
"I'm ignoring the old " + key_str +
" cycle point as requested,\n"
"but I can't ignore the one set"
" on the command line or in the suite definition.")
elif my_point is not None:
# Given in the suite.rc file
if my_point != point:
LOG.warning(
"old %s cycle point %s, overriding suite.rc %s" %
(key_str, point, my_point))
setattr(self, self_attr, point)
else:
# reinstate from old
setattr(self, self_attr, point)
LOG.info("+ %s cycle point = %s" % (key_str, value))
elif key == "stop_point":
if not self.options.ignore_stop_point:
self.stop_point = get_point(value)
LOG.info("+ stop cycle point = %s" % value)

def _load_task_run_times(self, row_idx, row):
"""Load run times of previously succeeded task jobs."""
Expand Down Expand Up @@ -867,15 +842,15 @@ def command_set_stop_after_clock_time(self, arg):
"""
parser = TimePointParser()
try:
stop_point = parser.parse(arg)
stop_time = parser.parse(arg)
except ValueError as exc:
try:
stop_point = parser.strptime(arg, "%Y/%m/%d-%H:%M")
stop_time = parser.strptime(arg, "%Y/%m/%d-%H:%M")
except ValueError:
raise exc # Raise the first (prob. more relevant) ValueError.
stop_time_in_epoch_seconds = int(stop_point.get(
stop_time_in_epoch_seconds = int(stop_time.get(
"seconds_since_unix_epoch"))
self.set_stop_clock(stop_time_in_epoch_seconds, str(stop_point))
self.set_stop_clock(stop_time_in_epoch_seconds, str(stop_time))

def command_set_stop_after_task(self, task_id):
"""Set stop after a task."""
Expand Down Expand Up @@ -1130,8 +1105,9 @@ def _load_suite_params_1(self, _, row):
self.task_events_mgr.pflag = True
elif key in ['start_point', 'warm_point']:
# 'warm_point' for back compat <= 7.6.X
self.cli_start_point_string = value
self.task_events_mgr.pflag = True
if not self.options.ignore_start_point:
self.cli_start_point_string = value
self.task_events_mgr.pflag = True
elif key == 'uuid_str':
self.uuid_str.value = value

Expand Down Expand Up @@ -1470,8 +1446,6 @@ def can_auto_restart(self):
('pool_hold_point', self.pool_hold_point),
('run_mode', self.run_mode != 'live'),
('stop_clock_time', self.stop_clock_time),
('stop_point', (self.stop_point and
self.stop_point != self.final_point)),
# ^ https://github.com/cylc/cylc/issues/2799#issuecomment-436720805
('stop_task', self.stop_task)
] if value]
Expand Down
3 changes: 3 additions & 0 deletions lib/cylc/suite_db_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@ def put_suite_params(self, schd):
if schd.cli_start_point_string:
self.db_inserts_map[self.TABLE_SUITE_PARAMS].append({
"key": "start_point", "value": schd.cli_start_point_string})
if schd.stop_point:
self.db_inserts_map[self.TABLE_SUITE_PARAMS].append({
"key": "stop_point", "value": schd.stop_point})

def put_suite_template_vars(self, template_vars):
"""Put template_vars in runtime database.
Expand Down

0 comments on commit 618f8ea

Please sign in to comment.