Convert Deadline 7 Event Plugins to 8


#1

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: 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.


#2

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

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”


#3

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][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]

[code]
###############################################################

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() )[/code]