Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-15576

LoadStatistics queue length and Cloud provisioning not working in conjunction with Node and Label parameter plugin


      The LoadStatistics.LoadStatisticsUpdater class updates the queueLength of each Label's LoadStatistics. It currently does the update by iterating over each of the BuildableItems in the queue and comparing their Task's assigned Label to the Label being updated and counting those that do (LoadStatistics.LoadStatisticsUpdater#count method).

      The "Node and Label parameter plugin" allows the Label assigned to a job to be selected when starting the build or to be passed in by the "Jenkins Parameterized Trigger plugin". When this is used the Label on the Task is null, and the selected label is reflected on the BuildableItem in the queue itself.

      This means that a Label selected using the Label parameter plugin always has LoadStatistics with a queue length of 0, and Cloud implementations are not requested to provision more nodes.

      I have done some testing with the Label parameter plugin disabled (using the Groovy script below) and it appears that the Tasks and BuildableItems matching the label appear to be equal across the labels.

      Jenkins j = Jenkins.getInstance();
      List<hudson.model.Queue.BuildableItem> bis = j.getQueue().getBuildableItems();
      println("Q length = " + bis.size());
      for(Label l : j.getLabels())
        println(l.getExpression() + ":");
        int b=0,t=0;
        for (hudson.model.Queue.BuildableItem bi : bis) {
        println("\tTasks matching label = " + t);
        println("\tBuilableItems matching label = " + b);

      Is it correct that the LoadStatistics.LoadStatisticsUpdater#count method could be changed to call BuildableItem#getAssignedLabel rather than Task#getAssignedLabel?

            Unassigned Unassigned
            laurence_ Laurence Hey
            1 Vote for this issue
            7 Start watching this issue