Priority Sorter Plugin

Skip to end of metadata
Go to start of metadata

This plugin allows Jobs to be prioritised based Queue Strategies and Priority Strategies.

Plugin Information

Plugin ID PrioritySorter Changes In Latest Release
Since Latest Release
Latest Release
Latest Release Date
Required Core
3.4 (archives)
Jun 06, 2015
job-restrictions (version:0.4, optional)
cloudbees-folder (version:4.2, optional)
matrix-project (version:1.4, optional)
Source Code
Issue Tracking
Pull Requests
Open Issues
Pull Requests
Magnus Sandberg (id: emsa23)
Usage Installations 2014-Nov 2415
2014-Dec 2412
2015-Jan 2538
2015-Feb 2610
2015-Mar 2782
2015-Apr 2776
2015-May 2787
2015-Jun 2876
2015-Jul 2914
2015-Aug 2910
2015-Sep 3019
2015-Oct 2997


This plugin adds the ability to assign different priorities to Jobs, the lower priority the job has the sooner the Job will run.

This can be very helpful when one wants to add low priority jobs but wants to have higher-priority jobs run first when hardware is limited or when there are different groups of Jobs that should share resources (equally).


The plugin is build around some basic concepts, Queue Strategy, Job Group, Job Inclusion Strategy and Priority Strategy.

First the Queue Strategy, this describes how the priority of a Job is interpreted, it will translate the assigned priority on a Job to a corresponding weight in the queue, the queue is then sorted based on the assigned weight.

With Priority Sorter you will need to group your Jobs into Job Groups, if a Job should be included in a specific Job Group is decided by the Job Inclusion Strategy assigned to the Job Group.

The priority of the Job is then set by the Priority Strategy, each Job Group can have any number Priority Strategies.

So when a new Job is Queued the following will happen, Priority Sorter will go though the configured Job Groups from top to bottom. When Priority Sorter find a Job Group where the Job is to be included it will look though the Priority Strategies from top to bottom, when it finds a Priority Strategy that matches it will use this strategy to assign a priority the the Job. Priority Sorter will now consult the Queue Strategy to translate the priority to a weight, ie a position in the queue.

Queue Strategies

There are four included Queue Strategies, the different Queue Strategies will sort the Queue differently.


Each Job will be assigned a Priority, the lower the Priority the sooner the Job will be run.

Fair Queuing

Each Job will be assigned a Priority, the Queue will try to share the resources equally over the different priorities in a round-robin fashion.

Weighted Fair Queuing

The same as Fair Queuing but Jobs with lower Priority will be run more frequently than Jobs with higher Priority.

Job Inclusion Strategies

This setting describes what Jobs should be included in a Job Group, these are relative self exploratory. Worth to mention is the "Jobs marked for inclusion", when this is selected you are requested to enter a name of the Job Group. This name will then be selectable on each Job, this is an alternative "bottom-up" way to group Jobs rather than the "top-down" approach of the other strategies.

Priority Strategies

It is possible to assign the Priority based on different Priority Strategies

This setting describes what priority a Jobs should have, these are relative self exploratory. Worth to mention is the "Take the priority from Property on the Job", when this is selected a drop-down where you can select a priority appears on all Projects that would generate Jobs that would be included in this group.

Main Configuration

The main configuration of the plugin is done on the main Configurations Page and the Priority Strategy configurations done on its own page accessible from the root actions menu.

On the main configuration you select the number of priorities you would like to use as well as the default priority to use where no other priority could be assigned.

 Please note that lower number means higher priority, also see details on screen for the specifics on each Strategy. 

Assigning Priorities

On the main menu you will fin the link to the page where you can assign priorities to each Job

On this page you will be able to assign Jobs to Groups and priorities to Jobs.

 Please note that all matching is done top to bottom by first match

You can limit access to this functionality to Administrators only be checking the appropriate check-box on the main configuration page.

Run Exclusive

If a Job from a Run Exclusive Job Group gets started Jobs from other Job Groups will stay blocked and will not get started until all Jobs from the Run Exclusive Job Group in the Queue is finished, regardless of priority. 

Using the View Column

Since a Job can get a different Priority each time it is started the View Column cannot show the "correct" priority for the Job.

The column will show the priority used the last time the Job was launched, if the Job has not been started at all yet the column will show Pending.

Notable changes and upgrading

Upgrading from 1.x

2.x is a complete rewrite of the plugin, 2.x still supports running in 1.x compatibility mode. However if you are satisfied with the functionality of 1.x there is little point in upgrading.
Upgrading from 1.x to 3.x will remove all 1.x configurations, if you need to keep  configured values upgrade first to 2.x, switch to Advanced Mode and then upgrade from 2.x to 3.x

Upgrading from 2.x

In 3.x the option "Allow priorities directly on Jobs" has been removed in favor of the Priority Strategy "Take the priority from Property on the Job" (see above). Legacy Mode is removed (see above upgrading from 1.x)


To get some inside information on how and why a certain Job gets a certain Priority you can turn on some extra logging.

Logger to log is PrioritySorter.Queue.Items

To get more info on the assigned priorities and state transition of the items in the queue log on level FINE.

