Hi guys. I have been really struggling to understand anything in the scripting reference. I’ve gotten stuff to work a little bit by looking into the example scripts that came with Deadline, but I’m afraid I cannot make any sense at all out of the scripting reference supplied. I am having to launch deadlinecommand.exe as a subprocess and use large sweeping commands that will give me ALL of the information for a job, and then I parse out the stuff I’m looking for. This is obviously not ideal.
For example, I’m trying to write a script that will just give users an ETA based on how many tasks they have total, completed, queued, etc. I want to incorporate the “Task Time” as supplied in the tasks panel in the monitor. I am able to find most of that information, but I can’t seem to figure out how to get the specifics from the tasks panel. Here is my script so far.
from Deadline.Scripting import *
from DeadlineUI.Controls.Scripting.DeadlineScriptDialog import DeadlineScriptDialog
import sys
import os
#import string
#import datetime
#import timespan
scriptDialog = None
def main():
global scriptDialog
scriptDialog = DeadlineScriptDialog()
timeHack = 12
submitUser = ClientUtils.GetDeadlineUser()
jobs = MonitorUtils.GetSelectedJobs()
myJob = jobs[0]
queuedFrames = myJob.JobQueuedTasks
renderingFrames = myJob.JobRenderingTasks
failedFrames = myJob.JobFailedTasks
completedFrames = myJob.JobCompletedTasks
‘’‘Here is where I want to get the render time for each task for the given job. I have tried every combination of everything I find in the scripting reference and I can’t figure this out. I then want to add up all the time and do some calculations, then make timeHack equal to my result and tell the users’’’
scriptDialog.ShowDialog( False )
scriptDialog.CloseDialog()
scriptDialog.ShowMessageBox( "ETA is %s hours. "%timeHack, "ETA" )
I guess my question is, what is the proper procedure for getting all of the task info when I right-click on a job and run the script? It seems like I have to pass information between RepositoryUtils, ClientUtils, JobUtils, MonitorUtils, and finally somehow get this result. I have been spending a LOT of time going through this scripting reference and I still can’t figure out how 95% of this stuff is meant to be used because most of it generally lacks a description at all. I think one key thing that is missing in this reference is example code.
For example, I can look under Deadline.Jobs.Job Class Reference and go to “Detailed Description,” all it says is “A job.” What am I supposed to take from that? I think putting a few snippets of example usage would be beneficial for everybody, or at least a “detailed description” for those of us that aren’t necessarily coding Gurus.