Fail a task in PostRenderTasks

Is there a way to fail a task in the PostRenderTasks step of a plugin? I’ve tried calling the following…

RepositoryUtils.FailTasks ( self.GetJob(), { self.GetCurrentTask() })

But I get the following error in the task log:

Error: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. (System.AccessViolationException)
at System.Runtime.InteropServices.Marshal.ReadInt64(IntPtr ptr, Int32 ofs)
at Python.Runtime.Runtime.PyObject_GetTypeName(IntPtr op)
at Python.Runtime.Converter.ToPrimitive(IntPtr value, Type obType, Object& result, Boolean setError)
at Python.Runtime.Converter.ToManagedValue(IntPtr value, Type obType, Object& result, Boolean setError)
at Python.Runtime.Converter.ToArray(IntPtr value, Type obType, Object& result, Boolean setError)
at Python.Runtime.Converter.ToManagedValue(IntPtr value, Type obType, Object& result, Boolean setError)
at Python.Runtime.MethodBinder.Bind(IntPtr inst, IntPtr args, IntPtr kw, MethodBase info, MethodInfo[] methodinfo)
at Python.Runtime.MethodBinder.Invoke(IntPtr inst, IntPtr args, IntPtr kw, MethodBase info, MethodInfo[] methodinfo)
at Python.Runtime.MethodObject.Invoke(IntPtr target, IntPtr args, IntPtr kw, MethodBase info)
at Python.Runtime.MethodBinding.tp_call(IntPtr ob, IntPtr args, IntPtr kw)
at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw)
at Python.Runtime.Dispatcher.TrueDispatch(ArrayList args)
at Python.Runtime.Dispatcher.Dispatch(ArrayList args)
at FranticX.Processes.ManagedProcess.PostRenderTasks()
at FranticX.Processes.ManagedProcess.Execute(Boolean waitForExit)
at Deadline.Plugins.PluginWrapper.RenderTasks(String taskId, Int32 startFrame, Int32 endFrame, String& outMessage, AbortLevel& abortLevel)

Hi,
I think your syntax is just slightly out here. Note the “Id” at the end of GetCurrentTask and the comma after “[task,]”.

job = self.GetJob() task = self.GetCurrentTaskId() RepositoryUtils.FailTasks( job, [task,] )

Maybe I’m reading the documentation wrong (see below). If you’re right, then the API should read (Job job, int[] tasks).

static bool Deadline.Scripting.RepositoryUtils.FailTasks( Job job, Task[] tasks )

Also, I get the following error when I try your code:

Error: TypeError : No method matches given arguments (Python.Runtime.PythonException)
File “C:\Users\cloudops\AppData\Local\Thinkbox\Deadline8\slave\cloudops1\plugins\571fa08fa72e26193080bd4d\Immerge.py”, line 442, in PostRenderTasks
RepositoryUtils.FailTasks( job, [task,] )

I changed my syntax to better match yours except still pass in a Task object instead of Id (see below). The task are correctly failed now.

RepositoryUtils.FailTasks(self.GetJob(), [ self.GetCurrentTask(), ])

HOWEVER, after the last task fails, I get this error…

Sorry, I forgot we are talking 8.0 instead of Deadline 7.2 here! (self.GetCurrentTask() was sneakily added into 8.0). Yeah, so this syntax should be fine here:

RepositoryUtils.FailTasks(self.GetJob(), [ self.GetCurrentTask() ])

Do you still get an error with the last task fail when you remove the comma as per above? If so, I’ll log this as bug.

Yes. I have 3 tasks and each will call FailTasks in the PostRenderTasks step. The last task is the only one that generates the error.

I also get this error if I try to fail the job in a post job script.

ok, thanks. I’ll log it for further investigation.

EDIT: your running the latest beta version, right?