Change By: Thomas Dalton (11/Apr/15 11:12 PM)
Description: Take the following script as an example:

{code}
node {
    def sleeps = [ : ]
    for (int i = 0; i < 4; i++) {
        sleeps["num_${i}"] = { sleep60() }
    }
    parallel(sleeps)
}

def sleep60 () {
    ws {
        stage name: "Sleep for 60 secs", concurrency: 1
        sh "sleep 60"
    }
}
{code}

Because the stages are marked with {{concurrency: 1}}
) , I would expect the sleeps to occur in series, but with all  "  parallel "  tasks performed. With 3, then 2, then 1 task blocked until all are complete.

Instead the first sleep runs, the second blocks on it, but the other two mysteriously "fail", and this actually results in the Job hanging indefinitely and the 2nd
 job  sleep  doesn't seem to  get to  run either.

{code}
Started by user anonymous
Running: Allocate node : Start
Running on master in /mydir/jenkins/workspace/Sandbox
Running: Allocate node : Body : Start
Running: Execute sub-workflows in parallel : Start
[num_0] Running: Parallel branch: num_0
[num_1] Running: Parallel branch: num_1
[num_2] Running: Parallel branch: num_2
[num_3] Running: Parallel branch: num_3
[num_0] Running: Allocate workspace : Start
[num_0] Running in /mydir/jenkins/workspace/Sandbox-2
[num_0] Running: Allocate workspace : Body : Start
[num_1] Running: Allocate workspace : Start
[num_1] Running in /mydir/jenkins/workspace/Sandbox-3
[num_1] Running: Allocate workspace : Body : Start
[num_2] Running: Allocate workspace : Start
[num_2] Running in /mydir/jenkins/workspace/Sandbox-4
[num_2] Running: Allocate workspace : Body : Start
[num_3] Running: Allocate workspace : Start
[num_3] Running in /mydir/jenkins/workspace/Sandbox-5
[num_3] Running: Allocate workspace : Body : Start
[num_0] Running: Sleep for 60 secs
[num_0] Entering stage Sleep for 60 secs
[num_0] Proceeding
[num_0] Running: Shell Script
[num_0] [Sandbox-2] Running shell script
[num_1] Running: Sleep for 60 secs
[num_1] Entering stage Sleep for 60 secs
[num_1] Waiting for builds [7]
[num_2] Running: Sleep for 60 secs
[num_2] Entering stage Sleep for 60 secs
Running: Allocate workspace : Body : End
[num_3] Running: Sleep for 60 secs
[num_3] Entering stage Sleep for 60 secs
Running: Allocate workspace : Body : End
Running: Allocate workspace : End
Running: Allocate workspace : End
Running: Execute sub-workflows in parallel : Body : End
Running: Execute sub-workflows in parallel : Body : End
[num_0] + sleep 60
Running: Allocate workspace : Body : End
Running: Allocate workspace : End
Running: Execute sub-workflows in parallel : Body : End
{code}

I assume this is just a bug rather than my misunderstanding of the use of {{concurrency}} but I'm happy to be corrected! 
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to