AWS Thinkbox Discussion Forums

Python script update progress

I have written a custom python script which points to a folder and runs the script, it gets submitted alongside the job and plugin files. I want to find out if there is a way to put SetProgress points along my python script to update the progress bar in Monitor. Is this possible without having to write it as a plugin instead?

In theory, Since the Current python plugin has no AddStdoutHandlerCallback handler for progress, you would need to add one.

you should be able to add something like:

in def InitializeProcess(self):

self.AddStdoutHandlerCallback( "progr: +([0-9]+\\.[0-9]+)% +processed").HandleCallback +=  self.setProgress()

then make a new function:

def setProgress(self):
    startFrame = self.deadlinePlugin.GetStartFrame()
    endFrame = self.deadlinePlugin.GetEndFrame()
    if (endFrame - startFrame + 1 != 0):
        self.deadlinePlugin.SetProgress(
            (float(self.GetRegexMatch(1)) + self.FinishedFrameCount * 100) / (endFrame - startFrame + 1))
        self.deadlinePlugin.SetStatusMessage(self.GetRegexMatch(0))

In Theory is should work, we already have expanded the errors to fail on in our studio version of the python plugin, so i dont see why it wouldnt be able to catch on a progress as well.

hope this helps.
Kym

1 Like

The later versions of the Python and Command Line plugins do have a progress handler these days (check out my findings in this other thread). The short of it is that the Shell Execute feature on the Command Line plugin is missing the progress reporting.

1 Like
Privacy | Site terms | Cookie preferences