Skip to content

Smartly calculate real running time and pending time

Lin Jen-Shin requested to merge smart-pipeline-duration into master

What does this MR do?

Try to smartly calculate the running time and pending time for pipelines, instead of just use wall clock time from start to end. The algorithm is based on:

Suppose we have A, B, and C jobs:

  • A: from 1 to 3
  • B: from 2 to 4
  • C: from 6 to 7

The processing time should be accumulated from 1 to 4, and 6 to 7, totally 4, excluding retires, and calculate on %w[success failed running canceled] jobs (if a job is not finished yet, assume it's Time.now)

Are there points in the code the reviewer needs to double check?

I would actually like to test Gitlab::Ci::PipelineDuration#process_segments, but it's a private method right now and it's not very convenient to test it. Is there a way to test it without changing the original code too much? Note that I would like to avoid saving merged segments because it's not used and should be garbage collected.

Screenshots:

Screen_Shot_2016-09-05_at_6.45.32_PM

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes #18260 (closed), #19804 (closed)

Merge request reports