I am running maya script jobs through deadline and I would like it to stop on errors. I see the HandleErrorMessage() where you are containing specific errors.
I’d like to be able to raise a StandardError in the script and have it stop for example. ANyway to make that possible without having to write a new plugin?
I’d say copy the existing plugin into “[repo]\custom\plugins” and add that handler for yourself. You could also print something that would match the existing errors, but that might be a little strange.
It looks like you could say: “Error: FatalError: StandardError: My snazzy text”. That would catch via this code here:
*edit: was typing at the same type as edwin… we are saying the same thing
you can always add your own error or exception types to an existing plugin.
i would recommend copying the whole plugin to the entire plugin folder to \repo\custom\plugins .
that way you have a clean copy of the original. (this helps if your upgrading to a new deadline version.)
example from our mayabatch plugin:
# add lines that we want to error, and redirect them to an existing handler:
# catch redshift no render layers: issue 683
self.AddStdoutHandlerCallback(".*No render layers are marked as renderable. Render aborted.*").HandleCallback += self.HandleFatalError
# catch no renderable cameras that causes redshift to not render adn mark the frame as done, issue:754
self.AddStdoutHandlerCallback(".*No renderable cameras found. Aborting render.*").HandleCallback += self.HandleFatalError
# We want to collect all the crash data in to packages per job, in case we need to forward to a vendor, push to a custom error handler.
# catch maya crashes in a generic error type.
self.AddStdoutHandlerCallback(".*Writing crash report.*").HandleCallback += self.HandleCrashReport
# sometimes it exits before the writing crash dump, and it dies with a seg fault.
self.AddStdoutHandlerCallback(".*Segmentation fault.*").HandleCallback += self.HandleCrashReport
Ok, this works though I think what I want is slightly different.
Tell me if what I am trying makes sense. I am using MayaBatch though I don’t have a maya scene as I am completely generating the scene on “the wall”. I am managing dependencies and launching a series of jobs through the api Jobs().SubmitJob(). Each job runs a python script that assembles a maya scene and saves it out. Based on the suggestions in this thread I opened up the error handling and it is working. It is not stopping the job. I would like it to stop the job so that the script can be ‘fixed’ and task retries.
Is there a way to fail a maya job in deadline so the task can be retried?
Before deadline I was managing maya standalone. Should I run a python job and run maya standalone myself? Or is MayaBatch still the best way to achieve what I want?
(on a side note I am feeding the MayaBatch plugin a garbage maya file as it seems to need a file to do anything, which makes me think maybe that isn’t plugin I should use.)
We had to modify the plugin, so that you could have a mel/python script without needing to have a maya scene that existed.
In a nutshell, in the plugin where it starts to build the global mel script, there is a point there where it checks to see if there is a maya scene file to load.
we set it up, so if there is no given scenefile, it adds the following lines to the mel script, so that the mel/python script runs on a new maya scene:
if self.SceneFile:
# load the scene file, use the CreateDelayLoadSceneMelscript etc...
else:
# no maya scene, make sure maya has a clean scene, incase we are sharing a session.
scriptBuilder.AppendLine()
scriptBuilder.AppendLine( 'file -f -new;' )
scriptBuilder.AppendLine( 'print ("Creating a new blank scene in maya.\\n");' )
scriptBuilder.AppendLine()