Reputation: 91
I have 4 nodes and 2 jobs. Any node can run 2 jobs concurrently and any job can be executed concurrently. I want to be able to restrict running the same job concurrently on the same machine. For example:
Jobs: J1 and J2 nodes: N1,N2,N3 and N4
I can run J1 and J2 on the same node at the same time. I can run J1 on N1 and N3 at the same time. BUT I do not want to run J1 and another build of J1 on the same node at the same time.
I have tried "Locks and Latches", "Jenkins Exclusive Execution", "Exclusion Plugin" plugins, and these will work well when trying to coordinate different jobs. But my case is trying to manage different build-instances of the same job.
Upvotes: 9
Views: 13220
Reputation: 21206
Try Throttle Concurrent Builds Plugin. It allows to throtte the number of concurrent builds of a project running per node or globally. In your case you should set:
Upvotes: 16
Reputation: 4075
Last time I have checked, only a single instance of each job can run at a single time, i.e.:
If you press the [build] key twice, the first instance of the job will be executed, and only after it is finished - the next one will start.
Were you actually able to run Job1-Build1 and J1-Build2 at the same time?
Upvotes: 2