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 task event handler start time #3325

Merged
merged 1 commit into from
Aug 29, 2019

Conversation

matthewrmshin
Copy link
Contributor

@matthewrmshin matthewrmshin commented Aug 28, 2019

The start_time is now available as a template key for task event handler.

Also rearranged a few statements (for recording the job status) in cylc.flow.task_events_mgr for consistency.

These changes close #2757, (see #2757 (comment)).

Requirements check-list

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Appropriate tests are included (unit and/or functional).
  • Appropriate change log entry included.

@@ -792,7 +792,6 @@ def _process_message_submit_failed(self, itask, event_time):
self.setup_event_handlers(
itask, self.EVENT_SUBMIT_RETRY,
"job %s, %s" % (self.EVENT_SUBMIT_FAILED, delay_msg))
self.job_pool.set_job_state(job_d, TASK_STATUS_SUBMIT_RETRYING)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The submit retrying status is a task status, not a job status.

self.suite_db_mgr.put_update_task_jobs(itask, {
"time_run": itask.summary['started_time_string']})
if itask.state.reset(TASK_STATUS_RUNNING):
self.setup_event_handlers(itask, 'started', 'job started')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The start time is now set before we set up the started event handler.

@@ -680,6 +680,7 @@ def _process_message_failed(self, itask, event_time, message):
itask.set_summary_time('finished', event_time)
job_d = get_task_job_id(itask.point, itask.tdef.name, itask.submit_num)
self.job_pool.set_job_time(job_d, 'finished', event_time)
self.job_pool.set_job_state(job_d, TASK_STATUS_FAILED)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Job status is failed, regardless of task retrying.

Copy link
Member

@hjoliver hjoliver left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@dwsutherland dwsutherland left a comment

Choose a reason for hiding this comment

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

Looks good; in the job_pool.py could you remove TASK_STATUS_SUBMIT_RETRYING from the import and job states list:

JOB_STATUSES_ALL = [
    TASK_STATUS_READY,
    TASK_STATUS_SUBMITTED,
    TASK_STATUS_SUBMIT_FAILED,
    TASK_STATUS_SUBMIT_RETRYING,
    TASK_STATUS_RUNNING,
    TASK_STATUS_SUCCEEDED,
    TASK_STATUS_FAILED,
]

If you think ready state doesn't make sense (as I thought of it as "job file ready"), perhaps we could address that also? (although maybe the new submitting state would be appropriate in the related PR)

The `start_time` is now available as a template key for task event handler.
Also rearranged a few statements (for recording the job status) in
`cylc.flow.task_events_mgr` for consistency.
@matthewrmshin
Copy link
Contributor Author

@dwsutherland Done what you requested.

Copy link
Member

@dwsutherland dwsutherland left a comment

Choose a reason for hiding this comment

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

LGTM

@dwsutherland dwsutherland merged commit 7503376 into cylc:master Aug 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Task event handler string template documentation
3 participants