Is it possible to mark slave as offline in a monitor script?

Just doing some tests on a new Monitor script and I’d like to mark a slave as offline. Is this possible? Had a look through the docs, managed to disable selected slaves, but not mark as offline.

[code]from System.IO import *
from System import *
from Deadline.Scripting import *

def main():
selected_slaves = MonitorUtils.GetSelectedSlaveInfos()
for slave in selected_slaves:
slaveSettings = RepositoryUtils.GetSlaveSettings(slave.SlaveName, True)
# Disable the slave
slaveSettings.SlaveEnabled = False
# How to make slave offline?
[/code]

thanks for any pointers…

Hello Dave,

So I have looked into this and what you need to change is the slave info option slavestate from Idle to Offline, and some sample code that would potentially be a start in writing your own code that would do this is posted at github.com/ThinkboxSoftware/Dea … rideIPs.py and the keys here are:

Deadline.Scripting.RepositoryUtils.GetSlaveInfo
Deadline.Scripting.RepositoryUtils.SaveSlaveInfo

I hope this helps.

Cheers,

Dwight

Thanks Dwight, your reply was v helpful.

In case anyone else finds it useful here’s the gist of how to set the slave state:

slave_info = RepositoryUtils.GetSlaveInfo(slave, True)
slave_info.set_SlaveStatus('3')
RepositoryUtils.SaveSlaveInfo(slave_info)

These are the ID’s to set different slave states
0 = Unknown
1 = Rendering
2 = Idle
3 = Offline
4 = Stalled
8 = StartingJob

Also, those set_* functions should be helpers for the properties, so “slave_info.SlaveStatus = ‘3’” should be the same. Splitting hairs :stuck_out_tongue: