Skip to content

Commit

Permalink
Clarify summary time updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
hjoliver committed Mar 20, 2018
1 parent 3260103 commit af49813
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
19 changes: 10 additions & 9 deletions lib/cylc/task_events_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def process_message(self, itask, severity, message, poll_func,
elif message.startswith(TaskMessage.VACATION_MESSAGE_PREFIX):
# Task job pre-empted into a vacation state
self._db_events_insert(itask, "vacated", message)
itask.set_event_time('started') # reset
itask.set_summary_time('started') # unset
if TASK_STATUS_SUBMIT_RETRYING in itask.try_timers:
itask.try_timers[TASK_STATUS_SUBMIT_RETRYING].num = 0
itask.job_vacated = True
Expand Down Expand Up @@ -596,7 +596,7 @@ def _process_message_failed(self, itask, event_time, message):
"""Helper for process_message, handle a failed message."""
if event_time is None:
event_time = get_current_time_string()
itask.set_event_time('finished', event_time)
itask.set_summary_time('finished', event_time)
self.suite_db_mgr.put_update_task_jobs(itask, {
"run_status": 1,
"time_run_exit": event_time,
Expand Down Expand Up @@ -629,7 +629,7 @@ def _process_message_started(self, itask, event_time):
LOG.warning("Vacated job restarted", itask=itask)
self.pflag = True
itask.state.reset_state(TASK_STATUS_RUNNING)
itask.set_event_time('started', event_time)
itask.set_summary_time('started', event_time)
self.suite_db_mgr.put_update_task_jobs(itask, {
"time_run": itask.summary['started_time_string']})
if itask.summary['execution_time_limit']:
Expand All @@ -652,7 +652,7 @@ def _process_message_started(self, itask, event_time):
def _process_message_succeeded(self, itask, event_time):
"""Helper for process_message, handle a succeeded message."""
self.pflag = True
itask.set_event_time('finished', event_time)
itask.set_summary_time('finished', event_time)
self.suite_db_mgr.put_update_task_jobs(itask, {
"run_status": 0,
"time_run_exit": event_time,
Expand Down Expand Up @@ -688,7 +688,6 @@ def _process_message_submit_failed(self, itask, event_time):
if (TASK_STATUS_SUBMIT_RETRYING not in itask.try_timers or
itask.try_timers[TASK_STATUS_SUBMIT_RETRYING].next() is None):
# No submission retry lined up: definitive failure.
itask.set_event_time('finished', event_time)
self.pflag = True
# See github #476.
self.setup_event_handlers(
Expand Down Expand Up @@ -726,14 +725,16 @@ def _process_message_submitted(self, itask, event_time):

if itask.tdef.run_mode == 'simulation':
# Simulate job execution at this point.
itask.set_event_time('started', event_time)
itask.set_summary_time('submitted', event_time)
itask.set_summary_time('started', event_time)
itask.state.reset_state(TASK_STATUS_RUNNING)
itask.state.outputs.set_completion(TASK_OUTPUT_STARTED, True)
return

itask.set_event_time('submitted', event_time)
itask.set_event_time('started')
itask.set_event_time('finished')
itask.set_summary_time('submitted', event_time)
# Unset started and finished times in case of resubmission.
itask.set_summary_time('started')
itask.set_summary_time('finished')
itask.summary['latest_message'] = TASK_OUTPUT_SUBMITTED
self.setup_event_handlers(
itask, TASK_OUTPUT_SUBMITTED, 'job submitted')
Expand Down
12 changes: 5 additions & 7 deletions lib/cylc/task_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,9 @@ def load_db_task_pool_for_restart(self, row_idx, row):
itask.task_owner = None
itask.task_host = user_at_host
if time_submit:
itask.set_event_time('submitted', time_submit)
itask.set_summary_time('submitted', time_submit)
if time_run:
itask.set_event_time('started', time_run)
itask.set_summary_time('started', time_run)
if timeout is not None:
itask.timeout_timers[status] = timeout

Expand Down Expand Up @@ -1038,11 +1038,9 @@ def reset_task_states(self, items, status, outputs):
if status and status != itask.state.status:
LOG.info("resetting state to %s" % status, itask=itask)
itask.state.reset_state(status)
if status in [TASK_STATUS_FAILED,
TASK_STATUS_SUBMIT_FAILED]:
# TODO - HUH? SUBMIT_FAILED? WHAT ABOUT SUCCEEDED?
itask.set_event_time('finished',
get_current_time_string())
if status in [TASK_STATUS_FAILED, TASK_STATUS_SUCCEEDED]:
itask.set_summary_time('finished',
get_current_time_string())
if outputs:
for output in outputs:
is_completed = True
Expand Down
4 changes: 2 additions & 2 deletions lib/cylc/task_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ def reset_manual_trigger(self):
for timer in self.try_timers.values():
timer.timeout = None

def set_event_time(self, event_key, time_str=None):
"""Set event time in self.summary
def set_summary_time(self, event_key, time_str=None):
"""Set an event time in self.summary
Set values of both event_key + "_time" and event_key + "_time_string".
"""
Expand Down

0 comments on commit af49813

Please sign in to comment.