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

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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) {
          if(bi.getAssignedLabel()==l)
                b++;
          if(bi.task.getAssignedLabel()==l)
                t++;
        }
        
        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?

        Attachments

          Activity

          laurence_ Laurence Hey created issue -
          laurence_ Laurence Hey made changes -
          Field Original Value New Value
          Assignee domi [ domi ] Laurence Hey [ laurence_ ]
          domi Dominik Bartholdi made changes -
          Assignee Laurence Hey [ laurence_ ] Jesse Glick [ jglick ]
          jglick Jesse Glick made changes -
          Assignee Jesse Glick [ jglick ]
          danielbeck Daniel Beck made changes -
          Labels lts-candidate
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 146332 ] JNJira + In-Review [ 176587 ]
          imod Dominik Bartholdi made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]
          olivergondza Oliver Gond┼ża made changes -
          Labels lts-candidate
          markewaite Mark Waite made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            laurence_ Laurence Hey
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: