Trying to figure out how to add Workflow step support for Throttle Concurrent Builds...

30 views
Skip to first unread message

Andrew Bayer

unread,
Dec 13, 2015, 2:58:11 PM12/13/15
to jenkin...@googlegroups.com
So, https://issues.jenkins-ci.org/browse/JENKINS-31801 - I'm starting to dive into the Workflow code to figure out how to actually *do* this. I'm only really concerned with adding category throttling support for Workflow node blocks - i.e., wrap your node block with "throttle('some-category') { ... }" and that will be throttled in the same way as any other job with that category. It might make sense to add more logic down the road, but that seems like enough of a challenge to start. =)

In non-Workflow world, what we do is check for Queue.Tasks that are, in fact, Jobs, and see if they've got the appropriate ThrottleJobProperty set, etc to determine whether we've hit the throttle max, using ThrottleQueueTaskDispatcher, which extends QueueTaskDispatcher, etc... But in Workflow world, I've got questions that a cursory diving through the source has not yet been able to answer:

- Do Workflow steps/nodes/whatever (FlowNode? FlowExecution? Not sure which class is the equivalent of Job for individual chunks of the DSL?) implement Queue.Task eventually? Do they end up getting fed through Queue.JobOffer, which would get them to QueueTaskDispatcher?
- Ok, that ended up being one big question, so I'll leave it at that for the moment. =)

A.

Robert Sandell

unread,
Dec 14, 2015, 5:13:00 AM12/14/15
to jenkin...@googlegroups.com
The stage step has a concurrency attribute (a.k.a. the James Nord Operator) perhaps diving into how that works could give you some insight.

/B

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAPbPdObFxBQZVBBUSKojZH9p3VqtPOWQOXSFrCjNc3DEuW7XSA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



--
Robert Sandell
Software Engineer
CloudBees Inc.

Jesse Glick

unread,
Dec 18, 2015, 2:56:50 AM12/18/15
to Jenkins Dev

Complicated question. `node` blocks do create `Task`s which are fed to the `Queue`. There is not currently any way to decorate the resulting `Queue.Item`s with `Action`s, which you would need to do what you are attempting.

But do you really need to throttle individual blocks? If not, look for the `JobProperty` on the `SubTask.ownerTask`.

Reply all
Reply to author
Forward
0 new messages