4

I have 3 Jenkins slaves (=nodes) with the same label (let's call them S1,S2,S3.) When I run a job that uses this label and has 3 concurrent builds, all slaves are used. When I have only one build, Jenkins always chooses the same slave (say S1), because its name is the lowest alphabetically. This slave is actually less powerful than S2, so I would prefer that S2 would be the 1st choice. A trivial solution would be to rename the slaves, but it's a wrong solution - why should a host name affected by Jenkins?

A better way (IMHO) would be to enable Jenkins master to prioritize slaves which share the same label.

Any idea?

panda.o24
  • 1,718
  • 1
  • 11
  • 14
Amir Katz
  • 451
  • 2
  • 8
  • 21
  • 1
    Check out this answer http://stackoverflow.com/questions/25900538/can-jenkins-nodes-be-given-priority-for-build-jobs – KeepCalmAndCarryOn Jun 04 '15 at 08:19
  • Thanks @KeepCalmAndCarryOn - it seems that the 1st answer in the mentioned thread (use **Scoring Load Balancer** plugin) should do it. I will check it out and update this thread. – Amir Katz Jun 04 '15 at 08:25

1 Answers1

6

By default, Jenkins will try to use the node that the same job has run on previously/last.

This is on the assumption that the last run of the job (and therefore the last node it ran on) has the latest SCM checkout, thus reducing the number of files required for update, and therefore speeding up the build.

To change this behaviour, use various plugins, like the aforementioned Scoring Load Balancer plugin.

Slav
  • 25,168
  • 9
  • 69
  • 95
  • This raises the question - when you run a job for the first time ever, how does Jenkins choose the slave from the label group (assuming that all slaves in the label have same # of executors and all have the same load at that time)? – Amir Katz Jun 07 '15 at 10:52
  • 1
    Update: I have since started to use the Scoring Load Balancer which provides me with the priority mechanism. – Amir Katz Nov 16 '15 at 06:39