Convert Deadline 7 Event Plugins to 8

Use this forum to share your Deadline scripts, plugins, etc. Patches for new software support can also be found here.
JustinB
Posts: 39
Joined: Mon Jan 18, 2016 3:15 pm
Location: Winnipeg MB

Convert Deadline 7 Event Plugins to 8

Postby JustinB » Thu May 12, 2016 5:02 pm

Hello!

I've made a script that can go through and update all your existing custom Event Plugins to match Deadline 8's slightly different formatting.

It deletes the unneeded .dlinit file, and changes the "[Enabled]" property with a "[State]" one.

It's up on our public Github here: https://github.com/ThinkboxSoftware/Dea ... %20Plugins

I've tested it a fair bit, but this comes with no guarantee! If it breaks, let me know and I'll put the fix on the pile of stuff to do.
Justin Blagden
Thinkbox Software

User avatar
im_thatoneguy
Posts: 1785
Joined: Tue May 20, 2008 2:18 pm
Location: Seattle, WA
Contact:

Re: Convert Deadline 7 Event Plugins to 8

Postby im_thatoneguy » Fri Aug 05, 2016 4:43 pm

Getting an error. Can't seem to format it correctly.

Code: Select all

C:\Users\ggreenwalt>py FixuserStuff.py "\\#####\DeadlineRepository8\custom\events\ConfigSlave\"
\\#######\DeadlineRepository8\custom\events\ConfigSlave" doesn't have a dlinit file inside
\\#####\DeadlineRepository8\custom\events\ConfigSlave".param not found


Ahh nevermind you have to do an extra duplicate of the folder\paramFileName ala "\\#####\DeadlineRepository8\custom\events\ConfigSlave\ConfigSlave"
Gavin Greenwalt
Gavin[47]SFStudios.com
im.thatoneguy[47]gmail.com

User avatar
im_thatoneguy
Posts: 1785
Joined: Tue May 20, 2008 2:18 pm
Location: Seattle, WA
Contact:

Re: Convert Deadline 7 Event Plugins to 8

Postby im_thatoneguy » Fri Aug 05, 2016 4:51 pm

Code: Select all

An unexpected error occurred while Saving Event Plugin Settings:
The given key was not present in the dictionary. (Deadline.Plugins.PluginException)
   at Deadline.Events.SandboxedEventManager.a(DeadlineMessage A_0)
   at Deadline.Events.SandboxedEventManager.CheckForUpdates()
   at Deadline.Monitor.WorkItems.SaveEventPluginSettingsWI.InternalDoWork()
   at Deadline.Monitor.MonitorWorkItem.DoWork()


Got this error when enabling the event plugin.


Code: Select all

[State]
Type=Enum
Items=Global Enabled;Opt-In;Disabled
Label=State
Default=Disabled
Description=How this event plug-in should respond to events. If Global, all jobs and slaves will trigger the events for this plugin. If Opt-In, jobs and slaves can choose to trigger the events for this plugin. If Disabled, no events are triggered for this plugin.


[RenderPool]
Type=string
Category=Options
CategoryOrder=0
Index=1
Label=Draft Pool
Default=
Description=The Pool to which Slaves will be added automatically.

[RenderGroup]
Type=string
Category=Options
CategoryOrder=0
Index=2
Label=Draft Group
Default=
Description=The Group to which Slaves will be added automatically.


Code: Select all

###############################################################
## Imports
###############################################################
from System.Diagnostics import *
from System.IO import *
from System import TimeSpan

from Deadline.Events import *
from Deadline.Scripting import *

import re, sys, os, subprocess, traceback, shlex

###############################################################
## This is the function called by Deadline to get an instance of the Draft event listener.
###############################################################
def GetDeadlineEventListener():
    return ConfigSlaveEventListener()

def CleanupDeadlineEventListener( eventListener ):
    eventListener.Cleanup()

###############################################################
## The Draft event listener class.
###############################################################
class ConfigSlaveEventListener (DeadlineEventListener):
    def __init__( self ):
        self.OnSlaveStartedCallback += self.OnSlaveStarted
   
    def Cleanup( self ):
        del self.OnSlaveStartedCallback

   
    ## This is called when the job finishes rendering.
    def OnSlaveStarted( self, slavename ):
        try:
         slaveSettings = RepositoryUtils.GetSlaveSettings(slavename, True)
         if slavename.lower()[0:10] == "render-vm-":

            remotehost="render-" + slavename[-2:] + "-host"
            cmd="getmac /S " + remotehost + " /NH"
            p=subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
            output, errors = p.communicate()
            if output is not None :
               if output != "":
                  item =  output.split("\n")[1].split(" ")[0]
                  slaveSettings.SlaveMacAddressOverride = item
                  RepositoryUtils.SaveSlaveSettings(slaveSettings)
         
         
            RepositoryUtils.AddPoolToSlave(slavename, "urgent")
            RepositoryUtils.AddPoolToSlave(slavename, "global")
            RepositoryUtils.AddGroupToSlave(slavename, "global")
            RepositoryUtils.AddGroupToSlave(slavename, "i7_v01")
            RepositoryUtils.AddGroupToSlave(slavename, "rendernodes")
            
            pmanage = RepositoryUtils.GetPowerManagementOptions()
            pmanage.Groups[0].SlaveNames.Add(slavename)
         
        except:
            ClientUtils.LogText( traceback.format_exc() )
Gavin Greenwalt
Gavin[47]SFStudios.com
im.thatoneguy[47]gmail.com


Return to “Deadline Uploads”

Who is online

Users browsing this forum: No registered users and 2 guests