Affects Version/s: None
Fix Version/s: None
Right now, the only logic to determine whether a Node can run a particular Queue.Task is in JobOffer.canTake(Task). The logic is as follows:
1. Check if the task has an assigned label; if it does and this node is not in the label, the node can't take the task
2. If the task does not have an assigned label and this node only allows tied jobs (Mode.EXCLUSIVE), the node can't take the task
3. If the node is offline or not accepting tasks, the node can't take the task
I would like to add Node.canTake(Task) and NodeProperty.canTake(Task) methods. The JobOffer.canTake(Task) method would be changed to call Node.canTake(), moving checks #1 and #2 into the Node.canTake() implementation. Node.canTake() would then call NodeProperty.canTake(Task) on all of its assigned properties; if any of them return false, Node.canTake(Task) will also return false. The default implementation in the NodeProperty base class will return true.
This allows Node subclasses and custom NodeProperties to control whether or not a particular Task should go to a particular Node, making it possible to do things like capabilities-based job assignment as opposed to the manually-intensive use of tying and node labels.
I'm attaching a patch I've made to our internal copy of Hudson to make this change. I believe I have commit privileges to commit this if nobody objects to this change, otherwise I can get one of the other Yahoo! folks to do it.