How to get Plugin Executable Filepath from another plugin

Using RepositoryUtils.GetPluginConfig(pluginName) we can get an instance of PluginConfig() class.
PluginConfig() class allows us to query any Plugin Settings defined in Deadline Monitor > Tools > Configure Plugins.
For example, we can retrieve an information on what value is currently specified in After Effect plugin “Network Windows Font Folder” field.
Let’s say Maya rendering job could query Deadline to get an information where font folder is set for After Effects.
All we need is to declare PluginConfig instance:

aeSettings=RepositoryUtils.GetPluginConfig('AfterEffects')

Having aeSettings object we proceed by asking Deadline what “Network Windows Font Folder” field is (this field has API name: ’ FontFolderNetworkWindows’) using .GetConfigEntry() method:

fontFolder = aeSettings.GetConfigEntry(' FontFolderNetworkWindows')

This Deadline feature of delivering any data from anywhere is very powerful.
But when it comes time to query App Plugin Executable filepath (based on build, OS and etc) a simple .GetConfigEntry() request is not just enough. Every pluginName.py found in DeadlineRepository/PluginName/ folder has
a dedicated RenderExecutable() function to address this need by processing a filepaths it receives from.GetConfigEntry().

While writing Deadline Event I came across a need to query Plugin executables. But since I don’t want to copy/paste RenderExecutable() function definition into my Event script I thought it would be great if I could use the ones already defined in pluginName.py scripts.

So function responsible for querying Deadline for Plugin executable turned to be simple enough:
From Event running:

[code]pluginName=job.PluginName # get job’s Plugin name (you never know what it is going to be)
pluginsDir=RepositoryUtils.GetPluginsDirectory() # get Repository plugins directory
pluginFile=os.path.join(pluginsDir, pluginName, pluginName+’.py’) # build a filepath to plugin .py module

import plugin module by filepath

import imp
pluginModule=imp.load_source(pluginName, pluginFile)
methodCall=‘pluginModule.%sPlugin()’%pluginName
pluginObject=eval(methodCall) # declare Deadline Plugin Object instance
pluginExe=pluginObject.RenderExecutable() # call to get Plugin executable path[/code]

and instead of getting Plugin’s filepath to executable receiving nasty:
RenderPluginException – Error in PreRenderTasks: RenderExecutable() callback not assigned in ManagedProcess class

Another plugin gave different error message:
RenderPluginException:
RenderPluginException – Error in PreRenderTasks: This function can only be called after the DeadlinePlugin has been fully initilized, which is not until after the DeadlinePlugin object has been returned by the global GetDeadlinePlugin function. Please use this function from one of the available callbacks for the DeadlinePlugin

Any ideas how how to get it work?

Essentially, I believe you would need to instantiate the particular required deadlinePlugin class inside of your eventPlugin, before you can query it.
If you open up some of our application plugin python scripts for some of the other applications you can see how this is achieved.

[code]from Deadline.Plugins import *

def GetDeadlinePlugin():
return MyPlugin()

class MyPlugin (DeadlinePlugin):

def __init__( self ):
    self.InitializeProcessCallback += self.InitializeProcess
    self.RenderExecutableCallback += self.RenderExecutable

[/code]

Don’t forget to use the “Cleanup” function as well, as this will ensure there is no memory leak over time.

However, for the sake of code maintenance & readability, wouldn’t it be easier to just write a few lines of your own function to return the exe path that you want to use?

I agree. For the sake of code maintenance & readability it would be easier to just write a few lines of my own function to return the App exe path. Thanks Mike!