Old PreLoad.py (5.2) is not compatible with Deadline 6.1?

I had all my PreLoad.py scripts written in IronPython, but they’re throwing a ton of errors now in Deadline 6.1.

Is IronPython not being supported anymore in Deadline? Or if so, what is the best way to get around this issue?

Also, I noticed the introduction of JobPreLoad.py and TaskPreLoad.py, the PreLoad.py script can be considered as JobPreLoad.py, correct?

Thanks.

Hi Lukas,
Yep, a few things have changed between v5 -> v6. Let’s see if I can run through them here:

IronPython has been dropped in favour of CPython v2.6:
thinkboxsoftware.com/deadlin … toverview/
You can still use .NET Libraries, no change there.

Global Functions have been removed and instead embedded into a more relevant class for each function:
thinkboxsoftware.com/deadlin … ne.C2.AE_5

Migrate Application Plugins from v5 -> v6 essential info here:
thinkboxsoftware.com/deadlin … ne.C2.AE_5
“Deprecated Mode” mode might be of use to you whilst you transition over to the v6 architecture.

Event Plugins from v5 -> v6 essential info here:
thinkboxsoftware.com/deadlin … ne.C2.AE_5

Monitor Scripts from v5 -> v6 essential info here:
thinkboxsoftware.com/deadlin … ne.C2.AE_5

Job Scripting essential info here:
thinkboxsoftware.com/deadlin … ne.C2.AE_5

Web Service Scripting essential info here:
thinkboxsoftware.com/deadlin … ne.C2.AE_5

Note the addition of both a new Standalone CPython API package & a RESTful http API - both new in v6.1. More v6.1 info here:
thinkboxsoftware.com/deadlin … ar-videos/

and 3dsMax Jigsaw fun here:
thinkboxsoftware.com/3ds-max … region-re/

You now have both “JobPreLoad.py” & “PluginPreLoad.py” functionality:
thinkboxsoftware.com/deadlin … -_Optional
PluginPreLoad is executed first and then followed by JobPreLoad. More info in the link above.

Feel free to show any specific errors & related code and we can help fix/advise what is wrong between v5 -> v6 transition. It can feel like a lot has changed/broken between the 2 x versions, but it was limited to the absolute minimum and it does put us in a very strong position for the future and with that, a few changes did need to take place.

(You may also be interested in v6.2 beta, which is now very close to being production ready, as it includes a shed load of more cool stuff) :slight_smile:

Regards,
Mike

Wow, thanks Mike!

I’ve read a few of the docs as I had to, since I’m basically re-writing my tools here. :smiley: but I’ll dive into your liks as well.

Thanks again, man, much appretiated!

Regarding what I had problems with, well, it started with the import of: from System import Environment as env throwing an error “Unknown class System” :smiley:

My sync tools were based on IPy code where I first compared target and source files if there was a difference, if there was one, I overwrote them. Saved me a TON of traffic and time on my render farm.

I guess I’ll have to re-write this in CPy, which shouldn’t be such a problem, but it’s a bit time consuming and I just wanted to render a few things on my farm today. :slight_smile:

Ok, so here goes. :slight_smile:

I’m starting to re-write the PreLoad.py for Deadline 6.1 and I’m starting slowly.

All I want to do right now is to set the PATH env. var like I used to in 5.2:

[code]import sys
from Deadline import Scripting
from Deadline import Plugins

dirsToSync = {
r’\rammstein\LiveSync\studioTools\3ds Max’:r’C:\duber\3ds Max’,
r’\rammstein\LiveSync\studioTools\Shotgun’:r’C:\duber\Shotgun’,
}

def main(*args):

maxVersion = Plugins.PluginConfig.GetIntegerConfigEntry( "Version" )

if maxVersion == 2009:
	Scripting.DirectoryUtils.AddToPath(r'C:\duber\3ds Max\2009_x64\dlls')
if maxVersion == 2010:
	Scripting.DirectoryUtils.AddToPath(r'C:\duber\3ds Max\2010_x64\dlls')
if maxVersion == 2011:
	Scripting.DirectoryUtils.AddToPath(r'C:\duber\3ds Max\2011_x64\dlls')
if maxVersion == 2013:
	Scripting.DirectoryUtils.AddToPath(r'c:\duber\3ds Max\2013_x64\dlls')
if maxVersion == 2014:
	Scripting.DirectoryUtils.AddToPath(r'C:\duber\3ds Max\2014_x64\dlls')[/code]

