Post Job script: Accessing GetJobTaskAverageTime?

Hi,

Is it possible to access deadlinecommand functionality in PostJob Scripts via dotNet imports?

I’m particularly after GetJobTaskAverageTime for a the current Job and also averaging PeakRamUsage and/or AverageRam for all the Tasks of the Job.

I can of course launch a process and capture/parse its output, but was just curious if the more direct dotNet route was possible.

This thread got me wondering:
viewtopic.php?f=11&t=2438&p=10034&hilit=render+time+post+job#p10034

Thanks,
Paul

Hey Paul,

You can use the ExecuteCommand or ExecuteCommandAndGetOutput functions documented here:
thinkboxsoftware.com/deadlin … _Utilities

You just have to build up the arguments using .NET’s StringCollection class:
msdn.microsoft.com/en-us/library … ction.aspx

Hope this helps!

  • Ryan

That works nicely! Thanks

Example PostJob script below for anyone following the thread:

[code]from System.IO import *
from System.Collections.Specialized import StringCollection
from Deadline.Scripting import *

def main():

jobId = SlaveUtils.GetCurrentJobValue("JobId")
LogInfo("jobId: " + str(jobId))

## Gather Job Statistics
argCol = StringCollection()
argCol.Add("GetJobTaskAverageTime")
argCol.Add(jobId)
dlCommandOutput = ScriptUtils.ExecuteCommandAndGetOutput(argCol).strip()
LogInfo(dlCommandOutput)[/code]