Event Plugin Problem with Deadline 6

I’ve had a script we’ve used for Deadline 4 and 5 for moving Stitched Images for tile rendering, it’s not working on Deadline 6 and as there’s no error message it’s somewhat difficult to debug, any pointers please?

Rgds

D

[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, shutil
#import Draft

def GetDeadlineEventListener():
return MoveStitchedImages()

###############################################################

The Draft event listener class.

###############################################################
class MoveStitchedImages (DeadlineEventListener):

## This is called when the job finishes rendering.
def OnJobFinished( self, job ):
	ClientUtils.LogText( "Checking job for repathing options..." )
	
	
	for x in range(0,99):
		try:
			inputImage = GetPluginInfoEntry("InputImages" + str(x))
			if inputImage != None:
				#filter the '_tile_1x1_10x10_' out of the name
				t = re.split("_", inputImage)
				b = "_" + t[len(t) - 4] + "_" + t[len(t) - 3] + "_" + t[len(t) - 2] + "_"
				theimage = inputImage.replace(b, "")
				
				thepath = (os.path.split ((os.path.split(theimage))[0]))[0] + "\\" + (os.path.split (theimage))[1]
				outFile = ((os.path.splitext(thepath))[0] + ".tga")
				
				
				shutil.move(theimage, thepath)
				
				#if there are no more files in the folder then lets delete it.
				files = os.listdir((os.path.split(inputImage))[0])
				if len(files) == 0:
					shutil.rmtree((os.path.split(inputImage))[0])
				
		except:
			print "Finished moving Files"
[/code]

You have to hook up a callback in the constructor so that your OnJobFinished function is called:
thinkboxsoftware.com/deadlin … -_Required

This was necessary with Python.NET plugins in Deadline 5, and because Deadline 6 only uses the Python.NET engine now, it’s required for all plugins in Deadline 6.

Also note that the global functions that were available in Deadline 5 have been deprecated (like GetPluginInfoEntry). They have either been replaced by member functions for the DeadlineEventListener class, or by utility functions. In the case of GetPluginInfoEntry, you would just use self.GetPluginInfoEntry instead.

If you enable Deprecated Mode, you’ll be able to use the global functions, but since we won’t be updating these functions or adding new ones, we recommend updating your plugin so that it doesn’t have to run in Deprecated Mode:
thinkboxsoftware.com/deadlin … cated_Mode

Hope this helps!

  • Ryan

Thanks Russell, got that working! :slight_smile:

Just a note, I’ve twice run into problems today with old bits of my Python hacks for Deadline not working in Deadline 6 because of indentation errors, seems like in Deadline 5 indentations were done with tabs and in 6 they are done with spaces. Just an FYI.

Yup, we made this change in Deadline 6 so that our scripts followed the more accepted standard of using spaces instead of tabs.

Cheers,

  • Ryan

I swear that is just for programmers to make themselves seem like they are doing more work by constantly having to hit space 4 times, I can’t possible understand any other reason for it, bugs the hell out of me, this it what tabs were invented for!