However, I’m getting constatly such errors:

=======================================================
Error
=======================================================
Error in StartJob: Plugin preload script "C:\Users\loocas\AppData\Local\Thinkbox\Deadline6\slave\VFX01\plugins\536669c9170b1b0784d17ce8\PluginPreLoad.py": Python Error: TypeError : No method matches given arguments (Python.Runtime.PythonException)
Stack Trace: 
['  File "none", line 39, in __main__\n']
 (System.Exception)
   at FranticX.Scripting.PythonNetScriptEngine.HandlePythonError(Exception e)
   at FranticX.Scripting.PythonNetScriptEngine.CallFunction(String functionName, PyObject[] args)
   at Deadline.Scripting.DeadlineScriptManager.CallFunction(String scopeName, String functionName)
   at Deadline.Plugins.ScriptPlugin.InitializeLocalScope(String scopeName, String scriptName, String scriptFile)
   at Deadline.Plugins.ScriptPlugin.InitializeLocalScope(String scopeName, String scriptName, String scriptFile)
   at Deadline.Plugins.ScriptPlugin.InitializeLocalPlugin(Job job)
   at Deadline.Plugins.ScriptPlugin.StartJob(Job job, String& outMessage, AbortLevel& abortLevel)

=======================================================
Type
=======================================================
RenderPluginException

=======================================================
Stack Trace
=======================================================
   at Deadline.Plugins.Plugin.StartJob(Job job)
   at Deadline.Slaves.SlaveRenderThread.RenderCurrentTask(TaskLogWriter tlw)

=======================================================
Full Log
=======================================================
0: Task timeout is disabled.
0: Loaded job: test 6 (536669c9170b1b0784d17ce8)
0: INFO: Executing plugin preload script: C:\Users\loocas\AppData\Local\Thinkbox\Deadline6\slave\VFX01\plugins\536669c9170b1b0784d17ce8\PluginPreLoad.py


=======================================================
Details
=======================================================
Date: 05/04/2014 18:26:08
Frames: 1
Elapsed Time: 00:00:00:02
Job Submit Date: 05/04/2014 18:24:41
Job User: loocas
Average RAM Usage: 3488783104 (28%)
Peak RAM Usage: 3488788480 (28%)
Average CPU Usage: 1%
Peak CPU Usage: 4%

=======================================================
Slave Information
=======================================================
Slave Name: VFX01
Version: v6.1.0.54665 R
Operating System: Windows 7 Professional (SP1)
Machine User: loocas
IP Address: 192.168.0.111
MAC Address: 00:1F:D0:DC:0B:71
CPU Architecture: x64
CPUs: 8
CPU Usage: 2%
Memory Usage: 3.2 GB / 12.0 GB (27%)
Free Disk Space: 1.024 TB (1.996 GB on C:\, 122.373 GB on D:\, 923.882 GB on E:\)
Video Card: NVIDIA GeForce GTX 285

Could you please let me know what is exactly bothering Deadline about my code? I’m having the scripting documentation open on the other monitor at all times and I can honestly say I have no idea why is Deadline 6 still complaining about this.

Thank you!

Looks like it is having a problem with line: #39

Stack Trace: [' File "none", line 39, in __main__\n']

However, your example script code was only the first 23 lines, so I can’t see what might be the issue :wink:
The only thing I noticed is the comma “,” at the end of the last dict entry doesn’t need to be there, but otherwise the code looks fine.

Sorry, I removed the comments.

This is the line it’s having problems with:

maxVersion = Plugins.PluginConfig.GetIntegerConfigEntry( "Version" )

Ah, gotcha.

The 3dsmax.py plugin file has a good example of it’s use:
self.LoadMaxTimeout = self.Plugin.GetIntegerConfigEntryWithDefault( “LoadMaxTimeout”, 1000 )

This should work in your example:

from Deadline.Plugins import * maxVersion = self.Plugin.GetIntegerConfigEntry( "Version" )

I’m sorry, but that doesn’t make any sense! Why should I be accessing the variable/namespace “self” ? That’s not being used anywhere in the script and it is not inside a class.

Also, I am already importing the Plugins module and then referencing it in my script:

[code]
from Deadline import Plugins

maxVersion = Plugins.PluginConfig.GetIntegerConfigEntry( “Version” )[/code]

I’ll give it a go, but I’d be very, very surprised if it worked and if it does, your Python scripting is seriously broken in Deadline. :smiley:

