Get Averagerendertasktime from selected job

Hi everybody,

I’m in a kind of trouble in the moment, I’m trying with a script to get the Average rendering time from jobs I’ve selected. Quite like the script “CopyJobId”

is it a way to get those information from a script or maybe is it possible to add in the jobs panel a “AverageTaskRenderTime” Column ?

Here’s the script i’m working on

[code]import os, sys

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from Deadline.Scripting import *
from Deadline.Jobs import *

def main( *args ):
print “hello world”
selectedJobs = MonitorUtils.GetSelectedJobs()
QApplication.clipboard().setText("")
if len(selectedJobs) > 0:
timeSpans = []
for job in selectedJobs:
taskCollectionObject = RepositoryUtils.GetJobTasks(job,False)
jobEntryObject = JobUtils.CalculateJobStatistics(job, taskCollectionObject)
timeSpans.append( (jobEntryObject.AverageTaskRenderTime.Seconds) )

	QApplication.clipboard().setText(str(timeSpans))[/code]

You need to use TotalSeconds instead of Seconds for the AverageTaskRenderTime property. See the docs for these properties to see the difference.
msdn.microsoft.com/en-us/library … conds.aspx
msdn.microsoft.com/en-us/library … conds.aspx

This should do the trick:

timeSpans.append( (jobEntryObject.AverageTaskRenderTime.TotalSeconds) )

Cheers,

  • Ryan

Thank you very much,

Now the script works perfectly with those alterations

[code]import os, sys

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from Deadline.Scripting import *
from Deadline.Jobs import *

def main( *args ):
print “hello world”
selectedJobs = MonitorUtils.GetSelectedJobs()
QApplication.clipboard().setText("")
if len(selectedJobs) > 0:
timeSpans = []
for job in selectedJobs:
taskCollectionObject = RepositoryUtils.GetJobTasks(job,False)
jobEntryObject = JobUtils.CalculateJobStatistics(job, taskCollectionObject)
# timeSpans.append(jobEntryObject.AverageTaskRenderTime.TotalSeconds)
timeSpans.append( str(jobEntryObject.AverageTaskRenderTime.TotalSeconds ))

	clipboardString1 = '\n'.join( timeSpans )
	QApplication.clipboard().setText(str(clipboardString1))[/code]