Yotam Eliraz
Yotam Eliraz

Reputation: 97

How to simultaneously launch a job 2 times on the same slave in Jenkins?

I have Jenkins installed on my computer which configure to have just the master as a node (no other nodes) and number of executes is 5. I created a Job named "myJob" and I want to run it on the master 2 times at the simultaneously (meaning that if I run Builds 90 and 91, I don't want to get the message that "pending—Build #90 is already in progress"). I also have Throttle Concurrent Builds plugin installed and it allows this job to run more than once at the same time..

I still getting the "pending" message.

Can anyone tell me how to achieve it?

Upvotes: 6

Views: 9118

Answers (3)

Ali Soleymanzadeh
Ali Soleymanzadeh

Reputation: 11

You also need to make sure the salve is set for running more than one job.

To set your note to run more than one job: Manage Jenkins -> Manage Nodes -> Configure Node -> # of executors Has to set to 2 or whatever jobs you want to execute simultaneously.

Upvotes: 1

JasonRobinson
JasonRobinson

Reputation: 107

As previously mentioned, you need to check the "Execute concurrent builds" box in the job's config screen.

You will then get a "job\workspace" and a "job1\workspace" (or something similar.) Since both jobs need their own workspace, the second instance will need to create a new workspace folder structure.

Just something to keep in mind if you expected both jobs to be running in the same directory.

Upvotes: 0

Christopher Orr
Christopher Orr

Reputation: 111565

By default, multiple builds of the same job cannot run at the same time — that's why it remains in the queue with the "already in progress" message.

You can, however, change this behaviour in a job's configuration by enabling the "Execute concurrent builds if necessary" checkbox.

Note that, if you have multiple build nodes, the two concurrent builds of the job will likely be spread out to run on different nodes, rather than occupying both executors of the same build node.
If you require that they both run on the same machine, you should likely use the "Restrict where this job can run" option to ensure all builds of that job run on the same node.

Upvotes: 11

Related Questions