AWS Thinkbox Discussion Forums

Total Clock Running Time of selected tasks?

I’m probably missing something incredibly simple and right on the main interface, but I can’t find what I’m looking for and there’s no mention in the documentation…
How can I know the total render time of all completed tasks I’ve selected in the Monitor? I’d like to add together the “Clock Running Time”…time of the selected tasks and now the total amount of time taken.

Tasks or jobs? Either way, it sounds like you need a quick monitor script to make this happen.

It’s pretty straight forward, you just need to decide how you want to access the script. Eg:
Right click on selected jobs, etc.

Jobs.
So it’s not a built-in feature but needs to be scripted? Sounds rather strange, I felt like it’s something everyone would want to check…
Thanks anyway.

I’m not disagreeing with you, just saying how you could go about fixing it yourself.

Since we now know that you’re interested in running this from the Jobs panel, here’s a script that will get you started:

from Deadline.Scripting import MonitorUtils # pylint: disable=import-error,no-name-in-module
from DeadlineUI.Controls.Scripting.DeadlineScriptDialog import DeadlineScriptDialog # pylint: disable=import-error,no-name-in-module
from System import DateTime, TimeSpan # pylint: disable=import-error,no-name-in-module


def __main__():
    scriptDialog = DeadlineScriptDialog()
    scriptDialog.SetTitle('Total runtime for selected jobs')
    scriptDialog.AddGrid()

    jobs = MonitorUtils.GetSelectedJobs()
    totalSeconds = 0

    if not jobs:
        scriptDialog.AddControlToGrid('InfoLabel', 'LabelControl', 'Nothing selected', 0, 0, '', False )
    else:
        for job in jobs:
            start = job.JobStartedDateTime
            if start == DateTime.MinValue:
                continue # Hasn't started yet, skip

            end = job.JobCompletedDateTime
            if end == DateTime.MinValue:
                end = DateTime.Now # Still active, using current time

            totalSeconds += end.Subtract(start).TotalSeconds

        duration = TimeSpan.FromSeconds(totalSeconds)
        scriptDialog.AddControlToGrid('InfoLabel', 'LabelControl', '{} days, {} hours, {} minutes, {} seconds'.format(duration.Days, duration.Hours, duration.Minutes, duration.Seconds), 0, 0, '', False )

    close_button = scriptDialog.AddControlToGrid('CloseButton', 'ButtonControl', 'Close', 1, 1, expand=False)
    close_button.ValueModified.connect(lambda: scriptDialog.CloseDialog())
    scriptDialog.EndGrid()
    scriptDialog.ShowDialog(True)

This needs to be saved as a .py file in <SERVER>/DeadlineRepository/custom/scripts/Jobs

Annoyingly though, in your Deadline Monitor, as an admin, you need to allow this script to run for multi-select.

From Tools > Configure Script Menus:

Hi Daniel,

I was looking for doing this for a long time and the script worked a treat.

Many thanks for sharing that.

Femi

1 Like
Privacy | Site terms | Cookie preferences