Skip to content

Instantly share code, notes, and snippets.

@reformstudios
Last active March 23, 2020 19:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reformstudios/4996e903fc72a19cadba7bf3aaab5649 to your computer and use it in GitHub Desktop.
Save reformstudios/4996e903fc72a19cadba7bf3aaab5649 to your computer and use it in GitHub Desktop.
This script solves the problem of running multiple deadline slaves on one workstation and then attempting to bootstrap a Shotgun pipeline config as part of a deadline task. The script does this by setting a unique path for each slave's Shotgun session (using the SHOTGUN_HOME environment variable)Save this script to your deadline repo's 'custom/p…
from System.IO import *
from Deadline.Events import *
from Deadline.Scripting import *
import os
def set_slave_specific_shotgun_home_path(deadlinePlugin):
'''
In situations where you have multiple deadline Slaves on a single rendernode
Shotgun may fail to bootstrap a pipelineconfig if more than one slave
attempts to bootstrap at the same time. This is because by default each
slave will use the same location to store it's shotgun pipeline configuration so
when more than one slave is bootstrapping, there may be two processes attempting to
copy files to the same location at the same time, thus causing an error.
Setting a slave-specific directory per slave prevents this clash from occurring.
:param deadlinePlugin: The deadlinePlugin class passed from __main__
:return: None
'''
deadlinePlugin.LogInfo(". Setting-up environment")
slavename = deadlinePlugin.GetSlaveName()
deadlinePlugin.SetProcessEnvironmentVariable("DEADLINE_SLAVENAME", slavename)
SHOTGUN_HOME = os.path.join('c:\\', 'studio','shotgun','cache',slavename)
deadlinePlugin.LogInfo(". setting SHOTGUN_HOME : %s" % SHOTGUN_HOME)
deadlinePlugin.SetProcessEnvironmentVariable("SHOTGUN_HOME", SHOTGUN_HOME)
def __main__(deadlinePlugin):
# Set SHOTGUN_HOME environment variable to slave-specific location
set_slave_specific_shotgun_home_path(deadlinePlugin)
@kramester
Copy link

Can you provide any more info on how to use this script. Looks like your description is cut off at the top of the gist page. Would very much appreciate it.

@kramester
Copy link

Nevermind, i found your blog. Thanks for sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment