Extend created(updated)_at by started(finished)_at to clarify the duration of the task

Registered by Oleg Ovcharuk on 2018-09-26

For now, the only way to investigate the duration of the task is fields created_at and updated_at. In this case, the duration of the task is the difference btween these two fields, which sound pretty logical, e.g. CloudFlow calculates duration uses the same way.
However, it is important to understand that the execution time of the task consists of several states: Created, Idle, Waiting, Running, Complete. To find problems with performance, it is very important to know exactly the time that the task is in Running state. This time is often coincides with the difference between created_at and updated_at, but it is important to understand that this does not always happen.

Consider an example of workflow:
wf1:
  tasks:
    wait_1:
      action: std.sleep seconds = 1
      on-success: finish_wf
    wait_5:
      action: std.sleep seconds = 5
      on-success: finish_wf
    wait_10:
      action: std.sleep seconds = 10
      on-success: finish_wf
    finish_wf:
      join: all
      action: std.sleep seconds = 5

If we look at the duration of the finish_wf task, we'll see 15 seconds instead of expected 5 seconds. The same leak we could see in case of rerun and so on. This can be a huge problem in finding problems with the performance of some task in workflow.

This issue requires a solution.
It is suggested to extend created_at and updated_at by new fields started_at and finished_at, which will reflect the time the task held in Running state.
Moreover, if the task has wait_before and/or wait_after, then they must be included at started_at and finished_at, since they relate to the actual time of task working.

Blueprint information

Status:
Complete
Approver:
Dougal Matthews
Priority:
Medium
Drafter:
Oleg Ovcharuk
Direction:
Approved
Assignee:
Oleg Ovcharuk
Definition:
New
Series goal:
Accepted for stein
Implementation:
Implemented
Milestone target:
None
Started by
Oleg Ovcharuk on 2018-10-02
Completed by
Renat Akhmerov on 2019-06-13

Related branches

Sprints

Whiteboard

Gerrit topic: https://review.openstack.org/#q,topic:bp/mistral-add-started-finished-at,n,z

Addressed by: https://review.openstack.org/607703
    Add started_at and finished_at to task execution.

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.