To get even more info on how the Jobs are matched to Job Groups and Rules to get the priority log on level FINER.

To get logging on when the Queue Sorter is active log PrioritySorter.Queue.Sorter on level FINE.

To see all items sorted (the queue) by the Queue Sorter PrioritySorter.Queue.Sorter on level FINER.


Version 3.4 (2015-06-06)

Fixes : JENKINS-28621 Jenkins jobs get held up in queue waiting for available executors, even though all are available

Version 3.3 (2015-05-26)

Fixes : JENKINS-28462 Priority selection on Job is "always" shown
Fixes : JENKINS-28461 Control Node usage based on Priority
Relates : JENKINS-23640 Validate regular expression and report matching jobs on Job Priorities page

Version 3.2 (2015-05-18)

Fixes : JENKINS-24962 Cannot assign a JobGroup to a Nested (sub) View
Fixes : JENKINS-28280 Wrong Job Group is shown in the selector (one more place) (Thanks to Kyrremann)

Version 3.1 (2015-05-12)

Fixes : JENKINS-28195 Jenkins not scheduling any jobs after upgrade to Priority Sorter 3.0 but giving exception
Fixes : JENKINS-28280 Wrong Job Group is shown in the selector (Thanks to Kyrremann)
Fixes : JENKINS-28359 Remove support and conversion from Legacy Mode

Version 3.0 (2015-05-02)

Fixes : JENKINS-21337 Add support for cloudbees-folders
Fixes : JENKINS-21356 Add support for using JobProperty to join a Job to a JobGroup
Fixes : JENKINS-23538 Remove support for Legacy Sorter
Fixes : JENKINS-23552 Replace "Allow priorities directly on Jobs"
Fixes : JENKINS-23557 Add matrix child jobs to the front of the queue
Fixes : JENKINS-27966 Priority Sorter must not require matrix-project

Version 2.12 (2015-04-15)

Fixes : JENKINS-27957 NullPointerException in AdvancedQueueSorter

Version 2.11 (2015-04-14)

Fixes : JENKINS-27770 AdvancedQueueSorter call to sort violates the comparison contract

Version 2.10 (2015-04-14)

Never released - maven hickup

Version 2.9 (2014-10-08)

  • Fixed NPE happening at startup [X] (Thanks to christ66)
  • Added description field to JobGroups [X] (Thanks to olivergondza)

Version 2.8 (2014-06-17)

Fixes : JENKINS-23462 Sectioned views are not evaluated for job priority

Version 2.7 (2014-06-16)

  • Adds some more logging about queue contents, see Troubleshooting above
  • Performance enhancement when updating the configuration [X] (Thanks to ndeloof)

Fixes : JENKINS-23428 Jobs in NestedView (ViewGroup) are not correctly found

Version 2.6 (2014-01-11)

Fixes : JENKINS-21310 CCE when a Queue.Task was not a Job
Fixes : JENKINS-21316 PrioritySorter wrongly assumes Queue.Task is Job
Relates: JENKINS-21314 Stack trace displayed on web page when attempting to configure PrioritySorter plugin

Version 2.5 (2014-01-08)

Fixes: JENKINS-21289 Item Logging causing NPE
Fixes: JENKINS-21284 Add some logging to show what the sorter is doing
Fixes: JENKINS-21204 Add ability to boost recently failed Jobs

Version 2.4 (2014-01-02)

Fixes: JENKINS-21173 Anonymous Users Can Configure Priorities
Fixes: JENKINS-21119 Extend loggning to show assigned priority
Fixes: JENKINS-21103 "Priorities are assigned top down by first match" does not work correctly (Thanks to Adam Gabryś for debugging help)

Version 2.3 (2013-12-20)

  • introduces the Run Exclusive Mode to deal with JENKINS-11997
  • adds a new Priority Strategy to give Jobs the same priority as a UpstreamJob
  • some performance enhancements
  • hopefully fixes the deadlock issue in JENKINS-21034
  • fixes the priority assignment issue on main configuration page

Fixes: JENKINS-11997 Consider jobs in the Executors for priority sorter
Fixes: JENKINS-21034 Jenkins Startup Deadlock - QueueSorter.installDefaultQueueSorter and Queue.init
Fixes: JENKINS-20995 Default Priority always shows 1-5

Version 2.2 (2013-12-05)

Fixing bug that made the plugin switch to Advanced mode even though Legacy (1.3) data was present in the system. (Thanks to help from Matthew Webber)

Fixes: [JENKINS-8597] Deal with matrix builds better

Version 2.1 (2013-12-04)

Fixes bug that mapped all Jobs to all Views/JobGroups.

Version 2.0 (2013-12-02)

Introducing advanced queueing features with possibility to selected different strategies for how priorities are assigned and how the queue is sorted.

Thanks Oleg for testing, reviewing and helping out.

Version 1.3

Removed view column from default view (Thanks to work from larrys)

Version 1.2

Added View column to easily compare priorities between jobs (Thanks to work from cjo9900)

Version 1.1

Fixed a potential NPE when using the plugin on existing jobs without setting a default priority.

Version 1.0

Initial Release


plugin-misc plugin-misc Delete
plugin-listview-column plugin-listview-column Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Add Comment