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

Pipeline parallel map not supporting curried closures

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      When executing a curried closure in parallel the output appears to be cached (see the output for the spam branch below).

      Example pipeline:

      def example_c = { input -> node { echo "$input" } }
      def map = [:]
      map['spam'] = example_c.curry('spam')
      map['eggs'] = example_c.curry('eggs')
      parallel map
      

      Output:

      [Pipeline] parallel
      [Pipeline] [spam] { (Branch: spam)
      [Pipeline] [eggs] { (Branch: eggs)
      [Pipeline] [spam] node
      [spam] Running on java8-jenkins-ec2-slave (i-a541b5be) 
      [Pipeline] [eggs] node
      [Pipeline] [spam] {
      [eggs] Running on java8-jenkins-ec2-slave (i-a541b5be) 
      [Pipeline] [spam] echo
      [spam] eggs
      [Pipeline] }
      [Pipeline] [eggs] {
      [Pipeline] // node
      [Pipeline] }
      [Pipeline] [eggs] echo
      [eggs] eggs
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] }
      [Pipeline] // parallel
      [Pipeline] End of Pipeline
      

        Attachments

          Issue Links

            Activity

            Hide
            fortuna Ben Fortuna added a comment -

            Also note that the equivalent script run in the Script Console works as expected:

            def example_c = { input -> println "$input" }
            def map = [:]
            map['spam'] = example_c.curry('spam')
            map['eggs'] = example_c.curry('eggs')
            map.keySet().each { key ->
              map[key]()
            }
            

            Result

            spam
            eggs
            Result: [spam, eggs]
            
            Show
            fortuna Ben Fortuna added a comment - Also note that the equivalent script run in the Script Console works as expected: def example_c = { input -> println "$input" } def map = [:] map[ 'spam' ] = example_c.curry( 'spam' ) map[ 'eggs' ] = example_c.curry( 'eggs' ) map.keySet().each { key -> map[key]() } Result spam eggs Result: [spam, eggs]
            Hide
            jekeller Jacob Keller added a comment -

            I think this is similar to https://issues.jenkins-ci.org/browse/JENKINS-38268 and doesn't require use of curried closures, but just closures within parallel in general.

            Show
            jekeller Jacob Keller added a comment - I think this is similar to https://issues.jenkins-ci.org/browse/JENKINS-38268 and doesn't require use of curried closures, but just closures within parallel in general.
            Hide
            abayer Andrew Bayer added a comment -

            Yet another of the JENKINS-26481 symptoms...

            Show
            abayer Andrew Bayer added a comment - Yet another of the JENKINS-26481 symptoms...
            Hide
            jglick Jesse Glick added a comment -

            Not obviously a duplicate.

            Show
            jglick Jesse Glick added a comment - Not obviously a duplicate.
            Hide
            abayer Andrew Bayer added a comment -

            This works in current (i.e., 2.39) workflow-cps - added a test at https://github.com/jenkinsci/workflow-cps-plugin/pull/160 to verify.

            Show
            abayer Andrew Bayer added a comment - This works in current (i.e., 2.39) workflow-cps - added a test at https://github.com/jenkinsci/workflow-cps-plugin/pull/160 to verify.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            src/test/java/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition2Test.java
            http://jenkins-ci.org/commit/workflow-cps-plugin/37e3fdde8a0ee5470924ff09ba3957ec421d29f5
            Log:
            JENKINS-38052 Test verifying that JENKINS-38052 is fixed.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: src/test/java/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition2Test.java http://jenkins-ci.org/commit/workflow-cps-plugin/37e3fdde8a0ee5470924ff09ba3957ec421d29f5 Log: JENKINS-38052 Test verifying that JENKINS-38052 is fixed.

              People

              Assignee:
              abayer Andrew Bayer
              Reporter:
              fortuna Ben Fortuna
              Votes:
              6 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: