Fwd: How to run upstream and downstream jobs on same executor

238 views
Skip to first unread message

kamthe kirtee

unread,
Apr 5, 2021, 9:01:06 AM4/5/21
to jenkins...@googlegroups.com

---------- Forwarded message ---------
From: kamthe kirtee <kamthek...@gmail.com>
Date: Mon, 5 Apr, 2021, 4:36 pm
Subject: How to run upstream and downstream jobs on same executor
To: <jenkinsci-us...@googlegroups.com>


Hi team, 

Suppose in jenkins I have 1 slave  and in that slave I have 1 executor
Also I have one upstream job and one  downstream job

My question is:
If an upstream job is running on executor 1,  and after that my downstream job is starting on the same executor at the same time, & I want upstream job to go aside/queue  untill the downstream job is over. 

Once the downstream job is over, the paused upstream job should again resume start running on the same executor. 

So how We can achieve this?  Because I don't want to increase the number of executors 

Can you please guide me for the same?

Thanks

Mark Waite

unread,
Apr 5, 2021, 9:04:40 AM4/5/21
to Jenkins Users
If I take the words precisely as you stated them, I don't think you can run multiple jobs at the same time on the same agent with only 1 executor.  With only 1 executor, only 1 job can be executed on that agent.

If you would like to have the downstream job run on the same agent as the upstream job, you might look at the node label parameter plugin.  It has the ability to assign a downstream job to run on the same agent as the upstream job that starts the downstream job.

Mark Waite

Gianluca Massera

unread,
Apr 5, 2021, 11:19:10 AM4/5/21
to jenkins...@googlegroups.com

Hi,

from what I know, it's not achievable. When a job is waiting for a downstream to complete, it keeps an executor occupied. So, the downstream job needs to run on a different executor.

But, frankly, that seems more of https://xyproblem.info/ :-)

So, what is your problem? what do you need?

Cheers,

Gianluca.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAD0fyGieWSsj%3DmAtLQEyuOkn0h5Y_q%2BGpf1oEZ%3DMKYfYS20mEw%40mail.gmail.com.

kamthe kirtee

unread,
Apr 5, 2021, 12:19:31 PM4/5/21
to jenkins...@googlegroups.com
Hi,

My question is if upstream job is running on executor 1 and when downstream job is triggered, that should run on executor 1 or executor 2 

As soon as downstream job started running, upstream job should not be running on any of the  executor.

Beacuse I don't want upstream job to wait for the downstream job to complete
 and also  not to occupied executor unnecessarily. 

Thanks
 

Gianluca Massera

unread,
Apr 5, 2021, 12:44:36 PM4/5/21
to jenkins...@googlegroups.com

Hi,

From what I know, a job will keep an executor busy till it completes.

Hence, if an upstream job needs to do something after a downstream completes, then Jenkins needs two executors.

Otherwise, if an upstream job doesn't need to anything after a downstream completes, then you trigger a downstream with wait options set to false and if there is only one executor Jenkins will queue the downstream job till the upstream completes and the executor will be free to run something else.

Is it clear?

Also, "waiting for something" even though doesn't need much CPU still needs some processing power, hence you need an executor, hence is not occupied unnecessarily ... it's occupied to do what you asked for: "wait for something" ;-)

Hope that helps.

Cheers,

Gianluca.

Reply all
Reply to author
Forward
0 new messages