Submitting job to specific slave in maxscript

I have a maxscript based on the example deadline show on the website.

I only have two slaves, one of which is my workstation, is it possible in maxscript to send a job to a specific slave?

As it seems to always sent it to the local workstation first, i would like to send it to the second slave so as not to stop me using the workstation, I know i can go the monitor and disable it there manually, but would like to automate this if possible.

In maxscript Im also trying to display the current state of the slaves in my rollout, i can get the info from the ini file and this displays ok, but this only seem to update when i run the submit to deadline script and click on limits, is there a better way?

Im new to scripting so would like to do this with maxscript if possible as opposed to python which i know nothing about yet.

thanks

Andy

You could set the While/Black List property just like the SMTD UI lets you.

If you are using our SMTDFunctions.CreateSubmitInfoFile() function to create the Submit Info File, then the properties you are interested in are:

SMTDSettings.SlavesBlackList=false --when set to false, it is a White list, and any Slave names you provide will be enabled to render the job SMTDSettings.SlavesList=#("SlaveName123") --if you want to render only on slave named "SlaveName123", provide its name in the array.

If you want to allow multiple slaves to render, you can list them in the array, e.g.

SMTDSettings.SlavesList=#("SlaveName123","SomeOtherMachine","MyWorkstation")

If you change the SMTDSettings.SlavesBlackList=true, then the listed slaves will be blacklisted and will be disallowed to render, all other unlisted machines will be allowed to render.

So in your case, it might be easier to use

SMTDSettings.SlavesBlackList=true --make it a black list SMTDSettings.SlavesList=#(sysinfo.computername) --black list only your workstation, assuming the slave name matches the Windows computer name

For the status display, the info in the SMTD UI is pulled from the file

theSlaveInfoFile = (SMTDPaths.SettingsDir + "slaveselectionsets\\slavesinfo.ini" )

which is created by calling the function

SMTDFunctions.CollectSlavesInfo()

So if you are already reading from that INI file, you just need to call the above function to update the info. With only two slaves, it should be rather quick…

wow, thanks for the reply, this gives me a lot to go with, will let you know how i go

Andy

The refresh the servers to check the state is working perfect with the SMTDFunctions.CollectSlavesInfo()

However, If i run this and check the SMTDSettings.SlavesBlackList is true and the server selected is in the SMTDSettings.SlavesList, but i don’t understand why my render still submits to both render nodes, any ideas what i am missing? do i need to save the values to the ini file before submitting the render? if so how would i do this?

– Deadline information saved to ini file
SMTDFunctions.CollectSlavesInfo()
theSlaveInfoFile = (SMTDPaths.SettingsDir + “slaveselectionsets\slavesinfo.ini” )
renderNodeNames = getINISetting (SMTDPaths.SettingsDir + “slaveselectionsets\slavesinfo.ini” )
SMTDSettings.SlavesBlackList=true
SMTDSettings.SlavesList=#()

_slaveNodeSelected = #()

for i = 1 to renderNodeNames.count do
(
_slaveNodeSelected[i] = renderNodeNames[i]
)

try(destroydialog _SubmitRender) catch()
rollout _SubmitRender “Submit Render To DeadLine”
(
group “Render Node To WhiteList”
(
listbox _RNodes “” items:_slaveNodeSelected height:3
button _RNode_Button “Select”
button _RNode_Reset “Reset”
on _RNode_Button pressed do
(
SMTDSettings.SlavesList = _RNodes.selected
print (SMTDSettings.SlavesList)
)
on _RNode_Reset pressed do
(
SMTDSettings.SlavesList = #()
print “Reset”
)
)
)
createdialog _SubmitRender width: 200

There are two problems I can see in your script - one is an actual bug that could crash SMTD UI, and the other is a logical issue.

When setting the list, you need to create an ARRAY, so the event handler of the Select button would need to be

on _RNode_Button pressed do ( SMTDSettings.SlavesList = #(_RNodes.selected) --> note the #() surrounding the name of the slave print (SMTDSettings.SlavesList) )

The logical issue is that the UI you wrote claims to be setting the Whitelist, but in fact it is defining the Blacklist. So the node you are selecting is the one that will NOT render. This is what SMTDSettings.SlavesBlackList=true defines. When it is true, the SMTDSettings.SlaveList is used as a Black List. When set to false, it is used as a White List.

The first error did not crash the SMTDFunctions function writing the JOB file because the relevant code there is

if SMTDSettings.SlavesList.count > 0 do ( local theKeyword = if SMTDSettings.SlavesBlackList then "Blacklist" else "Whitelist" local theSlaveListString = "" for i = 1 to SMTDSettings.SlavesList.count-1 do theSlaveListString += SMTDSettings.SlavesList[i] + "," theSlaveListString += SMTDSettings.SlavesList[SMTDSettings.SlavesList.count] format "%=%\n" theKeyword theSlaveListString to:submitInfoFile )
So the IF statement checks SMTDSettings.SlavesList.count > 0, so it is checking the number of characters in the string you assigned because it was not an array. When a variable contains a string instead of an array, MAXScript can access the individual characters of the string as array elements.
As result, the Blacklist would have been set to the name of the slave, split into characters delimited by commas. E.g., if the slave was called “MySlave01”, the output to the JOB file would look like

Blacklist=M,y,S,l,a,v,e,0,1

Since none of these letters represents an actual slave to blacklist, and you are defining a Black list instead of a White list, all actual slaves were technically WHITE LISTED :slight_smile: Had you flipped the setting to SMTDSettings.SlavesBlackList=false, then NONE of your machines would have been used because the Whitelist would have been set to M,y,S,l,a,v,e,0,1…

Hopefully fixing the above problems will make the script work as you expect it to!

thanks for the help, putting the brackets round to create the array did the trick :wink:

SMTDSettings.SlavesList = #(_RNodes.selected)