Skip to content

Instantly share code, notes, and snippets.

@kramester
Last active December 22, 2020 07:28
Show Gist options
  • Save kramester/b5c13d78d6893ba621d327202ec34dd4 to your computer and use it in GitHub Desktop.
Save kramester/b5c13d78d6893ba621d327202ec34dd4 to your computer and use it in GitHub Desktop.
A modified version of the reformstudios file described here: http://reformstudios.com/2018/08/15/shotgun-bootstrapping-and-deadline/
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()
threadnumber = deadlinePlugin.GetThreadNumber()
deadlinePlugin.SetProcessEnvironmentVariable("DEADLINE_SLAVENAME", slavename)
SHOTGUN_HOME = os.path.join('C:\\', 'studio','shotgun','cache',slavename,str(threadnumber))
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment