Hi,

I'm working with pipeline jobs where we use different kind of nodes.
The nodes have only one executor each.
I'm trying to find a way to give priority to certain jobs, in such a way 
that they are executed once a node is available, even though another job 
already requested to use the node.

To illustrate my case consider a *Low Prio Job*, with a pipeline like:
def steps = [:]

steps['s1'] = {
    stage("LP1") {
        node("X") {
            println "Low Prio Job, Step 1"
            sleep 30
        }
    }
}
steps['s2'] = {
    stage("LP2") {
        node("X") {
            println "Low Prio Job, Step 2"
            sleep 30
        }
    }
}
parallel steps


And a *High Prio Job*, with a pipeline like:
def steps = [:]
steps['s1'] = {
    stage("HP1") {
        node("X") {
            println "High Prio Job, Step 1"
            sleep 30
        }
    }
}
steps['s2'] = {
    stage("HP2") {
        node("X") {
            println "High Prio Job, Step 2"
            sleep 30
        }
    }
}
parallel steps

I start the *Low Prio Job* first and the *High Prio Job* a couple of 
seconds later.

What happens is that both stages of the Low Prio Job are executed and then 
the two stages of the High Prio Job.
So in time over both jobs the output is:
Low Prio Job, Step 1
Low Prio Job, Step 2
High Prio Job, Step 1
High Prio Job, Step 2

I would like to be able to change this behavior such that the High Prio Job 
gets to use the node as soon as it is available, making the output in time 
look like:
Low Prio Job, Step 1
High Prio Job, Step 1
High Prio Job, Step 2
Low Prio Job, Step 2

I've tried to use the Priority Sorter Plugin 
<https://wiki.jenkins.io/display/JENKINS/Priority+Sorter+Plugin>, but it 
looks like this plugin only impacts the initial start of a build, not 
during the build.

Does anybody have any suggestions on how to solve this challenge?
Any other plugins I could look into? Or any extension point that could be 
used to do this?

Thnx!

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/ac5029b1-ca63-4d89-a486-7411a8566054%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to