Is there a way to specify a group and/or pool for a slave when it is launched from the command line? We’re running ‘deadlineslave -nogui’ to launch the slave daemon, in a cloud-like situation where the slave nodes have semi-dynamic hostnames. At the moment, the render nodes show up, but have to be manually added into groups / pools after the fact. Would be great to automate.
so when a slave starts up we check its os, and assign it to the correct os group, snippet:
def GetDeadlineEventListener():
return slave_onSlaveStartListener()
def CleanupDeadlineEventListener(eventListener):
eventListener.Cleanup()
###############################################################
# The event listener class.
###############################################################
class slave_onSlaveStartListener(DeadlineEventListener):
'''
When a slave starts on dealine, if it contains some of the key words in its description, deal with them
accordingly.
'''
def __init__(self):
self.OnSlaveStartedCallback += self.OnSlaveStarted
def Cleanup(self):
del self.OnSlaveStalledCallback
def OnSlaveStarted(self, slave_name):
self.LogInfo("OnSlaveStarted:: Running Event: slave has just started.")
slave_settings = RepositoryUtils.GetSlaveSettings(slave_name, True)
other_os = 'win'
cur_os = 'lin'
if SystemUtils.IsRunningOnWindows():
other_os = 'lin'
cur_os = 'win'
# remove the groups from the previous os.
groups_to_add = []
for group in current_groups:
if group.endswith(other_os):
current_groups.remove(group)
groups_to_add.append(group.replace(other_os, cur_os))
current_groups.extend(groups_to_add)
# remove dups
current_groups = list(set(current_groups))
if not current_groups == orig_groups:
# set the new groups
self.LogInfo("OnSlaveStarted:: new slave groups:: %s " % current_groups)
self.LogInfo("OnSlaveStarted:: slave_settings.SetSlaveGroups")
slave_settings.SetSlaveGroups(current_groups)
self.LogInfo("OnSlaveStarted:: RepositoryUtils.SaveSlaveSetting")
RepositoryUtils.SaveSlaveSettings(slave_settings)
# update the current slavesettings.
This chuck of code is not pretty, but i can add further help to it later.
we went through a dual boot phase were a machine would boot up with the same host name/machine name , so we needed to change its os group from win to lin .
You can add far more logic to this, if you were to setup rules for gpus’s and cpu specs to add different groups/ pools even.
By doing it at the slave startup, it configures the slave before any jobs are dequeued to it.
Wanted to follow up to say that this worked out. There was a little finickiness in the setup, but the examples and the documentation got us there.
Now… is there a way to add a slave to the ‘Master Slave List’ of a License Limit, or all the License Limits, when a Slave launches? We’re running into a situation where new slaves don’t respect License Limits created before a Slave is launched.