Hi again, 

I still wonder wether this is a bug, which I should file, or not.
Maybe I shall detail a bit further, see below.

Thanks !

On Friday, February 20, 2015 at 1:06:38 PM UTC+1, sebastien....@gmail.com 
wrote:
>
> Hello,
>
> I'm experimenting with the "stage" command using the flow below, and 
> running the job 4 times in a row (#59, #60, #61, #62).
>
> My test show that the concurrency limit I set for stage 'build_and_test' 
> is not accounted for, but the one for the 'test' stage is (great feature, 
> thanks!).
>
> Maybe limiting concurrency only works within a node scope? Or am I missing 
> something?
>
> Doc is quite sparce regarding the stage command.
>
> stage name: 'sync'
>> node("qisrc") {
>>   echo "before sync"
>>   sh "sleep 10"
>>   echo "after sync"
>> }
>>
>> stage name: 'build_and_test', concurrency: 1
>>
>
Here I expect the first job to continue, and the others to wait, in a stack 
of size one (a newcomer kicks the older one off).
However it did not happen that way (see below) they all continue to the 
next stage irrespective of the concurrency constraint.

node("qisrc") {
>>   stage name: 'build'
>>   echo "before build"
>>   sh "sleep 10"
>>   echo "build 1/3"
>>   sh "sleep 10"
>>   echo "build 2/3"
>>   sh "sleep 10"
>>   echo "build 3/3"
>>
>>   stage name: 'test', concurrency: 1
>>
>
I expect this "concurrency constraint" to be superfluous since the previous 
stage command constrained the concurrency to one already.
However, in practice, since the previous get ignored, the concurrent jobs 
do wait here.
 

>   echo "before test"
>>   sh "sleep 10"
>>   echo "test 1/3"
>>   sh "sleep 10"
>>   echo "test 2/3"
>>   sh "sleep 10"
>>   echo "test 3/3"
>> }
>>
>
> job/workflow/59/console:
>
>> Started by user admin <http://agility-test.local/user/admin>
>> Running: sync
>> Entering stage sync
>> Proceeding
>> Running: Allocate node : Start
>> Running on qisrc in /home/jenkins/jenkins/workspace/workflow
>> Running: Allocate node : Body : Start
>> Running: Print Message
>> before sync
>> Running: Shell Script
>> [workflow] Running shell script
>> + sleep 10
>> Running: Print Message
>> after sync
>> Running: Allocate node : Body : End
>> Running: Allocate node : End
>> Running: build_and_test
>> Entering stage build_and_test
>> Proceeding
>>
>>
This is expected since this is the first job (#59). 

Running: Allocate node : Start
>> Running on qisrc in /home/jenkins/jenkins/workspace/workflow
>> Running: Allocate node : Body : Start
>> Running: build
>> Entering stage build
>> Proceeding
>> Running: Print Message
>> before build
>> Running: Shell Script
>> [workflow] Running shell script
>> + sleep 10
>> Running: Print Message
>> build 1/3
>> Running: Shell Script
>> [workflow] Running shell script
>> + sleep 10
>> Running: Print Message
>> build 2/3
>> Running: Shell Script
>> [workflow] Running shell script
>> + sleep 10
>> Running: Print Message
>> build 3/3
>> Running: test
>> Entering stage test
>> Proceeding
>>
>>
This is expected since this is the first job (#59). 

Running: Print Message
>> before test
>> Running: Shell Script
>> [workflow] Running shell script
>> + sleep 10
>> Running: Print Message
>> test 1/3
>> Running: Shell Script
>> [workflow] Running shell script
>> + sleep 10
>> Running: Print Message
>> test 2/3
>> Running: Shell Script
>> [workflow] Running shell script
>> + sleep 10
>> Running: Print Message
>> test 3/3
>> Running: Allocate node : Body : End
>> Running: Allocate node : End
>> Running: End of Workflow
>> Finished: SUCCESS
>>
>>
> job/workflow/60/console:
>
>> Started by user admin <http://agility-test.local/user/admin>
>> Running: sync
>> Entering stage sync
>> Proceeding
>> Running: Allocate node : Start
>> Running on qisrc in /home/jenkins/jenkins/workspace/workflow@2
>> Running: Allocate node : Body : Start
>> Running: Print Message
>> before sync
>> Running: Shell Script
>> [workflow@2] Running shell script
>> + sleep 10
>> Running: Print Message
>> after sync
>> Running: Allocate node : Body : End
>> Running: Allocate node : End
>> Running: build_and_test
>> Entering stage build_and_test
>> Proceeding
>>
>>
This is *unexpected* since this the first job (#59) is still running.

Running: Allocate node : Start
>> Running on qisrc in /home/jenkins/jenkins/workspace/workflow@2
>> Running: Allocate node : Body : Start
>> Running: build
>> Entering stage build
>> Proceeding
>> Running: Print Message
>> before build
>> Running: Shell Script
>> [workflow@2] Running shell script
>> + sleep 10
>> Running: Print Message
>> build 1/3
>> Running: Shell Script
>> [workflow@2] Running shell script
>> + sleep 10
>> Running: Print Message
>> build 2/3
>> Running: Shell Script
>> [workflow@2] Running shell script
>> + sleep 10
>> Running: Print Message
>> build 3/3
>> Running: test
>> Entering stage test
>> Waiting for builds [59]
>>
>>
So, at this step, we (job #60) aknowledge that job #59 is running and wait. 
Weird, it should have happened ate the build_and_test stage instead.

Canceled since #61 got here
>>
>>
Idem, it should have happened ate the build_and_test stage instead.

Jobs 61 and 62 below behave the same way, they wait at stage test instead 
of build_and_test.

Running: Allocate node : Body : End
>> Running: Allocate node : End
>> Running: End of Workflow
>> Superseded by #61
>> Finished: NOT_BUILT
>>
>>
> http://agility-test.local/job/workflow/61/console
>
>> Started by user admin <http://agility-test.local/user/admin>
>> Running: sync
>> Entering stage sync
>> Proceeding
>> Running: Allocate node : Start
>> Running on qisrc in /home/jenkins/jenkins/workspace/workflow@3
>> Running: Allocate node : Body : Start
>> Running: Print Message
>> before sync
>> Running: Shell Script
>> [workflow@3] Running shell script
>> + sleep 10
>> Running: Print Message
>> after sync
>> Running: Allocate node : Body : End
>> Running: Allocate node : End
>> Running: build_and_test
>> Entering stage build_and_test
>> Proceeding
>> Running: Allocate node : Start
>> Running on qisrc in /home/jenkins/jenkins/workspace/workflow@3
>> Running: Allocate node : Body : Start
>> Running: build
>> Entering stage build
>> Proceeding
>> Running: Print Message
>> before build
>> Running: Shell Script
>> [workflow@3] Running shell script
>> + sleep 10
>> Running: Print Message
>> build 1/3
>> Running: Shell Script
>> [workflow@3] Running shell script
>> + sleep 10
>> Running: Print Message
>> build 2/3
>> Running: Shell Script
>> [workflow@3] Running shell script
>> + sleep 10
>> Running: Print Message
>> build 3/3
>> Running: test
>> Entering stage test
>> Canceling older #60
>> Waiting for builds [59]
>> Canceled since #62 got here
>> Running: Allocate node : Body : End
>> Running: Allocate node : End
>> Running: End of Workflow
>> Superseded by #62
>> Finished: NOT_BUILT
>>
>>
> http://agility-test.local/job/workflow/62/console
>
>> Started by user admin <http://agility-test.local/user/admin>
>> Running: sync
>> Entering stage sync
>> Proceeding
>> Running: Allocate node : Start
>> Running on qisrc in /home/jenkins/jenkins/workspace/workflow@4
>> Running: Allocate node : Body : Start
>> Running: Print Message
>> before sync
>> Running: Shell Script
>> [workflow@4] Running shell script
>> + sleep 10
>> Running: Print Message
>> after sync
>> Running: Allocate node : Body : End
>> Running: Allocate node : End
>> Running: build_and_test
>> Entering stage build_and_test
>> Proceeding
>> Running: Allocate node : Start
>> Running on qisrc in /home/jenkins/jenkins/workspace/workflow@4
>> Running: Allocate node : Body : Start
>> Running: build
>> Entering stage build
>> Proceeding
>> Running: Print Message
>> before build
>> Running: Shell Script
>> [workflow@4] Running shell script
>> + sleep 10
>>
>> Running: Print Message
>> build 1/3
>> Running: Shell Script
>>
>> [workflow@4] Running shell script
>> + sleep 10
>>
>> Running: Print Message
>> build 2/3
>> Running: Shell Script
>> [workflow@4] Running shell script
>>
>> + sleep 10
>>
>> Running: Print Message
>> build 3/3
>> Running: test
>> Entering stage test
>> Canceling older #61
>> Waiting for builds [59]
>>
>> Unblocked since #59 finished
>> Running: Print Message
>> before test
>> Running: Shell Script
>> [workflow@4] Running shell script
>> + sleep 10
>>
>> Running: Print Message
>> test 1/3
>> Running: Shell Script
>> [workflow@4] Running shell script
>> + sleep 10
>>
>> Running: Print Message
>> test 2/3
>> Running: Shell Script
>> [workflow@4] Running shell script
>> + sleep 10
>>
>> Running: Print Message
>> test 3/3
>> Running: Allocate node : Body : End
>> Running: Allocate node : End
>> Running: End of Workflow
>> Finished: SUCCESS
>>
>>  
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/b21fb90e-5f91-4f97-8c7a-d716d02c68c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to