torsdag 8. mars 2018 17.06.12 UTC+1 skrev Sverre Moe følgende:
>
>
>
> torsdag 8. mars 2018 12.37.47 UTC+1 skrev Reinhold Füreder følgende:
>>
>> Very naïve thought(s):
>>
>>  
>>
>> While “*Do not know why nodeName1 acquired the lock before nodeName 
>> released.*“ might be just a matter of output flushing/buffering, 
>>
> I thought so also, probably because of parallell execution.
>  
>
> “*The entire build hangs and goes no further.*” sounds really frightening 
>> to me.
>>
>>  
>>
>> Maybe it is the usage of lock inside parallel step and/or some CPS 
>> transformation reason, or some little resource misconfiguration issue!?
>>
>>  
>>
>> Ignoring CPS transformations (due to parallel step) I assume/hope the 
>> lock plugin does unit testing the “normal” parallelization usage of locking 
>> resources?
>>
>
> Perhaps a bug in Lockable Resource Plugin. 
> There is no output of CPS transformation exception, nor any other error 
> output. It just hangs after the first acquired resource lock is finished.
>
>
We are using the Lockable Resource Plugin, but currently are locking around 
the parallell step.
This causes a severe bottleneck when building. If several projects are 
building simultaneous it increases the build time by a lot.

stage("build") {
    def stepsForParallel = [:]
    stepsForParallel[buildNode1] = transformIntoStep(buildNode1)
    stepsForParallel[buildNode2] = transformIntoStep(buildNode2)

    lock(resource: 'master-repository') {
        parallel stepsForParallel
    }
}

stage("publish") {
    lock(resource: 'master-repository') {
        publishYumArtifacts()
    }
}

def transformIntoStep() {
    return {
        node(nodeName) {
            preInstall()
            compileAndBuild()
            postInstall()
        }
    }
}


This is what I would like to do instead with the lock:
stage("build") {
    def stepsForParallel = [:]
    stepsForParallel[buildNode1] = transformIntoStep(buildNode1)
    stepsForParallel[buildNode2] = transformIntoStep(buildNode2)
    parallel stepsForParallel
}

stage("publish") {
    lock(label: 'master-repository') {
        publishYumArtifacts()
    }
}

def transformIntoStep(nodeName) {
    return {
        node(nodeName) {
            lock(resource: nodeName) {
                preInstall()
            }

            compileAndBuild()

            lock(resource: nodeName) {
                postInstall()
            }
        }
    }
}


When publishing yum artifacts we need to lock all the resources with label.
When building we lock only the build node resource, and if any other build 
is going to publish it waits until all resources are free.

-- 
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/fb1b0b1e-f672-4b6d-809f-c0f6a9931477%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to