Hi, I am trying to do a simply slave script (just to get me started and slave scripting in python)
I can’t seem to be able to loop through the selected slaves… I even added a simple loop that add numbers to the ouput just to test a basic loop… but no success
What am I doing wrong?
What I want to is simply display some value of the selected slaves (the macadress in this case)
from Deadline.Scripting import *
def main( *args ):
scriptDialog = DeadlineScriptEngine.GetScriptDialog()
slavesSelected = SlaveUtils.GetSelectedSlaveNames()
output = ( 'num selected slaves: ' + str(len(slavesSelected)) + '' )
for j in range(5):
ouput = output + str(j)
for i in range(len(slavesSelected)):
ouput = ( output + str(i) + "" )
ouput = ( output + SlaveUtils.GetSlaveInfoValue(SlaveUtils.GetSelectedSlaveName(i), "MacAddress") + '\r\n' )
ouput = ( output + SlaveUtils.GetSelectedSlaveName(i) + '\r\n' )
scriptDialog.ShowMessageBox( output, "Results" )
Hi Sylvain,
I noticed a typo:
ouput = output + str(j)
should be:
output = output + str(j)
This occurs a couple of times, and may be the cause of your problems (can’t be for sure though without seeing the error message you’re getting). Anyway, tested out this code, and it seemed to work fine:
from Deadline.Scripting import *
def __main__( *args ):
scriptDialog = DeadlineScriptEngine.GetScriptDialog()
slavesSelected = SlaveUtils.GetSelectedSlaveNames()
output = ( 'num selected slaves: ' + str(len(slavesSelected)) + '' )
for j in range(5):
output = output + str(j)
for i in range(len(slavesSelected)):
output = ( output + str(i) + "" )
output = ( output + SlaveUtils.GetSlaveInfoValue(SlaveUtils.GetSelectedSlaveName(i), "MacAddress") + '\r\n' )
output = ( output + SlaveUtils.GetSelectedSlaveName(i) + '\r\n' )
scriptDialog.ShowMessageBox( output, "Results" )
I created a folder called ‘SylvainTest’ in \my\repository\scripts\Slaves, and saved the code above to ‘SylvainTest.py’ inside this folder. Alongside ‘SylvainTest.py’, I created ‘SylvainTest.ini’ that contains the following:
Label=Sylvain Test
Multiselect=True
Testing with this setup seems to work fine. Hopefully this helps!
Cheers,
ho the shame!!! It hurts! It burns!
Thanks for fixing a stupid typo