How is the average tasks number counted?

Article ID:360042905031
2 minute readKnowledge base

Issue

  • We are not sure how the average tasks number is being counted.

Environment

Resolution

About Runs

Runs and tasks are not synonymous. Except for freestyle jobs (where one run of the job will mean that one task ran) a single run can have multiple tasks.

As an example, let us take the following Jenkinsfile:

pipeline { agent { label 'baz' } // ... stages { stage { // ... } stage { agent { label 'foo' } // ... } stage { agent { label 'bar' } // ... } stage { agent { label 'foo' } } stage { // ... } } }

In the above example, you will have two tasks for the label foo and one task for the label baz. In addition, you will have between 1 and 3 tasks for the label baz depending on exactly how pipeline decides to execute things. So in total you will have between 4 and 6 tasks for a single run.

Execution Time

The task execution time reported is the amount of time the node was required by each task execution. In our previous example, if the bar step is 2 hours, you may only see 2 seconds against the foo step if the two stages are quick on that node.

Overall tasks and label tasks

(overall) counts the number of main tasks while all the other ones count the number of tasks tied to that label.

Thus (overall) should approximate the number of runs. Why approximate? Because there are certain kinds of things in Jenkins that can create a task without a run, these things would also be counted in (overall) but would likely not be counted by other systems that are naïvely counting just runs.

This means that you cannot add all the other labels and expect the total to match that of (overall) as they are reporting different things. (overall) is the overall workload on your controllers while the others are the node specific workload against each node.

They are both on the same table because they are comparable, e.g. if you have a lot more tasks on one label and a lot of queuing but the overall runs are low then you know that you have jobs creating many subtasks.