Limit number of queued jobs

32 views
Skip to first unread message

Paul Weiss

unread,
Nov 3, 2011, 2:51:06 PM11/3/11
to jenkins...@googlegroups.com
When a job is parameterized Jenkins will queue any number of instances of that job, provided each job has a unique set of parameters.

What I would like is a limit on the number of jobs queued and a preference for what happens when a new job is queued when that limit is hit:  either don't queue or delete the oldest queued job, then queue the new one.

Has anyone worked on such a thing?  Would this be a change to core functionality or could this be done in a plugin?

-P

Jesse Farinacci

unread,
Nov 3, 2011, 3:03:07 PM11/3/11
to jenkins...@googlegroups.com
Greetings,

http://javadoc.jenkins-ci.org/hudson/model/Queue.QueueDecisionHandler.html

-Jesse

--
There are 10 types of people in this world, those
that can read binary and those that can not.

Paul Weiss

unread,
Nov 3, 2011, 3:40:55 PM11/3/11
to jenkins...@googlegroups.com
Hmm, so I could write a plugin that would prevent new jobs from being added, but I don't think I could implement queueing it and dropping the oldest one.  That is, I could indeed do so, by scanning the queueing, dequeueing the oldest one and then having my shouldSchedule method return true, but if another registered decision handler then returned false, I would have deleted a job for nought.

-P 

Jesse Farinacci

unread,
Nov 3, 2011, 3:59:49 PM11/3/11
to jenkins...@googlegroups.com
Greetings,

On Thu, Nov 3, 2011 at 3:40 PM, Paul Weiss <pa...@weiss.name> wrote:
> Hmm, so I could write a plugin that would prevent new jobs from being added,
> but I don't think I could implement queueing it and dropping the oldest one.
>  That is, I could indeed do so, by scanning the queueing, dequeueing the
> oldest one and then having my shouldSchedule method return true, but if
> another registered decision handler then returned false, I would have
> deleted a job for nought.

I didn't say it would be easy, I just showed you the path. And, I
don't think there are m/any Queue.QueueDecisionHandlers out there.

Reply all
Reply to author
Forward
0 new messages