Trying to modify the current VrayBenchmark plugin to work with Vray5 version.
Unfortunately chaos group has modified the cli executable to ask for a EULA with a requisite user input. The workaround from them was to run the executable with an echo y |
in front so the command line would look something like this:
echo y | \path\to\vraybenchmark.exe --args --args
trying to use the ModifyCommandLineCallback doesn’t seem to achieve the desired results:
#!/usr/bin/env python3
from __future__ import absolute_import
from Deadline.Plugins import DeadlinePlugin, PluginType
from Deadline.Scripting import SystemUtils
import os
def GetDeadlinePlugin():
return VrayBenchmarkPlugin()
def CleanupDeadlinePlugin(deadline_plugin):
deadline_plugin.Cleanup()
class VrayBenchmarkPlugin(DeadlinePlugin):
def __init__(self):
self.SingleFramesOnly = None
self.StdoutHandling = None
self.PopupHandling = None
self.InitializeProcessCallback += self.InitializeProcess
self.RenderExecutableCallback += self.RenderExecutable
self.RenderArgumentCallback += self.RenderArgument
self.ModifyCommandLineCallback += self.ModifyCommand
def Cleanup(self):
for stdoutHandler in self.StdoutHandlers:
del stdoutHandler.HandleCallback
del self.InitializeProcessCallback
del self.RenderExecutableCallback
del self.RenderArgumentCallback
def InitializeProcess(self):
self.SingleFramesOnly = True
self.StdoutHandling = False
self.PopupHandling = False
def RenderExecutable(self):
version = self.GetPluginInfoEntryWithDefault('Version', '4')
vray_benchmark_exe_param = 'VRayBenchmark_RenderExecutable_{0}'.format(version)
vray_benchmark_exe = self.GetRenderExecutable(vray_benchmark_exe_param, 'V-Ray Benchmark')
if SystemUtils.IsRunningOnWindows():
# This is required otherwise The V-Ray Benchmark will be unable to locate it's resources folder.
vray_benchmark_exe = vray_benchmark_exe.replace('/', '\\')
else:
vray_benchmark_exe = vray_benchmark_exe.replace('\\', '/')
return vray_benchmark_exe
def RenderArgument(self):
filePath, fileNameExt = os.path.split(str(self.RenderExecutable()))
args = '--dump --output ' + os.path.join(filePath, '%COMPUTERNAME%.json')
arguments = [args]
arguments.extend(self.get_mode_arguments())
return ' '.join(arguments)
def get_mode_arguments(self):
"""returns the V-Ray render mode to use for the benchmark as a list of command-line args"""
do_cpu = self.GetBooleanPluginInfoEntryWithDefault('CPUTest', False)
do_gpu = self.GetBooleanPluginInfoEntryWithDefault('GPUTest', False)
mode = 'both'
if do_cpu and not do_gpu:
mode = 'vray'
elif not do_cpu and do_gpu:
mode = 'vray-gpu'
return ['--mode', mode]
def ModifyCommand(self, exe_path, args, startUpDir):
_dir, _exec = os.path.split(exe_path)
if SystemUtils.IsRunningOnWindows():
exe_path = 'echo y | ' + _exec
result = (exe_path, args, startUpDir)
return result
Any help would be appreciated.