I have a problem with Event plugin scripting. I need to fetch a FileName from the job that is triggering the Event plugin, so that I can re-submit the same scene file (with different parameters) automatically.
So far, I’ve found a function that could potentially be what I’m looking for, but Deadline scripting is extremely difficult to debug and test without actually running the code on the farm (which is something I don’t want to do right now, not even virtually).
The function is:
string GetPluginInfoEntry( string Key )
But, what object do I call this method on? The job? Or just itself?
Alternatively, check out the shipping QuickTimeGen.py event plugin or indeed my DJV event py plugin for more example functions. Nothing like a bit of copy’n’paste to save time
Basically, you have a “job” object in event plugins, so most functions are logical like “job.JobName” or “job.JobPlugin”, which give obvious results. Both the py script plugins I mentioned above use these functions to grab various bits of info.
Thanks Mike, I was actually expecting you to drop by and help me out, once again.
However, I don’t submit the actual scene file with the job. I keep the files in a centralized repository where my projects reside.
What I’m currently doing is writing an Event Plugin that’ll submit the same job, but with different params. I initially submit a 3ds Max job to calculate a GI prepass (to save out lighting caches), then I need to resubmit the very same job, but with a maxscript along with it, to switch the rendering mode to “beauty pass” so that it reads in the GI and renders the final beauty pass. Then I submit a Nuke job that’ll read in the rendered exrs and through a pre-defined simple comp spits out JPG previews.
The last two submissions should be automatic (as they’re always the same, principally), but I just need to fetch the actual xxx.max scene file from the initial, first, submitted job.
There is no need to prefix the function with “job.”
Just call the function like this and it returns a string value:
GetDataFilename()
It’s use is to always return the path location and filename of the ‘file’ to be processed which is normally identified in the submission py code. If you take a look at the 3dsmax.py plugin code and search for this command, you should see how it is used.
Hmm… just tested it out and, while the Event Plugin doesn’t throw an error, the method doesn’t return what I need. In fact, it returns and empty string:
But shouldn’t the method then error out if it wasn’t imported?
I think that this method only returns data for the current job, so, the event plugin can’t return anything reasonable as it’s not submitted yet. But I could be wrong, of course.
GetDataFilename() only returns the scene file when it has been submitted with the job. Since it’s not, you’ll have to use GetPluginInfoEntry() to pull the path from the plugin info file that was submitted with the job. Usually, the scene property is called “SceneFile”, so this should work most of the time:
That way, if the scene file isn’t in the plugin info file (because it was submitted with the job), GetDataFilename() will be called instead. You can see an example of this in the 3dsmax.py plugin file.