AWS Thinkbox Discussion Forums

Q: Set custom path to executable with event plugin on submission?

Hi
When we export standalone jobs from either c4d 19, 20 and Houdini 16.5 and 17, we need to set different paths to different versions of the Redshift commandline executable.
We are setting env vars for rs command jobs with an event plugin. Can i modify the executable path somehow from the event plugin context?

Regards
Bonsak

1 Like

I’ve brought up the ModifyCommandLineCallback before (I believe with regard to supporting environment variables) but that will let you change the executable, arguments, and working directory.

You’d just need to be smart about how you did you path replacement.

If it’s not immediately obvious, feel free to ask questions and I’ll help figure it out.

Thanks! If a job has custom environmental variables set, are they sourced before the " `GlobalJobPreLoad.py" script runs?

Regards
Bonsak

Tried to put the example from the dosc you linked to in repo/custom/plugins, but it throws a error i dont understand:

Error
=======================================================
Error: Global job preload script 'C:\Users\bonsak\AppData\Local\Thinkbox\Deadline10\slave\Bonsak-laptop\plugins\5c00592e0145ee1dbc9f55dd\GlobalJobPreLoad.py': TypeError : unsupported operand type(s) for +=: 'instancemethod' and 'function' (FranticX.Scripting.PythonNetException)
  File "C:\Users\bonsak\AppData\Local\Thinkbox\Deadline10\slave\Bonsak-laptop\plugins\5c00592e0145ee1dbc9f55dd\GlobalJobPreLoad.py", line 42, in __main__
    deadlinePlugin.ModifyCommandLineCallback += AlterCommandLine

   at Deadline.Plugins.PluginWrapper.d()
   at Deadline.Plugins.PluginWrapper.StartJob(String& outMessage, AbortLevel& abortLevel)

=======================================================

Regards
Bonsak

Hmm… I wonder if you might have another event or script which is actually setting that value somewhere (using “=” instead of “+=”. You could try and read the name of the function out to get an idea what script had set it:

C:\>python
Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> def hey():
...     print("hey")
...
>>> hey()
hey
>>> f = hey
>>> print(f)
<function hey at 0x03BD61E0>

I tested here with 10.0.21 (I’m a bit behind!) with the following code:

from Deadline.Scripting import *
from FranticX.Diagnostics import *

def AlterCommandLine( executable, arguments, workingDirectory ):
    print "Entering Command Line Hook"

    print "-----Modified Command Line-----"
    print " Executable: '{}'".format( executable )
    print "  Arguments: '{}'".format( arguments )
    print "Working Dir: '{}'".format( workingDirectory )
    print "-------------------------------"

    # return the original or modified exe, args, workingDir even if pipeline not available
    return (executable, arguments, workingDirectory)

def __main__( deadlinePlugin ):
    deadlinePlugin.DebugLogging = True
    deadlinePlugin.ModifyCommandLineCallback += AlterCommandLine

And the output was this guy:

2018-11-30 14:39:23:  0: PYTHON: Entering Command Line Hook
2018-11-30 14:39:23:  0: PYTHON: -----Modified Command Line-----
2018-11-30 14:39:23:  0: PYTHON:  Executable: 'C:\Users\amsler\Downloads\noexit\target\debug\noexit.exe'
2018-11-30 14:39:23:  0: PYTHON:   Arguments: ''
2018-11-30 14:39:23:  0: PYTHON: Working Dir: ''
2018-11-30 14:39:23:  0: PYTHON: -------------------------------

Thanks!
There was a copy of GlobalJobPreload.py in appdata/local/Thinkbox … that was running.
Works fine now.
Im not sure how can i get the env vars from the job in this context?

Regards
Bonsak

Nvm.

job = deadlinePlugin.GetJob()
rsDataPath = job.GetJobEnvironmentKeyValue( "REDSHIFT_COREDATAPATH" )

-b

1 Like
Privacy | Site terms | Cookie preferences