Kiddo
Kiddo

Reputation: 1980

Jenkins - How to reserve an executor for (a) specific job(s)

We have a Jenkins server with 8 executors and 20 jobs. 15 of those jobs take approximately 2 hours to finish while the remaining 5 take only 15 minutes. I would like to reserve 1 executor (or 2) to run those 5 small jobs only and restrict other jobs to run on the other executors. Note: I don't have any slaves, just 8 executors on master Jenkins process.

I'm new to Jenkins so I just wonder is it any way that I can do that? Thank you.

Upvotes: 10

Views: 16760

Answers (5)

yavuz yasin CELIK
yavuz yasin CELIK

Reputation: 1

I had same issue. I installed multiple agent on same slave and it works fine. Nodes remote directory should be different.

agent as a windows services

Upvotes: 0

dcendents
dcendents

Reputation: 743

I'm a bit late but I think it would be much easier to restrict how many concurrent "slow" jobs can run than trying to reserve executors. This is simple to do with the Lockable Resources plugin: https://wiki.jenkins.io/display/JENKINS/Lockable+Resources+Plugin

Simply add as many resources as the number of slow jobs you want to allow (6 or 7) and give them all the same label. Modify the job configurations to lock a resource (by label with quantity 1) before it can execute. If all the resources are already locked, then the job will wait until one is freed.

Upvotes: 2

Jon S
Jon S

Reputation: 16346

As i understand it Kiddo uses the master for 8 executors. What you can do is to add a new slave which runs on the master, let's call it slave-master. I.e. You will have master with 6 executors that has usage set to utilise as much as possible, and then slave-master which has usage restricted to only the short builds. So on your server you will have two jenkins tasks running, one is the jenkins master it self, and two is the slave-master.

For info on how to connect slaves, go to https://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds

Upvotes: 4

Arpit Aggarwal
Arpit Aggarwal

Reputation: 29276

Adding to @StephenKing answer, you also have to specify the label name for each job while configuring it, as shown in the below image:

enter image description here

Upvotes: 3

StephenKing
StephenKing

Reputation: 37600

In the slave configuration, you can set the Usage mode to Only build jobs with label expressions matching this node.

Then, only jobs matching a given label (e.g. job-group-whatever) will be executed on this slave.

enter image description here

Upvotes: 1

Related Questions