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

Howto define a fallback label in case all hosts for default label are busy?

    Details

    • Similar Issues:

      Description

      Unfortunately the pluign documentation is a bit short and should cover more use cases. One of them is the assignment of a default label and, in case all hosts with that label are busy, a fallback label so that the job only has to wait if all hosts with both labels are busy. This would allow to specify a preference for faster hosts and fall back to slower ones if all fast hosts are busy.

      Here's what I've tried so far:

      import jenkins.model.Jenkins
      
      Jenkins.instance.getLabel('FastHost').getNodes().each { agent ->
        def executors = agent.getComputer().numExecutors
        def busy = agent.getComputer().countBusy()
        if (busy < executors) {
          return "FastHost"
        }
      }
      return "SlowHost"
      

      But this always returns "SlowHost", no matter how many executors are free on "FastHost" hosts.

        Attachments

          Activity

          dhs Dirk Heinrichs created issue -
          dhs Dirk Heinrichs made changes -
          Field Original Value New Value
          Priority Major [ 3 ] Minor [ 4 ]
          ikedam ikedam made changes -
          Status Open [ 1 ] Fixed but Unreleased [ 10203 ]
          Assignee ikedam [ ikedam ] Dirk Heinrichs [ dhs ]
          Resolution Not A Defect [ 7 ]

            People

            • Assignee:
              dhs Dirk Heinrichs
              Reporter:
              dhs Dirk Heinrichs
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: