[Deadline scripting] - Accessing Slave Properties

Discussion and Support of Deadline, the Render Management System
Berkyjay
Posts: 531
Joined: Mon Jul 29, 2013 3:14 pm

[Deadline scripting] - Accessing Slave Properties

Postby Berkyjay » Mon May 15, 2017 1:20 pm

I'm trying to access the slave properties to query and change them. But I can't find anything in the API that allows this via a Monitor script. Could someone point me in the right direction?

Thanks
James Berkheimer
Technical Director
Viscira

kwatts
Posts: 51
Joined: Tue Mar 01, 2016 10:34 am

Re: [Deadline scripting] - Accessing Slave Properties

Postby kwatts » Mon May 15, 2017 1:37 pm

if your in the monitor and you want to get of the current slave selection:

Code: Select all

slave_info =MonitorUtils.GetSelectedSlaveInfoSettings()
slave_settings = MonitorUtils.GetSelectedSlaveSettings()


if your in an event or monitor script and you know the slave_name:

Code: Select all

slave_settings = RepositoryUtils.GetSlaveSettings(slave_name, True)
slave_info = RepositoryUtils.GetSlaveInfo(slave_name, True)


Hope this helps.
Cheers
Kym

Berkyjay
Posts: 531
Joined: Mon Jul 29, 2013 3:14 pm

Re: [Deadline scripting] - Accessing Slave Properties

Postby Berkyjay » Mon May 15, 2017 4:35 pm

kwatts wrote:if your in the monitor and you want to get of the current slave selection:

Code: Select all

slave_info =MonitorUtils.GetSelectedSlaveInfoSettings()
slave_settings = MonitorUtils.GetSelectedSlaveSettings()


if your in an event or monitor script and you know the slave_name:

Code: Select all

slave_settings = RepositoryUtils.GetSlaveSettings(slave_name, True)
slave_info = RepositoryUtils.GetSlaveInfo(slave_name, True)


Hope this helps.
Cheers
Kym


