-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAssetTransfer.py
More file actions
90 lines (63 loc) · 3.08 KB
/
AssetTransfer.py
File metadata and controls
90 lines (63 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import os
from Deadline.Plugins import *
from Deadline.Scripting import *
def GetDeadlinePlugin():
return PythonPlugin()
def CleanupDeadlinePlugin(deadlinePlugin):
deadlinePlugin.Cleanup()
class PythonPlugin (DeadlinePlugin):
def __init__(self):
self.InitializeProcessCallback += self.InitializeProcess
self.RenderExecutableCallback += self.RenderExecutable
self.RenderArgumentCallback += self.RenderArgument
self.StartupDirectoryCallback += self.StartupDirectory
def Cleanup(self):
for stdoutHandler in self.StdoutHandlers:
del stdoutHandler.HandleCallback
del self.InitializeProcessCallback
del self.RenderExecutableCallback
del self.RenderArgumentCallback
del self.StartupDirectoryCallback
def HandleSampleProgress(self):
start = self.GetRegexMatch(1)
end = self.GetRegexMatch(2)
self.SetProgress(int(start) * 100/int(end))
def InitializeProcess(self):
self.StdoutHandling = True
self.PluginType = PluginType.Simple
self.SingleFramesOnly = True
self.AddStdoutHandlerCallback(".*Transfering: ([0-9]+)/([0-9]+).*").HandleCallback += self.HandleSampleProgress
pythonPath = self.GetEnvironmentVariable("PYTHONPATH").strip()
addingPaths = self.GetConfigEntryWithDefault("PythonSearchPaths", "").strip()
if addingPaths != "":
addingPaths.replace(';', os.pathsep)
if pythonPath != "":
pythonPath = pythonPath + os.pathsep + addingPaths
else:
pythonPath = addingPaths
self.LogInfo("Setting PYTHONPATH to: " + pythonPath)
self.SetEnvironmentVariable("PYTHONPATH", pythonPath)
def RenderExecutable(self):
version = self.GetPluginInfoEntry("Version")
exeList = self.GetConfigEntry("Python_Executable_" + version.replace(".", "_" ))
exe = FileUtils.SearchFileList(exeList)
if exe == "":
self.FailRender( "Python " + version + " executable was not found in the semicolon separated list \"" + exeList + "\". The path to the render executable can be configured from the Plugin Configuration in the Deadline Monitor." )
return exe
def RenderArgument( self ):
# change dis
scriptFile = os.path.join(self.GetPluginDirectory(), 'at_client.py')
arguments = self.GetPluginInfoEntryWithDefault("Arguments", "")
arguments = RepositoryUtils.CheckPathMapping(arguments)
auxFiles = self.GetAuxiliaryFilenames()
if len(auxFiles) < 2:
self.FailRender('Please submit required files list and config file.')
requirementsFile = auxFiles[0]
configFile = auxFiles[1]
if SystemUtils.IsRunningOnWindows():
scriptFile = scriptFile.replace("/", "\\")
else:
scriptFile = scriptFile.replace("\\", "/")
return "\"" + scriptFile + "\" " + "--file=\"" + requirementsFile + "\" " + "--config=\"" + configFile + "\" " + arguments
def StartupDirectory(self):
return self.GetPluginDirectory()