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

          Hide
          domi Dominik Bartholdi added a comment -

          Jesse, I'm quite sure you have a better understanding of the LoadStatistics - do you think the proposed solution would help?

          Show
          domi Dominik Bartholdi added a comment - Jesse, I'm quite sure you have a better understanding of the LoadStatistics - do you think the proposed solution would help?
          Hide
          jglick Jesse Glick added a comment -

          @domi I am not familiar with this code, sorry.

          Show
          jglick Jesse Glick added a comment - @domi I am not familiar with this code, sorry.
          Hide
          pupssman Ivan Kalinin added a comment -

          That's quite a major issue indeed. Does anyone have a workaround?

          Show
          pupssman Ivan Kalinin added a comment - That's quite a major issue indeed. Does anyone have a workaround?
          Hide
          danielbeck Daniel Beck added a comment -
          Show
          danielbeck Daniel Beck added a comment - Proposed pull request: https://github.com/jenkinsci/jenkins/pull/620
          Hide
          dogfood dogfood added a comment -

          Integrated in jenkins_main_trunk #3686
          [FIXED JENKINS-15576] Label's Load Statistics queue length based on (Revision b47f527ce9427218aecde544e0d5a196925cb892)
          Test cases for [FIXED JENKINS-15576] (Revision c49420e622facb8cc98e5f4447c0fc8ad6660990)

          Result = SUCCESS
          laurence.hey : b47f527ce9427218aecde544e0d5a196925cb892
          Files :

          • core/src/main/java/hudson/model/LoadStatistics.java
          • changelog.html

          laurence.hey : c49420e622facb8cc98e5f4447c0fc8ad6660990
          Files :

          • core/src/main/java/hudson/model/LoadStatistics.java
          • test/src/test/java/hudson/model/LabelLoadStatisticsQueueLengthTest.java
          • changelog.html
          • test/pom.xml
          Show
          dogfood dogfood added a comment - Integrated in jenkins_main_trunk #3686 [FIXED JENKINS-15576] Label's Load Statistics queue length based on (Revision b47f527ce9427218aecde544e0d5a196925cb892) Test cases for [FIXED JENKINS-15576] (Revision c49420e622facb8cc98e5f4447c0fc8ad6660990) Result = SUCCESS laurence.hey : b47f527ce9427218aecde544e0d5a196925cb892 Files : core/src/main/java/hudson/model/LoadStatistics.java changelog.html laurence.hey : c49420e622facb8cc98e5f4447c0fc8ad6660990 Files : core/src/main/java/hudson/model/LoadStatistics.java test/src/test/java/hudson/model/LabelLoadStatisticsQueueLengthTest.java changelog.html test/pom.xml
          Hide
          imod Dominik Bartholdi added a comment -

          fixed since a long time...

          Show
          imod Dominik Bartholdi added a comment - fixed since a long time...

            People

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

              Dates

              Created:
              Updated:
              Resolved: