Hello,
today I was looking for the right function to get the user name in a random python module outside the deadline plugin itself. In finally figured out that Deadline.Scripting.SlaveUtils.GetCurrentJobValue( “UserName” ) was the function I was looking for. Unfortunately there is no information about that in the Deadline scripting reference which made it very hard for me to track this function done. Did I look at the wrong place or is it actually missing in the documentation?
Thank you,
Christian
Hi Christian,
Deadline.Scripting.ScriptUtils is actually deprecated, which is why it’s undocumented. Everything that was in ScriptUtils is still available in the other *Utils classes in the Deadline.Scripting namespace. For example, GetCurrentJobValue can be found in Deadline.Scripting.SlaveUtils.
Note though that if you’re running a standalone python script, you can’t use Deadline.Scripting. This is actually a .NET namespace, and is only valid in python scripts that are run in the context of Deadline (ie: a Deadline plugin, Monitor script, or a script that’s run by “deadlinecommand.exe -executescript”). It works in the context of Deadline because we use Python for .NET, which allows you to import native python modules AND .NET namespaces. Deadline.Scripting is documented in the Deadline-6-2-Scripting-Reference documentation.
Hope that helps!
Cheers,
Ryan
Hi Ryan,
thank you for your response. The Python module is loaded during a render job. According to your answer calling GetCurrentJobValue from the Deadline.Scripting.SlaveUtils should work, right? I will give it a try and get back to you if I have further questions.
Thank you,
Christian
What is loading this python module? Is it a Deadline plugin, or is it a standalone script? If it’s the latter, it wont’ work.
Maybe if you could provide more context about what you’re doing, it would help us get a better understanding.
Thanks!
Ryan
Hi Ryan,
it’s a MayaBatch-job where we run some checks in a scene before we kick-off another job. In order to submit the new job we need the user name and thought we could use the render job information. We already have a Python-module which is part of our generic pipeline to get the user name from the active directory, apparently this doesn’t work on the farm so we figured we just import the Deadline.Scripting module to load the information from the render job.
Now that I wrote this I realize that the Python module is loaded inside an application (in this case Maya) and will behave like a standalone script. Is there any other way to get the information from the render job inside an application? Since it’s a generic python module which is used in different applications it’s a little bit tricky. Otherwise I would just use the application-specific modules.
Thank you,
Christian
Thanks for the additional info, and you’re correct that a python script inside Maya won’t be able to import Deadline.Scripting.
If you just need the user name, you can check the DEADLINE_USER environment variable from your script. Deadline sets this for the rendering process when it launches it. It’s meant to help users set up their farm to run jobs as specific users, but it sounds like you could re-purpose it for your needs:
thinkboxsoftware.com/deadlin … Mac_OSX.29
Cheers,
Ryan
Hi Ryan,
thank you for the hint. That should do the job. I’ll let you know if I need further assistance.
Thank you,
Christian