I'm still not able to use setNumExecutors.  I was able to use setNodeLabel 
though with the following code in script console:

for (slave in jenkins.model.Jenkins.instance.slaves) {
    oldLabelName = slave.getLabelString()
    println("Label= $oldLabelName")

    if (oldLabelName.contains('synth')) {
        println("Found $oldLabelName")
        newLabelName = oldLabelName + " " + "EXTRALABEL"
        slave.setLabelString(newLabelName)
        numexecutors = slave.getNumExecutors()
        println("executors=$numexecutors")
        //slave.setNumExecutors(1)
    }
}

This proved that I can access a slave and modify parts of it (the label), 
but when I uncomment the setNumExecutors line, I get the following error:

groovy.lang.MissingMethodException: No signature of method: 
hudson.slaves.DumbSlave.setNumExecutors() is applicable for argument types: 
(java.lang.Integer) values: [1]
Possible solutions: getNumExecutors(), getNumExecutors()
        at 
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55)
        at 
org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
...

A bit more research and I found this, though I'm not clear on the final 
response from Jesse Glick.
https://issues.jenkins-ci.org/browse/JENKINS-23534

It appears he's saying that modifying the number of executors is possible, but 
you need to replace the whole slave?  Not sure how to do this - it would be a 
lot easier if I could just call setNumExecutors.



-- 
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/2efb7bb6-b61a-47da-9cce-13a97ef9ff26%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to