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

Possibility to specify number of executors a node step will consume

      Possibility to specify number of executors a node step will consume. The syntax below is probably not correct but I hope it will get the general idea across.

      // List of tuples with (taskName, executorCount)
      def heavyTasks = [('task1', 2), ('task2', 3), ('task3', 8)]
      def tasks = [:]
      for (x in heavyTasks) {
          def task = x
          tasks[task] = {
              node executors: task[1] {
                  sh 'heavyThreadedTaskGoesHere'
                  }
          }
      }
      stage("RunTasks") {
          parallel tasks
      }
      

      EDIT: There is a plugin that tries to do this but there is no pipeline support. https://wiki.jenkins-ci.org/display/JENKINS/Heavy+Job+Plugin

          [JENKINS-39975] Possibility to specify number of executors a node step will consume

          Jesse Glick added a comment -
          node {
            node(NODE_NAME) {
              // …
            }
          }
          

          would do the trick for n=2, though this is probably deadlock-prone—not sure how the plugin handles that.

          Jesse Glick added a comment - node { node(NODE_NAME) { // … } } would do the trick for n=2, though this is probably deadlock-prone—not sure how the plugin handles that.

            Unassigned Unassigned
            rbjorklin Robin Björklin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: