parallel

static

timestamps { ansiColor('xterm') {
  parallel([
    'k1 \u00BB v1': {
      stage( 'build k1' ) {
        node( 'controller' ) {
          println "KEY= k1, VALUE=v1"
          sleep 3
        } // node
      }
    },
    'k2 \u00BB v2': {
      stage( 'build k2' ) {
        node( 'controller' ) {
          println "KEY= k2, VALUE=v2"
          sleep 3
        } // node
      }
    },
    'k3 \u00BB v3': {
      stage( 'build k3' ) {
        node('controller') {
          println "KEY= k3, VALUE=v3"
          sleep 3
        } // node
      }
    }
  ])
  println 'done'
}} // ansiColor | timestamps

dynamic

timestamps { ansiColor('xterm') {
  Map worker = [:]
  Map<String, String> data = [
    "k1": "v1",
    "k2": "v2",
    "k3": "v3",
  ]
  data.each { k ,v ->
    worker[ "${k} \u00BB ${v}" ] = {
      stage( "build ${k}" ) {
        node( 'controller' ) {
          println """
            ---------------
            "KEY=${k} VALUE=${v}"
            ---------------
          """
          sleep 3
        } // node : controller
      } // stage
    } // work
  }
  parallel worker
  println "done !"
}} // ansiColor | timestamps
Copyright © marslo 2020-2023 all right reserved,powered by GitbookLast Modified: 2024-03-12 15:01:28

results matching ""

    No results matching ""