I have a script that was working fine on Deadline 6.2, but some of the API commands didn’t transfer over to DL7. I looked at the most recent API reference and found that the naming of the command doesn’t appear to have changed. The console isn’t showing me an error when I try to run it, but the tasks don’t get requeued.
selectedJobs = MonitorUtils.GetSelectedJobs()
jobTasks = RepositoryUtils.GetJobTasks( job, True )
for task in jobTasks:
tasksToRequeue.append(task)
RepositoryUtils.RequeueTasks( job, tasksToRequeue ) # This doesn’t do anything now
I just tested with Deadline 7.0.2.3 (the latest public release), and it worked fine for me. Here’s the code for the job right-click script I was testing with:
from Deadline.Scripting import *
def __main__():
jobs = MonitorUtils.GetSelectedJobs()
for job in jobs:
jobTasks = RepositoryUtils.GetJobTasks( job, True )
tasksToRequeue = []
for task in jobTasks:
tasksToRequeue.append(task)
RepositoryUtils.RequeueTasks( job, tasksToRequeue )
Can you upload your script? Also, can you check the version of your Monitor that you’re running the script from?
Thanks!
Ryan
Using Deadline Monitor 7.0.2.2 R (c92848960)
[code]import os, sys
from Deadline.Scripting import *
from Deadline.Jobs import *
def main( *args ):
selectedJobs = MonitorUtils.GetSelectedJobs()
for job in selectedJobs:
tasksToRequeue = [] # List of all failed tasks for current job
reportsToDelete = [] # List of all the error reports for the failed tasks on the current job
jobID = job.ID
reportCollection = RepositoryUtils.GetJobReports( jobID ) # All reports, including requeues and completed tasks
errorReports = reportCollection.GetErrorReports() # Filters out the reports that aren't full blown errors
jobTasks = RepositoryUtils.GetJobTasks( job, True ) # List of tasks for the current job
for task in jobTasks:
if task.TaskStatus == 'Failed': # Only pay attention to failed tasks
tasksToRequeue.append(task) # Adds the current task to the list of failed tasks to requeue
for report in errorReports:
if int(report.ReportTaskID) == int(task.TaskId): # Check to see if the current error report came from one of the failed tasks
reportsToDelete.append(report) # Add the error report to list of reports that will be deleted
RepositoryUtils.DeleteJobReports( jobID, reportsToDelete ) # Deletes all of the error reports for the failed tasks
RepositoryUtils.RequeueTasks( job, tasksToRequeue ) # Requeues all of the failed tasks[/code]
Ryan, we haven’t rolled out 2.3 yet. Mostly because of the effort a full rollout takes, but also because the only change seems to have been something that’s not yet important to us (according to the change logs):
"3ds Max Improvements
- Fixed a bug for 3ds Max 2015 when checking the visibility of the SceneExplorer prior to rendering."
Since you are working with failed tasks, try using RepositoryUtils.ResumeFailedTasks() instead of RepositoryUtils.RequeueTasks(). That should do the trick.
If RequeueTasks() worked with Deadline 6.x, I’m guessing a “fix” is the reason why it doesn’t work in v7, since RequeueTasks() was only meant to requeue completed tasks.
Cheers,
Ryan
Worked like a charm! Thanks Ryan.