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 depending on another resource? #4044

drdt ·

We don't want builds to start if there isn't enough disk space. So, I modified all my resources to include a condition:

node.getAttribute( "F_SPACE" ) >= "100";

I also have a resource "DONT_USE" which includes this condition:

node.getAttribute( "F_SPACE" ) < "100";

(We also have a step that runs after each build to keep the F_SPACE attribute up-to-date).

However, we then thought of other reasons to declare a node not useable (f/x, it has been reporting erroneous build failures), and I realize I will have to update all of the resources. A better solution would be to just add the new conditions to "DONT_USE" and thern have my other resources include a condition something like:

node.hasResource( "DONT_USE" ) == false;

(Although, of course, the documentation says that won't work).

There are other cases where I can see this being useful. Is there a way to accomplish what I want - have a resource depend on whether the node has another resource?

  • replies 8
  • views 29
  • stars 0
robinshen ADMIN ·

I guess this can be easily achieved by defining a node attribute "DO_NOT_USE", and make your resource available on node with that attribute equal to false. Then each time you have something new to limit, just update the DO_NOT_USE attribute as necessary.

drdt ·

I can see that approach working; however, I would need to have a job that runs fairly often, to automatically create the node attribute on nodes in the DONT_USE resource. But then, when the problem becomes corrected, how would the resource become cleared?

Being able to trigger based off of the DONT_USE resource is much simpler and more intuitive.

robinshen ADMIN ·

I guess using resource here complicated things. The simplest approach would be to modify the node selection setting of your steps to include below condition and make it "AND" with other conditions:

If node has attribute value:
DO_NOT_USE = false

drdt ·

This is what we ended up doing for this case. However, it did not help with other use cases of resource dependency.

robinshen ADMIN ·

Introducing another concept of resource dependency really complicates things. What are the other use cases?

drdt ·

I had forgotten that I filed this as an enhancement request some time ago: http://track.pmease.com/browse/QB-1075

The use case at the time was that I was filtering hosts based on network address, so they would be assigned to either TEST_FARM, BUILD_FARM, or OPERATIONS tasks. So, when we added a new domain, I had to modify all of my resource definitions.

robinshen ADMIN ·

I understand your concern: you want to provide some form of node criteria template and re-use it for convenience. Maybe including it as another node selection criteria does not complicate the interface. Will add this in a minor release of QB9 (QB9 will be released in the end of this month)

robinshen ADMIN ·

The change turns out to be trivial, and will be included in QB9.