Completing task in pre task script skips the post task script

Greetings,

I’m trying do to a basic frame freeze with pre and post task scripts. The goal is to automatically complete all tasks whose ID is not 0 so it doesn’t render the frame. While trying to see if the basics work, I found out that the way I complete the task skips the post task script which wouldn’t be a bother in normal times, but it is when I’m trying to debug the post task script.

Here’s the pre task script :

from Deadline.Scripting import *

def __main__(*args):
    deadlinePlugin = args[0]
    deadlinePlugin.LogInfo("---[STARTING PRE-TASK SCRIPT]---")
    deadlinePlugin.LogStdout("DEBUG : Current task ID is {}".format(deadlinePlugin.GetCurrentTaskId()))
    if deadlinePlugin.GetCurrentTaskId() != "0":
        deadlinePlugin.LogStdout("This task isn't the first frame, setting to complete")
        tasks = []
        tasks.append(deadlinePlugin.GetCurrentTask())
        job = deadlinePlugin.GetJob()
        slaveName = deadlinePlugin.GetSlaveName()
        deadlinePlugin.SetProgress(100)
        RepositoryUtils.CompleteTasks(job, tasks, slaveName)
    else:
        deadlinePlugin.LogStdout("This task is the first frame, proceed with frame rendering")
    deadlinePlugin.LogInfo("---[ENDING PRE-TASK SCRIPT]---")

Is there another way to complete the task? I haven’t found any documentation about what that deadlinePlugin at the beginning contains so I kinda had to find it myself the hard way and found these methods : https://pastebin.com/9DHDzd38
And had to roll with it, but there’s nothing about completing the current task in there.

Hey Daniel,

I am not very familiar with what’s frame freeze . So it is not clear what you are trying to do here by marking the task complete in the pre-task script. If you are interested only in the first frame render output may be you could edit the frame list?
Here is a script that might interest you, basically submits the Job as suspended and enables only specific tasks. https://github.com/ThinkboxSoftware/Deadline/tree/master/Custom/events/AutomaticPreviewJobSubmission
I would expect the post task script to be called once a task completes. So not really sure what’s wrong here.
More information on what you are trying to achieve would help me give you better alternative, if the above suggestions dont help.