Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 327
Yotam Eliraz Avatar asked May 27 '15 14:05

Yotam Eliraz


People also ask

How do I run multiple jobs parallelly in Jenkins?

Use mulijob in the following way: When creating new Jenkins jobs you will have an option to create MultiJob project. In the build section, this job can define phases that contain one or more jobs. All jobs that belong to one phase will be executed in parallel (if there are enough executors on the node)

How do I run concurrent jobs in Jenkins?

Jenkins allows for parallel execution of builds for a Job. Job configuration page has a check box, "Execute concurrent builds if necessary". Also, in the master node configuration set the "# of executors" field to more than 1. Once these two are done, parallel job execution is enabled.

How do I run two jobs sequentially in Jenkins?

Select Build->Add build step->Trigger/call builds on other projects. Enter the sequential job name. Check the 'Block until the triggered projects finish their builds' checkbox (this only appears when you have the Parameterized Trigger Plugin installed)


2 Answers

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.

like image 188
Christopher Orr Avatar answered Nov 22 '22 13:11

Christopher Orr


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.

like image 36
Ali Soleymanzadeh Avatar answered Nov 22 '22 13:11

Ali Soleymanzadeh