jenkinsci / jenkinsci/priority-sorter-plugin

[JENKINS-8405] Optionally pause/cancel lower priority jobs in favor of higher priority jobs in the queue

Open
#528 6 comments 0 reactions 0 assignees View on GitHub
component:prioritysorter-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
59
Forks
76
Avg merge
2h 4m
Merged PRs (30d)
2

Description

Currently the priority sorter plugin does a great job of sorting jobs in the queue. However, if a low priority job is started, and then later a higher priority job enters the queue, the higher priority job still has to wait for the lower priority one.

Is there a chance the plugin could be extended to do something in that situation?

One option would be to cancel the low prio job (I guess that is technically possible, since it is possible manually). There could be an option to let the low prio job if its estimated remaining time is less than N minutes. This would still guarantee high prio jobs do not wait long.

Another option would be to pause the low prio job instead of cancelling it. I don't know if that's harder technically (I'm thinking about kill -CONT on unix, don't know about other platforms). Another thing to consider is that the job would then stay in memory; however it could still be swapped out, and that might be cheaper than to restart the job later.

Any comments or ideas welcome.

---
Originally reported by dbr, imported from: Optionally pause/cancel lower priority jobs in favor of higher priority jobs in the queue


  • assignee: bklarson
  • status: Open
  • priority: Minor
  • component(s): prioritysorter-plugin
  • resolution: Unresolved
  • votes: 6
  • watchers: 8
  • imported: 20251211-071809

Raw content of original issue

Currently the priority sorter plugin does a great job of sorting jobs in the queue. However, if a low priority job is started, and then later a higher priority job enters the queue, the higher priority job still has to wait for the lower priority one.

Is there a chance the plugin could be extended to do something in that situation?

One option would be to cancel the low prio job (I guess that is technically possible, since it is possible manually). There could be an option to let the low prio job if its estimated remaining time is less than N minutes. This would still guarantee high prio jobs do not wait long.

Another option would be to pause the low prio job instead of cancelling it. I don't know if that's harder technically (I'm thinking about kill -CONT on unix, don't know about other platforms). Another thing to consider is that the job would then stay in memory; however it could still be swapped out, and that might be cheaper than to restart the job later.

Any comments or ideas welcome.

Contributor guide

Open the contributing guide

Research direction

No source files, tests, or entry points are named. Start by reviewing the priority-sorter-plugin's queue and running-job handling, then clarify whether the intended behavior is cancellation, pausing, or both. Done requires an agreed policy for higher-priority jobs and any remaining-time threshold, with behavior covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devops
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.