Shotgun tk Write nodes and Deadline, how?

Hi,

This might be more of a Shotgun question, but I figure there must be someone here who’s got it working with Deadline, so it’s worth asking.

I’ve been reading this support article on farm integration and SG write nodes, first trying to get SG to load so that the render farm can actually open the ShotgunWrite-node, but that fails because there’s no user logged in to the farm machines, and apparently I have to add code to programatically add a user at runtime, all this seems way to cumbersome in a rendering context to be honest.

The other way to do it is to convert SG writes to normal ones, but I can’t figure out where to put that code, I do not want to save converted nodes in the Nuke script so it has got to happen on the fly at render time, but running the script at render time would again require me to load the SG API on the farm, presumably requiring a user again, or can I load that part of the API without a user? If so, where should this code go?

How does everyone do it? Skip the SG write entirely? Convert all nodes before submitting? Thankful for any insight you might have!

Hi,
You can configure Deadline to run as a user at render time:
docs.thinkboxsoftware.com/produ … job-s-user

What version & platform of Deadline are you using? As you will need the newer UCS4 build to successfully: “import sgtk” if you are on Linux. Are you running Linux?

You can use the JobPreLoad.py function to control the “NUKE_PATH” env var and force a custom “init.py” file to be loaded, which in-turn would import tank: docs.thinkboxsoftware.com/produ … preload-py

Thanks, we’re running Windows for the most part, repo version is 10.0.9.4.

I had a look at the first link, but I don’t think that covers it, loading SGTK seems to require an actual Shotgun user account to be logged in to the process and it has to be linked to your SG site, it could be created on the fly through the SG API, but I don’t want to go that route if I can avoid it.

I had it working with a init.py file, but once I ran into the issue of requiring a SG user to be logged in, I abandoned that route.

The best option we have currently is to skip SG write nodes, the only other way I can imagine is if I can make Deadline run a small script which converts SG writes to normal ones before submitting the job, without altering the original script it was submitted from. Is that possible?

I believe this is the best and recommended way to do it. I’m pretty sure its how other customers do it:
support.shotgunsoftware.com/hc/ … m-scripts-

Section called: “Non-user-facing scripts”

You could pull in the Shotgun ScriptName and API application key from the Deadline Shotgun event plugin:
docs.thinkboxsoftware.com/produ … connection

What “user” does it need to be? I mean, if your on Windows, are you wanting to pass the current “Windows” username running as a “service” to sgtk? The “username” of the current deadline job? A hard-coded “username” in your pipeline?

DEADLINE_USER ENV VAR will give you the current Deadline job user: docs.thinkboxsoftware.com/produ … job-s-user

Deadline’s in-app Nuke submitter is all written in Python, so you could fork it into: “…/repo/custom/submission/” as you see fit for custom workflows at submission time.

UPDATE: I had a good chat with one of the ADSK SGTK street team developers at Siggraph and suggested a potentially really nice way that they could implement a context-aware Nuke2Deadline submitter in SGTK. Hopefully, they will have time to take a look. :wink:

Hey Mike,

Wanted to know if your chat with Shotgun got any traction.

Thanks!

It did not it would seem. I told them what they needed to do…“bake the tk-write nodes under ‘context’ in Nuke and then after submission exits; revert the ‘context’ back to pre-submission in Nuke.” We should probably try and reboot the conversation again. Could you submit a ticket explaining what your after to both the Thinkbox and Shotgun official private ticketing systems and then I’ll try and escalate. I’m assuming you were a fan of the ‘bake’ option instead of the Shotgun user account be logged into the process?

That’s really interesting, we had internal discussions along similar lines - integrate slightly more toward the Shotgun side of things, so that the submitter can hand off a largely independent scene to Deadline.

For the time being, with Nuke, we still use tk-nuke-writenodes. In JobPreLoad.py and one other place, we do some initializatiion to bring up a tk-nuke engine with the correct context, etc.
Having to authenticate a script user makes sense - it is a security feature :slight_smile: