Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-6598

Let Node and NodeProperty have more control over whether a node can run a task

    XMLWordPrintable

    Details

    • Type: Patch
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Done
    • Component/s: core
    • Labels:
      None
    • Similar Issues:

      Description

      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.

        Attachments

          Issue Links

            Activity

            mdillon mdillon created issue -
            kohsuke Kohsuke Kawaguchi made changes -
            Field Original Value New Value
            Assignee kohsuke [ kohsuke ]
            scm_issue_link SCM/JIRA link daemon made changes -
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Resolved [ 5 ]
            abayer Andrew Bayer made changes -
            Status Resolved [ 5 ] Closed [ 6 ]
            rtyler R. Tyler Croy made changes -
            Resolution Fixed [ 1 ]
            Status Closed [ 6 ] Reopened [ 4 ]
            rtyler R. Tyler Croy made changes -
            Reporter mdillon [ mdillon ] Mike Dillon [ md5 ]
            rtyler R. Tyler Croy made changes -
            Resolution Done [ 10000 ]
            Status Reopened [ 4 ] Closed [ 6 ]
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 136693 ] JNJira + In-Review [ 204175 ]
            jglick Jesse Glick made changes -
            Link This issue relates to JENKINS-38514 [ JENKINS-38514 ]

              People

              Assignee:
              kohsuke Kohsuke Kawaguchi
              Reporter:
              md5 Mike Dillon
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: