Paul Draper
Paul Draper

Reputation: 83255

Run Jenkins job immediately

I have a very lightweight job that should be executed immediately when it is triggered, rather than waiting an hours for current jobs to finish.

As I understand, a flyweight task is what I want. It will create a ephemeral executor, just for that task.

How can I make a job be run as flyweight?

Upvotes: 7

Views: 1856

Answers (3)

Shengqi Wang
Shengqi Wang

Reputation: 161

I have recently had the same problem. My company has a lot of jenkins projects and some have more precedence over others, and we limit the number of executors to only 4.

Therefore, we decided to create some slaves, instead of always building on the master. Create a slave node that only builds your "very lightweight job".

Go to Manage Jenkin -> Manage nodes -> New node -> Dumb slave.

Then configure your slave node to your liking. Now configure the "very lightweight job". Make sure that This build is parameter is checked, then Add parameter -> Node.

Then select the slave node that you just created. There are a lot of configurations, such as which node do you want to default, but I think you can customize that to your liking.

Upvotes: 2

Jeff Strunk
Jeff Strunk

Reputation: 212

Try out this FlyWeightProject Plugin. It is an extension of the Freestyle type that runs in Flyweight.

Upvotes: 0

Gerold Broser
Gerold Broser

Reputation: 14762

AFAIU the issue is that all your executors are occupied when it comes to running this high priority job.

What about:

  • Establishing another slave node; in a VM, for instance; with an appropriate number of executors, in case there are more of these high priority jobs
  • Assigning a label like high-priority to this new node
  • Restricting where this high priority job can be run to this high-priority label
  • Assigning a label like long-running to all other nodes
  • Restricting where all other jobs can be run to this long-running label

Another possibility is to:

  • Configure the new node's Usage: Only build jobs with label restrictions matching this node
  • Restrict where the high priority job can be run to the new node

    This avoids having to create and assign labels to all jobs, as mentioned above, but is less flexible for future adaptions and extensions.

Upvotes: 0

Related Questions