Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

resource utilization: how to avoid steps waiting for resources that won't be available? #4185

OnQuickBuild ·

Hi Robin

Could you help me out again please?

Usually all the resources we defined are online for taking. But when certain agents are off-line, the resource count will remain 0 for some time. But if the build starts again, it will wait for the resource forever.

I tried to use a Groovy script (with node.hasResource('res_that_is_unavailable') in the node selection "on node with specified script evaluating to be true", and the child steps still ran (or rather are waiting) for the resources, the "not matching reason" says "script returned false on this node".

When no one noticed the agent is off line, the build will wait forever until timeout.

Is it possible to allow the build to continue when certain resources are unavailable? So the steps that require unavailable resources will just skip, and the steps with enough other resources will still run.

Thanks!

  • replies 2
  • views 48
  • stars 0
OnQuickBuild ·

groovy:
// make sure the required resource is still on the grid, or else it'll keep waiting forever
def res = params.get('unavailable_resource')
def all_nodes = grid.getAllNodes()
all_nodes.each() {
if (it.hasResource(res))
return true
}
return false

The code in the node selection setting.

robinshen ADMIN ·

This is by design, build steps should be waiting until some resource is available, to complete its job as best as it can.