I've tried those out but I'm not getting any info back from the MonitorUtils and from the RepositoryUtils I'm getting back a "SlaveSettings" object that I'm not sure what to do with. I really wish I could get autocomplete functionality with the Python API in deadline to help out with this kind of issue. :(


Oh and here is my test code:

Code: Select all

from System.IO import *
from Deadline.Scripting import *
from Deadline.Jobs import *
from DeadlineUI.Controls.Scripting.DeadlineScriptDialog import DeadlineScriptDialog


def __main__():   
    print ("----")
    print ("RepositoryUtils.GetSlaveInfoSettings(selectedSlave[0], True)")
    selectedSlave = MonitorUtils.GetSelectedSlaveNames()
    for i in RepositoryUtils.GetSlaveInfoSettings(selectedSlave[0], True):
        print i.Settings
       
    print ("----")
    print ("MonitorUtils.GetSelectedSlaveSettings()")
    for i in MonitorUtils.GetSelectedSlaveSettings():
        print i
   
    print ("----")
    print ("MonitorUtils.GetSelectedSlaveInfoSettings()")
    for i in MonitorUtils.GetSelectedSlaveInfoSettings():
        print i
James Berkheimer
Technical Director
Viscira

Berkyjay
Posts: 531
Joined: Mon Jul 29, 2013 3:14 pm

Re: [Deadline scripting] - Accessing Slave Properties

Postby Berkyjay » Mon May 15, 2017 4:38 pm

Also, for some further context if it helps. The info I'm trying to get is the Slave Description and Comment box values.

Properties.JPG
Properties.JPG (26.51 KiB) Viewed 111 times
James Berkheimer
Technical Director
Viscira

kwatts
Posts: 51
Joined: Tue Mar 01, 2016 10:34 am

Re: [Deadline scripting] - Accessing Slave Properties

Postby kwatts » Mon May 15, 2017 4:57 pm

Hello,

I have adjusted your script:

Code: Select all


from System.IO import *
from Deadline.Scripting import *
from Deadline.Jobs import *
from DeadlineUI.Controls.Scripting.DeadlineScriptDialog import DeadlineScriptDialog


def __main__():   
   print ("----")

   selectedSlaves = MonitorUtils.GetSelectedSlaveNames()

   for slave_name in selectedSlaves:

      print 'got:', slave_name
      slave_settings = RepositoryUtils.GetSlaveSettings(slave_name, True)
      #
      print 'SlaveDescription:',slave_settings.SlaveDescription
      print 'SlaveComment :',slave_settings.SlaveComment


output:

Code: Select all

2017-05-15 17:54:25:  PYTHON: ----
2017-05-15 17:54:25:  PYTHON: got: w6201
2017-05-15 17:54:25:  PYTHON: SlaveDescription: i eat frames for lunch
2017-05-15 17:54:25:  PYTHON: SlaveComment : no transcoding



this script i have lives in :
Repolocation/custom/scripts/Slaves/my_sample_script.py

Let me know if you want me to explain this further.
Cheers
Kym

Berkyjay
Posts: 531
Joined: Mon Jul 29, 2013 3:14 pm

Re: [Deadline scripting] - Accessing Slave Properties

Postby Berkyjay » Mon May 15, 2017 5:06 pm

kwatts wrote:Hello,

I have adjusted your script:

Code: Select all


from System.IO import *
from Deadline.Scripting import *
from Deadline.Jobs import *
from DeadlineUI.Controls.Scripting.DeadlineScriptDialog import DeadlineScriptDialog


def __main__():   
   print ("----")

   selectedSlaves = MonitorUtils.GetSelectedSlaveNames()

   for slave_name in selectedSlaves:

      print 'got:', slave_name
      slave_settings = RepositoryUtils.GetSlaveSettings(slave_name, True)
      #
      print 'SlaveDescription:',slave_settings.SlaveDescription
      print 'SlaveComment :',slave_settings.SlaveComment


output:

Code: Select all

2017-05-15 17:54:25:  PYTHON: ----
2017-05-15 17:54:25:  PYTHON: got: w6201
2017-05-15 17:54:25:  PYTHON: SlaveDescription: i eat frames for lunch
2017-05-15 17:54:25:  PYTHON: SlaveComment : no transcoding



this script i have lives in :
Repolocation/custom/scripts/Slaves/my_sample_script.py

Let me know if you want me to explain this further.
Cheers
Kym


Thank you! I was also able to find where in the documentation these methods live for future reference.

http://docs.thinkboxsoftware.com/produc ... 25f6de4bd4
James Berkheimer
Technical Director
Viscira

Berkyjay
Posts: 531
Joined: Mon Jul 29, 2013 3:14 pm

Re: [Deadline scripting] - Accessing Slave Properties

Postby Berkyjay » Mon May 15, 2017 5:20 pm

I actually do have one question. I see in the docs that it says they are Get & Set. But I don't see how to actually set them....which I will need to do as well.
James Berkheimer
Technical Director
Viscira

kwatts
Posts: 51
Joined: Tue Mar 01, 2016 10:34 am

Re: [Deadline scripting] - Accessing Slave Properties

Postby kwatts » Tue May 16, 2017 9:35 am

Hi,

So the ones that are get and set are functions with a Property decorator (*I think*):
https://docs.python.org/2/library/funct ... l#property

You use them like:

A get is done with no arguments:

Code: Select all

slave_desc = slave_settings.SlaveDescription


a set is done by provideding an argument:

Code: Select all

slave_settings.SlaveDescription = "Dedicated playblast machine"


*edit fixed up the set example. copy and pasted from the wrong code ;)

Berkyjay
Posts: 531
Joined: Mon Jul 29, 2013 3:14 pm

Re: [Deadline scripting] - Accessing Slave Properties

Postby Berkyjay » Tue May 16, 2017 10:41 am

kwatts wrote:Hi,

So the ones that are get and set are functions with a Property decorator (*I think*):
https://docs.python.org/2/library/funct ... l#property

You use them like:

A get is done with no arguments:

Code: Select all

slave_desc = slave_settings.SlaveDescription


a set is done by provideding an argument:

Code: Select all

slave_settings.SlaveDescription = "Dedicated playblast machine"


*edit fixed up the set example. copy and pasted from the wrong code ;)



Ahh perfect thanks! So it's basically a Deadline variable not a method.
James Berkheimer
Technical Director
Viscira

Berkyjay
Posts: 531
Joined: Mon Jul 29, 2013 3:14 pm

Re: [Deadline scripting] - Accessing Slave Properties

Postby Berkyjay » Tue May 16, 2017 12:33 pm

Sorry to keep coming back to this well, but I am stumped on one last issue. So the way to set those variables seems to work for the selected slave in the Monitor. But what if I want to set the property for a non-selected slave?

For example, here I am setting the non-selected slaves Groups.

Code: Select all

RepositoryUtils.SetGroupsForSlave("Render01", slaveGroups)


What I am doing is making a script that launches a specified number of slave instances from my selected slave. But I want to give the same properties and attributes of the selected slave to the slave instances.
James Berkheimer
Technical Director
Viscira


Return to “Thinkbox Software - Deadline”

Who is online

Users browsing this forum: No registered users and 1 guest