# get deadline cmd exe path
dl_cmd = os.path.normpath( os.path.join(os.environ['DEADLINE_PATH'], 'deadlinecommand.exe') )
# use deadline cmd to get deadline system info
cmd = r'"{0}" -JSON -GetSubmissionInfo Pools Groups MaxPriority TaskLimit UserHomeDir RepoDir:submission/Maya/Main RepoDir:submission/Integration/Main'.format(dl_cmd)
# note: the original mel code, put " 2> nul" at the end of the cmd, which means no err output, and only 1st output/the result to the string.
# so they don't need 2 variable like bellow to catch the return values.
info=subprocess.Popen(cmd,stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = info.communicate()
exitcode = info.returncode
# read data
import json
dl_data = json.loads(out)
deadlineSubmissionInfo=dl_data['result']
# pool list
pool_list = deadlineSubmissionInfo['Pools']
for existing maya deadline scene, the attribute is stored at defaultRenderGlobals
# for existing deadline scene
cmds.getAttr('defaultRenderGlobals.DeadlineMayaRepoPath')
# all the attribute saving is at SavePersistentDeadlineOptions() in mel
other maya info
# current renderer
renderer = cmds.getAttr('defaultRenderGlobals.currentRenderer') # arnold
# current render layer
currentRenderLayer = cmds.editRenderLayerGlobals(q=1, currentRenderLayer=1)
# render animation?
render_animation = cmds.getAttr("defaultRenderGlobals.animation") # true
# Get frame list 1-3 style
frameList = str( int(cmds.currentTime(q=1)) )
if render_animation:
fromFrame = int( cmds.getAttr('defaultRenderGlobals.startFrame') )
toFrame = int( cmds.getAttr('defaultRenderGlobals.endFrame') )
byFrame = int( cmds.getAttr('defaultRenderGlobals.byFrameStep') )
frameList = fromFrame
if fromFrame != toFrame:
frameList = "{0}-{1}".format(frameList, toFrame)
if byFrame > 1:
frameList = "{0}x{1}".format(frameList, byFrame)