I want to write a custom Deadline Plugin that could be used to open an existent AfterEffects comp file (aep) and read the content of it to text file. It can be easily accomplished from a CMD command line in Windows.
Example:
“C:\Program Files\Adobe\Adobe After Effects CC\Support Files\AfterFX.exe” -s var foo = ‘foo’; alert(foo);
The “-s” flag specifies the beginning of JSX command arguments to be executed.
The example above runs perfectly from a command line. But if I put this into the Deadline custom plugin with its executable to be : “C:\Program Files\Adobe\Adobe After Effects CC\Support Files\AfterFX.exe”
and arguments: -s var foo = ‘a fool’; alert(foo);
Deadline performs the job well but then throw an error message that the application exited with exit code: 1.
What could be a reason Deadline thinks the executable exited with the error? Is it possible to override the exit code of the application so Deadline is fooled everything went OK?
Below is the Slave Log:
=======================================================
Error Message
Exception during render: An error occurred in RenderTasks(): Error in CheckExitCode(): Renderer returned non-zero error code, 1. Check the log for more information.
at Deadline.Plugins.ScriptPlugin.RenderTasks(String taskId, Int32 startFrame, Int32 endFrame, String& outMessage)
=======================================================
Slave Log
0: Task timeout is disabled.
0: Loaded job: ntl_nau_san_fra_godzill_v0015_0002.aep (007_050_999_224f9aef)
0: INFO: StartJob: initializing script plugin AfterEffectsPython
0: INFO: About: AfterEffectsPython plugin
0: Plugin rendering frame(s): 0
0: INFO: Stdout Handling Enabled: False
0: INFO: Popup Handling Enabled: False
0: INFO: Using Process Tree: True
0: INFO: Hiding DOS Window: True
0: INFO: Creating New Console: False
0: INFO: Render Executable: “C:\Program Files\Adobe\Adobe After Effects CC\Support Files\AfterFX.exe”
0: INFO: Render Argument: -s var foo = ‘a fool’; alert(foo);
0: INFO: Startup Directory: “C:\Program Files\Adobe\Adobe After Effects CC\Support Files”
0: INFO: Process Priority: BelowNormal
0: INFO: Process Affinity: default
0: INFO: Process is now running
0: STDOUT: Using DXGI: Device: “NVIDIA Quadro K4000” has dedicated video RAM (MB): 3015
0: STDOUT: Using DXGI: Device: “NVIDIA Quadro K4000” has dedicated video RAM (MB): 3015
0: INFO: Process exit code: 1
=======================================================
Error Type
RenderPluginException
=======================================================
Error Stack Trace
at Deadline.Plugins.Plugin.RenderTask(String taskId, Int32 startFrame, Int32 endFrame)
at Deadline.Slaves.SlaveRenderThread.RenderCurrentTask(TaskLogWriter tlw)
I found a solution. If the rendering application (such as EfterEffects.exe (CC) is giving an Error Exit Code it is possible to override how Deadline will be handling it by defining the CheckExitCode() function in my_plugin.py:
def CheckExitCode( self, exitCode ):
if exitCode != 0:
if exitCode == 1:
LogInfo( “My_Plugin Renderer reported an error with error code 1. This will be ignored because this error does not make any sense.” );
else:
FailRender( “AfterEffectsPython.py RenderArgument() : My_Plugin Renderer returned non-zero error code %d. Check the renderer’s output.” % exitCode )
Hi,
Yep, in Deadline you can handle the exitCode, check for the exitCode, ignore the exitCode, all kinds of things, which as you have discovered has fixed your issue. 
However, looking here it looks like the flag for executing a JSX script via AE is “-r /path/to/script.jsx” and not “-s”, which identifies the starting frame number to render.
I saw these pages giving the command flags, but with no mention of “-r” on the network rendering page, but then I found this 2nd page. Also, according to StackOverflow, it might not work on the OSX platform?
help.adobe.com/en_US/aftereffect … 79a3a.html
help.adobe.com/en_US/aftereffect … D3843.html
stackoverflow.com/questions/5859 … m-terminal
Perhaps, this is why an error is being thrown and therefore you don’t need to handle the exitCode? (which would be better for stability/reliability for you in the future
)
Hope this helps,
Mike
I use afterfx.exe -r “a:\cool\path\to\awsome\script.jsx” to read the comp data. The read data is sent down to deadline which will be using aerender.exe to render the comp.
It appears the flags (while being seriously similar) serve different purposes.
“r” flag used with afterfx.exe specifies the path to jsx script.
Same flag used with aerender.exe specifies a first frame to render.
Please correct me if I am wrong.
Hello,
You are correct. I was just looking at your initial thread where you showed that you were using the “-s” flag. I wasn’t able to find any AE documentation regarding this “-s” flag, but only the “-r” flag? Previously, I thought you had accidentally selected the wrong exe to use, but I can see now what you are doing. I just tested with AE on OSX and it doesn’t work, but that’s ok, as it looks like you are running Windows. I wonder if there are any pop-ups which are causing an issue? Probably not, as you said that it does execute the script successfully, but just returns a non-zero exitCode. So the best thing to do here is what you have done
I’m still intrigued by this -s flag!
Regards,
Mike
I’ve created a simple windows foo.bat file with the context like this:
"C:\Program Files\Adobe\Adobe After Effects CC\Support Files\AfterFX.exe" -s var foo='foo';
echo %errorlevel%
pause
This way I avoid submitting the deadline jobs while testing the application exit code (echo %errorlevel% prints out an exit code number to CMD window).
AfterFX.exe CC runs well and shows no errors while executing the argument script (-r flag) or an argument command (-s flag). The error exit code is given only when you close (exit) AfterEffects CC (or when an argument script tells it to do so). The error code number I’ve got on Windows is 1.
Once again, the execution of the script or command arguments doesn’t cause the error code to be thrown. It is an application’s exit that does.
Some applications do return a non-zero exit code even though this goes against normal convention. Perhaps this is one of those cases?