Python scripting API

Im writing a post job script that will get the render times of all the tasks and write them to a file. My question is how to get a task render time?
Right now I only have the job which Im getting with the following code:

deadlinePlugin = args[0]
job = deadlinePlugin.GetJob() 

But that object does not return any task objects.
Is there some other way to access tasks by job?

You can use RepositoryUtils.GetJobTasks(job, True):

1 Like

Thank you, that’s what I end up using.
Do you know how I can recognize post jobs tasks? Are those the ones with id of -1?

Not sure. I’m surprised it does not seem possible to read the task’s plugin. That would be the “correct” way.

1 Like

Looks like -2 will be your Pre-Job and -1 will be your Post-Job.

Based on this test script:

from System import TimeSpan

from Deadline.Scripting import *
from Deadline.Jobs import *

job = RepositoryUtils.GetJob("5f89a64330d1f5707c796d7c", True)
tasks = RepositoryUtils.GetJobTasks(job, True)

for task in tasks.TaskCollectionAllTasks:
    print (task.TaskId)
    print (task.FrameString)

Run on a job that looks like this:

Giving this output:

C:\Users\jusbla>"%deadline_path%"\deadlinecommand -Executescript C:\Users\jusbla\Desktop\
Qt: Untested Windows version 10.0 detected!
Error: a __main__ method must be defined

That should get you going in the right direction!

1 Like
Privacy | Site terms | Cookie preferences