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

"Priorities are assigned top down by first match" does not work correctly

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • prioritysorter-plugin
    • None
    • Jenkins Priority Sorter Plugin 2.2

      jenkins-1.544-1.1.noarch
      java-1.7.0-openjdk-1.7.0.45-2.4.3.4.el6_5.x86_64
      Linux kera 2.6.32-431.1.2.0.1.el6.x86_64 #1 SMP Fri Dec 13 13:06:13 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

      Probably plugin incorrectly assigns priorities to jobs. I have a job in two views: Sonar and All (plugin configuration is in the screenshot). According to the description "priorities are assigned top down by first match" - the job should receive priority 4 (or 3 if user run build) but unfortunately always receives 3 (or 2 if user run build).

          [JENKINS-21103] "Priorities are assigned top down by first match" does not work correctly

          If you log with "Finer" (not fine) you should also get some info on what matches are tried.

          Magnus Sandberg added a comment - If you log with "Finer" (not fine) you should also get some info on what matches are tried.

          Adam Gabryś added a comment - - edited

          I log with "ALL" (logger-configuration.png). New logs:

          Jan 02, 2014 11:36:06 AM FINE PrioritySorter.Queue.Items
          New Item: Id: 4 JobName: ing_trunk, jobGroupId: -1, priority: 3, weight: 3.0, status: WAITING
          Jan 02, 2014 11:36:15 AM FINE PrioritySorter.Queue.Items
          Buildable: Id: 4 JobName: ing_trunk, jobGroupId: -1, priority: 3, weight: 3.0, status: BUILDABLE
          Jan 02, 2014 11:36:15 AM FINE PrioritySorter.Queue.Items
          Starting: Id: 4 JobName: ing_trunk, jobGroupId: -1, priority: 3, weight: 3.0, status: BUILDABLE

          Adam Gabryś added a comment - - edited I log with "ALL" (logger-configuration.png). New logs: Jan 02, 2014 11:36:06 AM FINE PrioritySorter.Queue.Items New Item: Id: 4 JobName: ing_trunk, jobGroupId: -1, priority: 3, weight: 3.0, status: WAITING Jan 02, 2014 11:36:15 AM FINE PrioritySorter.Queue.Items Buildable: Id: 4 JobName: ing_trunk, jobGroupId: -1, priority: 3, weight: 3.0, status: BUILDABLE Jan 02, 2014 11:36:15 AM FINE PrioritySorter.Queue.Items Starting: Id: 4 JobName: ing_trunk, jobGroupId: -1, priority: 3, weight: 3.0, status: BUILDABLE

          Ok - the SNAPSHOT you have is missing some logging maybe.

          I have made a few changes so if you can try the latest SNAPSHOT it'll be appreciated.

          With this make sure you get the "New Item:" line with "FINER" not "FINE" it'll give you more info.

          Magnus Sandberg added a comment - Ok - the SNAPSHOT you have is missing some logging maybe. I have made a few changes so if you can try the latest SNAPSHOT it'll be appreciated. With this make sure you get the "New Item:" line with "FINER" not "FINE" it'll give you more info.

          Adam Gabryś added a comment - - edited

          From where I can download the new snapshot?

          edit:
          Link to new snapshot: https://www.dropbox.com/sh/h4nelewu37sx7m5/5SsEY0vfWV

          Adam Gabryś added a comment - - edited From where I can download the new snapshot? edit: Link to new snapshot: https://www.dropbox.com/sh/h4nelewu37sx7m5/5SsEY0vfWV

          Yes I have updated the file there.

          Magnus Sandberg added a comment - Yes I have updated the file there.

          Adam Gabryś added a comment - - edited

          I installed new snapshot (2.4-SNAPSHOT (private-01/02/2014 11:43-emsa)).
          Plugin starts assigning correct priorities

          Jan 02, 2014 12:00:49 PM FINE PrioritySorter.Queue.Items
          New Item: Id: 1 JobName: ing_trunk, jobGroupId: 1, priority: 3, weight: 3.0, status: WAITING
          Jan 02, 2014 12:00:57 PM FINE PrioritySorter.Queue.Items
          Buildable: Id: 1 JobName: ing_trunk, jobGroupId: 1, priority: 3, weight: 3.0, status: BUILDABLE
          Jan 02, 2014 12:00:57 PM FINE PrioritySorter.Queue.Items
          Starting: Id: 1 JobName: ing_trunk, jobGroupId: 1, priority: 3, weight: 3.0, status: BUILDABLE
          Jan 02, 2014 12:03:49 PM FINE PrioritySorter.Queue.Items
          New Item: Id: 2 JobName: ing_trunk_sonar, jobGroupId: 0, priority: 4, weight: 4.0, status: WAITING
          Jan 02, 2014 12:03:57 PM FINE PrioritySorter.Queue.Items
          Buildable: Id: 2 JobName: ing_trunk_sonar, jobGroupId: 0, priority: 4, weight: 4.0, status: BUILDABLE
          Jan 02, 2014 12:03:57 PM FINE PrioritySorter.Queue.Items
          Starting: Id: 2 JobName: ing_trunk_sonar, jobGroupId: 0, priority: 4, weight: 4.0, status: BUILDABLE

          I still get only logs with FINE.

          Adam Gabryś added a comment - - edited I installed new snapshot (2.4-SNAPSHOT (private-01/02/2014 11:43-emsa)). Plugin starts assigning correct priorities Jan 02, 2014 12:00:49 PM FINE PrioritySorter.Queue.Items New Item: Id: 1 JobName: ing_trunk, jobGroupId: 1, priority: 3, weight: 3.0, status: WAITING Jan 02, 2014 12:00:57 PM FINE PrioritySorter.Queue.Items Buildable: Id: 1 JobName: ing_trunk, jobGroupId: 1, priority: 3, weight: 3.0, status: BUILDABLE Jan 02, 2014 12:00:57 PM FINE PrioritySorter.Queue.Items Starting: Id: 1 JobName: ing_trunk, jobGroupId: 1, priority: 3, weight: 3.0, status: BUILDABLE Jan 02, 2014 12:03:49 PM FINE PrioritySorter.Queue.Items New Item: Id: 2 JobName: ing_trunk_sonar, jobGroupId: 0, priority: 4, weight: 4.0, status: WAITING Jan 02, 2014 12:03:57 PM FINE PrioritySorter.Queue.Items Buildable: Id: 2 JobName: ing_trunk_sonar, jobGroupId: 0, priority: 4, weight: 4.0, status: BUILDABLE Jan 02, 2014 12:03:57 PM FINE PrioritySorter.Queue.Items Starting: Id: 2 JobName: ing_trunk_sonar, jobGroupId: 0, priority: 4, weight: 4.0, status: BUILDABLE I still get only logs with FINE.

          Magnus Sandberg added a comment - - edited

          I think that you need to say FINER (or FINEST) and not ALL since I'm doing a check on this to see what to log (now fixed and should log correctly with ALL).

          I also did a permission thing since I sort of expected this to be a security thing and it looks like I'm right.

          Thanks for the help - expect a 2.4 release in the near future.

          Magnus Sandberg added a comment - - edited I think that you need to say FINER (or FINEST) and not ALL since I'm doing a check on this to see what to log (now fixed and should log correctly with ALL). I also did a permission thing since I sort of expected this to be a security thing and it looks like I'm right. Thanks for the help - expect a 2.4 release in the near future.

          Code changed in jenkins
          User: emsa23
          Path:
          src/test/java/jenkins/advancedqueue/test/MultipleMatchJobGroupTest.java
          src/test/resources/jenkins/advancedqueue/test/MultipleMatchJobGroupTest/config.xml
          src/test/resources/jenkins/advancedqueue/test/MultipleMatchJobGroupTest/jenkins.advancedqueue.PriorityConfiguration.xml
          src/test/resources/jenkins/advancedqueue/test/MultipleMatchJobGroupTest/jenkins.advancedqueue.PrioritySorterConfiguration.xml
          http://jenkins-ci.org/commit/priority-sorter-plugin/b4743a6b21d00e1d23b858c3edad13c2155b8da2
          Log:
          [TEST] JENKINS-21103 Added test case

          Added testcase for JENKINS-21103:
          "Priorities are assigned top down by first match"
          does not work correctly

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: emsa23 Path: src/test/java/jenkins/advancedqueue/test/MultipleMatchJobGroupTest.java src/test/resources/jenkins/advancedqueue/test/MultipleMatchJobGroupTest/config.xml src/test/resources/jenkins/advancedqueue/test/MultipleMatchJobGroupTest/jenkins.advancedqueue.PriorityConfiguration.xml src/test/resources/jenkins/advancedqueue/test/MultipleMatchJobGroupTest/jenkins.advancedqueue.PrioritySorterConfiguration.xml http://jenkins-ci.org/commit/priority-sorter-plugin/b4743a6b21d00e1d23b858c3edad13c2155b8da2 Log: [TEST] JENKINS-21103 Added test case Added testcase for JENKINS-21103 : "Priorities are assigned top down by first match" does not work correctly

          Code changed in jenkins
          User: emsa23
          Path:
          src/main/java/jenkins/advancedqueue/PriorityConfiguration.java
          http://jenkins-ci.org/commit/priority-sorter-plugin/f91ad339fa9896aa374e2f65300b0af107dcea28
          Log:
          JENKINS-21103 "Priorities (...) first match" does not work correctly

          Since the listener is not called as SYSTEM but rather as a user
          I added impersonating for all getPriority() lookups to make
          sure that the code can read all Views and all Jobs.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: emsa23 Path: src/main/java/jenkins/advancedqueue/PriorityConfiguration.java http://jenkins-ci.org/commit/priority-sorter-plugin/f91ad339fa9896aa374e2f65300b0af107dcea28 Log: JENKINS-21103 "Priorities (...) first match" does not work correctly Since the listener is not called as SYSTEM but rather as a user I added impersonating for all getPriority() lookups to make sure that the code can read all Views and all Jobs.

          Fixed in 2.4

          Magnus Sandberg added a comment - Fixed in 2.4

            emsa23 Magnus Sandberg
            agabrys Adam Gabryś
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: