A good place to learn from is the MayaBatch integration.
In the MayaBatch.py, you can see how a version is used to resolve a specific version of the application:
## Called by Deadline to get the render executable.
def RenderExecutable( self ):
versionString = str( self.Version ).replace( ".", "_" )
mayaExecutable = ""
mayaExeList = self.deadlinePlugin.GetConfigEntry( "RenderExecutable" + versionString )
if(SystemUtils.IsRunningOnWindows()):
if( self.Build == "32bit"):
self.deadlinePlugin.LogInfo( "Enforcing 32 bit build of Maya" )
mayaExecutable = FileUtils.SearchFileListFor32Bit( mayaExeList )
if( mayaExecutable == "" ):
self.deadlinePlugin.LogWarning( "32 bit Maya " + versionString + " render executable was not found in the semicolon separated list \"" + mayaExeList + "\". Checking for any executable that exists instead." )
elif( self.Build == "64bit" ):
self.deadlinePlugin.LogInfo( "Enforcing 64 bit build of Maya" )
mayaExecutable = FileUtils.SearchFileListFor64Bit( mayaExeList )
if( mayaExecutable == "" ):
self.deadlinePlugin.LogWarning( "64 bit Maya " + versionString + " render executable was not found in the semicolon separated list \"" + mayaExeList + "\". Checking for any executable that exists instead." )
if( mayaExecutable == "" ):
self.deadlinePlugin.LogInfo( "Not enforcing a build of Maya" )
mayaExecutable = FileUtils.SearchFileList( mayaExeList )
if( mayaExecutable == "" ):
self.deadlinePlugin.FailRender( "Maya " + versionString + " render executable was not found in the semicolon separated list \"" + mayaExeList + "\". The path to the render executable can be configured from the Plugin Configuration in the Deadline Monitor." )
return mayaExecutable
The self.Version
comes from
def StartJob( self ):
self.Version = StringUtils.ParseLeadingNumber( self.GetPluginInfoEntry( "Version" ) )
self.Version = int(self.Version * 10) / 10.0 # we only want one decimal place
if not str(self.Version).endswith(".5"):
self.Version = int(self.Version) * 1.0 # If it's not a *.5 Version, then we want to ignore the decimal value
self.Build = self.GetPluginInfoEntryWithDefault( "Build", "None" ).lower()
self.LogInfo( "Rendering with Maya Version " + str(self.Version) )
...
The Job has a Version value in the PluginInfo metadata because the submitter wrote it there:
proc string WriteJobFilesAndSubmit( string $renderer, int $showDialog, int
$regionRendering, int $jobType, string $cameraOverride )
{
... way down the function ...
fprint $fileId ( "Version=" + MayaVersion() + "\n" );
In the MayaBatch.param file in the plugins/MayaBatch, you will find multiple parameters defining the possible executables:
[RenderExecutable2017_0]
Type=multilinemultifilename
Category=Render Executables
CategoryOrder=0
Index=13
Label=Maya 2017 Render Executable
Default=C:\Program Files\Autodesk\MayaIO2017\bin\MayaBatch.exe;/usr/autodesk/mayaIO2017/bin/maya;/Applications/Autodesk/mayaIO2017/Maya.app/Contents/bin/maya;C:\Program Files\Autodesk\Maya2017\bin\MayaBatch.exe;/usr/autodesk/maya2017/bin/maya;/Applications/Autodesk/maya2017/Maya.app/Contents/bin/maya
Description=The path to the Maya 2017 executable file used for rendering. Enter alternative paths on separate lines.
[RenderExecutable2017_5]
Type=multilinemultifilename
Category=Render Executables
CategoryOrder=0
Index=14
Label=Maya 2017.5 Render Executable
Default=C:\Program Files\Autodesk\Maya2017.5\bin\MayaBatch.exe;/usr/autodesk/maya2017.5/bin/maya;/Applications/Autodesk/maya2017.5/Maya.app/Contents/bin/maya
Description=The path to the Maya 2017.5 executable file used for rendering. Enter alternative paths on separate lines.
[RenderExecutable2018_0]
Type=multilinemultifilename
Category=Render Executables
CategoryOrder=0
Index=15
Label=Maya 2018 Render Executable
Default=C:\Program Files\Autodesk\Maya2018\bin\MayaBatch.exe;/usr/autodesk/maya2018/bin/maya;/Applications/Autodesk/maya2018/Maya.app/Contents/bin/maya;/usr/autodesk/mayaIO2018/bin/maya
Description=The path to the Maya 2018 executable file used for rendering. Enter alternative paths on separate lines.
[RenderExecutable2019_0]
Type=multilinemultifilename
Category=Render Executables
CategoryOrder=0
Index=16
Label=Maya 2019 Render Executable
Default=C:\Program Files\Autodesk\Maya2019\bin\MayaBatch.exe;/usr/autodesk/maya2019/bin/maya;/Applications/Autodesk/maya2019/Maya.app/Contents/bin/maya;/usr/autodesk/mayaIO2019/bin/maya
Description=The path to the Maya 2019 executable file used for rendering. Enter alternative paths on separate lines.
[RenderExecutable2020_0]
Type=multilinemultifilename
Category=Render Executables
CategoryOrder=0
Index=17
Label=Maya 2020 Render Executable
Default=C:\Program Files\Autodesk\Maya2020\bin\MayaBatch.exe;/usr/autodesk/maya2020/bin/maya;/Applications/Autodesk/maya2020/Maya.app/Contents/bin/maya;/usr/autodesk/mayaIO2020/bin/maya
Description=The path to the Maya 2020 executable file used for rendering. Enter alternative paths on separate lines.
So when the executable is resolved, the MayaBatch.py reads the Version from the metadata, looks in the correct entry defining the executable for that version, and picks the first file it can find (Linux, Windows, macOS)…
You need to implement the same logic for VRay