Hi,
Sorry about that! So, just need to check a couple of things here. The “Version” key is in the Deadline Plugin Info and not the Config Info in the 3dsMax plugin or have you added a custom “Version” key to your Plugin Configuration? Are you wanting to use a Plugin or Job PreLoad.py script?

Saving this as a “JobPreLoad.py” file into your 3dsMax plugin directory works for me:

[code]from Deadline.Plugins import *

def main( deadlinePlugin ):

maxVersion = deadlinePlugin.GetIntegerPluginInfoEntry( "Version" )

if maxVersion == 2014:
	print "Max 2014"
else:
	print "other version"[/code]

Just as I suspected :slight_smile:

[code]=======================================================
Error

Error in StartJob: Plugin preload script “C:\Users\loocas\AppData\Local\Thinkbox\Deadline6\slave\VFX01\plugins\5366c2ab170b1b0784d17d15\PluginPreLoad.py”: Python Error: NameError : global name ‘self’ is not defined (Python.Runtime.PythonException)
Stack Trace:
[’ File “none”, line 40, in main\n’]
(System.Exception)
at FranticX.Scripting.PythonNetScriptEngine.HandlePythonError(Exception e)
at FranticX.Scripting.PythonNetScriptEngine.CallFunction(String functionName, PyObject[] args)
at Deadline.Scripting.DeadlineScriptManager.CallFunction(String scopeName, String functionName)
at Deadline.Plugins.ScriptPlugin.InitializeLocalScope(String scopeName, String scriptName, String scriptFile)
at Deadline.Plugins.ScriptPlugin.InitializeLocalScope(String scopeName, String scriptName, String scriptFile)
at Deadline.Plugins.ScriptPlugin.InitializeLocalPlugin(Job job)
at Deadline.Plugins.ScriptPlugin.StartJob(Job job, String& outMessage, AbortLevel& abortLevel)[/code]

AH!!! Yes! That might be it, the PluginPreLoad.py might not have any clue about the plugin’s settings! I’ll try the JobPreLoad.py to see if it makes any difference.

Ok, nothing works for me :frowning: Not even your variant of the code.

Error in StartJob: Job preload script "C:\Users\loocas\AppData\Local\Thinkbox\Deadline6\slave\VFX01\plugins\5366c533170b1b0784d17d19\JobPreLoad.py": Python Error: AttributeError : deadlinePlugin (Python.Runtime.PythonException) Stack Trace: [' File "none", line 39, in __main__\n'] (System.Exception) at FranticX.Scripting.PythonNetScriptEngine.HandlePythonError(Exception e) at FranticX.Scripting.PythonNetScriptEngine.CallFunction(String functionName, PyObject[] args) at Deadline.Scripting.DeadlineScriptManager.CallFunction(String scopeName, String functionName, PyObject[] args) at Deadline.Plugins.ScriptPlugin.PreLoadJob(String scriptFilename) at Deadline.Plugins.ScriptPlugin.PreLoadJob(String scriptFilename) at Deadline.Plugins.ScriptPlugin.StartJob(Job job, String& outMessage, AbortLevel& abortLevel)

All I want to get is the version of the plugin, that was submitted. In this case 3ds Max.

I used to get it, easily, in Deadline 5.2 with this code:

maxVersion = GetIntegerPluginInfoEntry("Version")

But modifying it to Deadline’s 6.1 classes approach like this:

[code]
from Deadline import Plugins

maxVersion = Plugins.DeadlinePlugin.GetIntegerPluginInfoEntry(“Version”)[/code]

I’m still getting this weird error:

Error in StartJob: Job preload script "C:\Users\loocas\AppData\Local\Thinkbox\Deadline6\slave\VFX01\plugins\5366c68f170b1b0784d17d1b\JobPreLoad.py": Python Error: TypeError : No method matches given arguments (Python.Runtime.PythonException)

[code]def main( deadlinePlugin ):

maxVersion = deadlinePlugin.GetIntegerPluginInfoEntry( "Version" )

if maxVersion == 2014:
	print "Max 2014"[/code]

We return the actual pluginObject currently being used by the Deadline plugin in the first line

def __main__( deadlinePlugin ):

and can then query it for information. We don’t actually need to use any “Deadline.Plugins” functions for this particular line of code. So we just need to say:

maxVersion = deadlinePlugin.GetIntegerPluginInfoEntry( "Version" )

