Working with Resources

What is Resource

Resource means any physical or virtual component of limited availability within the grid, and is provided by grid node. A build step can declare to require certain resources to run. If some nodes are found with desired resources, the step will run on the fastest node; otherwise, the step will wait until a node with free resource is available. This way, the resource contention problem between builds and steps can be solved efficiently.

For instance, we can define the CPU processor resource representing all CPU processors of all agents in the grid, and declare that master step of the build requires the processor resource. This guarantees that a processor will run one and only one build. If processor resource is currently used up, new build requests will wait until there is a free one. Another example is that you have a single deployment machine in your grid, and only one deployment step can deploy to that machine in the same time. In this case, you may define a deployment resource corresponding to that machine, and for each deploy step, define it to require the deployment resource.

Define and Examine Resources

Resource can be defined in the resource tab. When define a resource, you will need to specify which grid node will provide the resource, and how many it will provide. Below screenshot defines a CPU processor resource, and all build agents can provide this resource, with the resource count set to system property qb.processor.number:

The #available column displays total number of resources currently available, and #used column displays total number of used resources.

Resources belonging to a specific node can also be examined from the node detail page like below:

Use Resource

To declare that a step requires a resource, please edit the step and choose option on node with specified resource for the node selection field like below:

This option can be combined with other node selection options. Taking the processor resource for example, you may define node selection property to use the processor resource and also on agent1, then the step will only run when a processor resource exists on agent1.

Migrate from Queue to Resource

The reason that we discard the queue concept is that the queue workers are not associated with grid nodes, and therefore it is difficult to solve the node resource contention problem between builds and steps. Now with the resource utility, we can queue build requests more reasonably and efficiently. To do so, please define appropriate resources and edit the master step to use those resources. When resource requirement of a master step is not satisfied, the whole build request will be in waiting state.


Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.