I’m sorry, I’m still confused, the “deadlinePlugin” variable is what? Where? The documentation mentions “DeadlinePlugin” variable (camel case) and I don’t really see the difference it should make.

I mean, the documentation clearly states this:

int Deadline.Plugins.DeadlinePlugin.GetIntegerConfigEntry ( string key )

When I use this line I’m getting the errors I’ve mentioned. This shouldn’t be. Either the documentation is wrong, the module is wrong or I am doing something not really that obvious to mee that is tripping Deadline’s CPython.

Hi,
You can use a capital letter “D” if you so wish:

[code]def main( DeadlinePlugin ):

maxVersion = DeadlinePlugin.GetIntegerPluginInfoEntry( "Version" )[/code]

Our online docs have an example which might help to explain what is happening here:
thinkboxsoftware.com/deadlin … -_Optional

“The only requirement for the PreJobLoad.py script is that you define a main function, which is called by the Slave when it executes the script. It must accept a single parameter, which is the current instance of the DeadlinePlugin class.”

AHA! Now it makes sense.

I didn’t read the last, important, note about the class instancing and I just blindly copied my code from Deadline 5.2, this makes a lot of sense actually.

Thank you, I’ll give it a try when I’m done rendering the current job.

Hey Mike, I’m back again, with the very same bloody problem.

I used your script:

[code]import sys, os
from Deadline import Scripting, Plugins

dirsToSync = {
r’\rammstein\LiveSync\studioTools\3ds Max’:r’C:\duber\3ds Max’,
r’\rammstein\LiveSync\studioTools\Shotgun’:r’C:\duber\Shotgun’,
}

def main(DeadlinePlugin):

maxVersion = DeadlinePlugin.GetIntegerPluginInfoEntry("Version")

if maxVersion == 2009:
	Scripting.DirectoryUtils.AddToPath(r'C:\duber\3ds Max\2009_x64\dlls')
if maxVersion == 2010:
	Scripting.DirectoryUtils.AddToPath(r'C:\duber\3ds Max\2010_x64\dlls')
if maxVersion == 2011:
	Scripting.DirectoryUtils.AddToPath(r'C:\duber\3ds Max\2011_x64\dlls')
if maxVersion == 2013:
	Scripting.DirectoryUtils.AddToPath(r'c:\duber\3ds Max\2013_x64\dlls')
if maxVersion == 2014:
	os.environ['DUBERPYTHONPATH'] = r'C:\duber\IronPython262\duberPython.dll'
	os.environ['DUBERPYTHONCLR4PATH'] = r'C:\duber\IronPython273\duberPython.dll'
	os.environ['DUBERPYTHONLICENSE'] = r'C:\duber\3ds Max\2014_x64\startup_scripts\duberPython_license.ini'
	os.environ['IRONPYTHON27PATH'] = r'C:\duber\Python273;C:\duber\Python273\DLLs;C:\duber\Python273\Lib;C:\duber\Python273\Lib\site-packages;C:\duber\IronPython273;C:\duber\IronPython273\DLLs;C:\duber\IronPython273\Lib;C:\duber\IronPython273\Lib\site-packages'
	os.environ['SHOTGUNPATH'] = r'C:\duber\Shotgun;C:\duber\Shotgun\3.0.14;C:\duber\Shotgun\3.0.14\Lib;C:\duber\Shotgun\3.0.14\Lib\httplib2;C:\duber\Shotgun\3.0.14\Lib\simplejson'
	
	Scripting.DirectoryUtils.AddToPath(r'C:\duber\3ds Max\2014_x64\dlls')[/code]

This is my entire PluginPreLoad.py right now.

But I’m still getting this ridiculously annoying error:

=======================================================
Error
=======================================================
Error in StartJob: Plugin preload script "C:\Users\loocas\AppData\Local\Thinkbox\Deadline6\slave\VFX01\plugins\537494b6170b1b087438983d\PluginPreLoad.py": Python Error: TypeError : __main__() takes exactly 1 argument (0 given) (Python.Runtime.PythonException)
Stack Trace: 

 (System.Exception)
   at FranticX.Scripting.PythonNetScriptEngine.HandlePythonError(Exception e)
   at FranticX.Scripting.PythonNetScriptEngine.CallFunction(String functionName, PyObject[] args)
   at Deadline.Scripting.DeadlineScriptManager.CallFunction(String scopeName, String functionName)
   at Deadline.Plugins.ScriptPlugin.InitializeLocalScope(String scopeName, String scriptName, String scriptFile)
   at Deadline.Plugins.ScriptPlugin.InitializeLocalScope(String scopeName, String scriptName, String scriptFile)
   at Deadline.Plugins.ScriptPlugin.InitializeLocalPlugin(Job job)
   at Deadline.Plugins.ScriptPlugin.StartJob(Job job, String& outMessage, AbortLevel& abortLevel)

=======================================================
Type
=======================================================
RenderPluginException

=======================================================
Stack Trace
=======================================================
   at Deadline.Plugins.Plugin.StartJob(Job job)
   at Deadline.Slaves.SlaveRenderThread.RenderCurrentTask(TaskLogWriter tlw)

=======================================================
Full Log
=======================================================
0: Task timeout is disabled.
0: Loaded job: test (537494b6170b1b087438983d)
0: INFO: Executing plugin preload script: C:\Users\loocas\AppData\Local\Thinkbox\Deadline6\slave\VFX01\plugins\537494b6170b1b087438983d\PluginPreLoad.py


=======================================================
Details
=======================================================
Date: 05/15/2014 12:19:58
Frames: 1
Elapsed Time: 00:00:00:02
Job Submit Date: 05/15/2014 12:19:33
Job User: loocas
Average RAM Usage: 2712946944 (22%)
Peak RAM Usage: 2712948736 (22%)
Average CPU Usage: 2%
Peak CPU Usage: 6%

=======================================================
Slave Information
=======================================================
Slave Name: VFX01
Version: v6.1.0.54665 R
Operating System: Windows 7 Professional (SP1)
Machine User: loocas
IP Address: 192.168.0.111
MAC Address: 00:1F:D0:DC:0B:71
CPU Architecture: x64
CPUs: 8
CPU Usage: 0%
Memory Usage: 2.5 GB / 12.0 GB (21%)
Free Disk Space: 1.023 TB (1.791 GB on C:\, 122.373 GB on D:\, 923.882 GB on E:\)
Video Card: NVIDIA GeForce GTX 285

Any more tips? How do you use PluginPreLoad.py? I can’t get it to work at all!

Either there is an error or a typo or something in the fu***** documentation, or I am a moron. I really don’t know what is Deadline complaining about…

Modifying my code to EXACTLY this code

throws this error:

[code]=======================================================
Error

Error in StartJob: Plugin preload script “C:\Users\loocas\AppData\Local\Thinkbox\Deadline6\slave\VFX01\plugins\53749761170b1b0874389843\PluginPreLoad.py”: Python Error: TypeError : main() takes exactly 1 argument (0 given) (Python.Runtime.PythonException)
Stack Trace:

(System.Exception)
at FranticX.Scripting.PythonNetScriptEngine.HandlePythonError(Exception e)
at FranticX.Scripting.PythonNetScriptEngine.CallFunction(String functionName, PyObject args)
at Deadline.Scripting.DeadlineScriptManager.CallFunction(String scopeName, String functionName)
at Deadline.Plugins.ScriptPlugin.InitializeLocalScope(String scopeName, String scriptName, String scriptFile)
at Deadline.Plugins.ScriptPlugin.InitializeLocalScope(String scopeName, String scriptName, String scriptFile)
at Deadline.Plugins.ScriptPlugin.InitializeLocalPlugin(Job job)
at Deadline.Plugins.ScriptPlugin.StartJob(Job job, String& outMessage, AbortLevel& abortLevel)[/code]

Hi,
You need to rename the “PluginPreLoad.py” to “JobPreLoad.py”, as the “JobPreLoad” will be able to access the 3dsMax Plugin properties, whilst the PluginPreLoad hasn’t yet loaded the Plugin, so doesn’t know if your using the 3dsMax plugin or any other plugin. The PluginPreLoad is really only useful for messing with the Python environment. The docs give a bit more info:

thinkboxsoftware.com/deadlin … -_Optional
The PluginPreLoad.py file is an optional script that will be executed by the Slave prior to executing any python script for the plug-in (MyPlugin.py or JobPreLoad.py), and any pre or post job or task script for the current job. Note that in this case, the file does not share its name with the plug-in folder. This script can be used to set up the Python environment prior to running any other python script, including setting sys.path to control where additional modules will be loaded from.

Hope this helps!
Mike

I am indeed a moron. :slight_smile:

Thank you very much for all your help and patience mainly :slight_smile: Of course it’s working in the JobPreLoad.py script.

Thank you man, I really appretiate it.