script modify frame range

Hi!
i want to modify frame range by script. Everything is ok in deadline monitor but actually deadline ignores new framerange and render whole sequence:

def __main__():
    for i, job in enumerate(JobUtils.GetSelectedJobs()):
        JobUtils.SetCurrentJobValue(i, 'FramesList', DRAFT_RANGE) # some variable
        RepositoryUtils.SaveJob(job)
    JobUtils.RefreshSelectedJobs()

i guess the reason is the tasks don’t update (refresh/invalidate) - the contents of ‘tasks’ folder don’t update by my script.
What should i do to make changes?
Thank you!

There is a deadlinecommand.exe option to change a job’s frame range:

SetJobFrameRange              Modifies the job's frame range
  [Job ID(s)]                 The job ID, or a list of job IDs separated by
                              commas
  [Frame List]                The new frame list
  [Chunk Size]                The new chunk size
  [Reorder Frames]            true/false (optional)

You can build up these arguments in a script, and then call ClientUtils.ExecuteCommand (or ScriptUtils.ExecuteCommand, if you’re on a pre-5.1 version of Deadline):
thinkboxsoftware.com/deadlin … toverview/

Something like this should work:

from System.Collections.Specialized import *

def __main__():
    for i, job in enumerate(JobUtils.GetSelectedJobs()):
        args = StringCollection()
        args.Add( "SetJobFrameRange" )
        args.Add( job.JobId )
        args.Add( DRAFT_RANGE )
        args.Add( job.JobChunkSize )
        ClientUtils.ExecuteCommand( args )
    JobUtils.RefreshSelectedJobs()

Note that this also assumes you’re on 5.1, but you can use the JobUtils functions to get the job ID and chunk size if you’re on a pre-5.1 version of Deadline.

Cheers,

  • Ryan

Thank you very much, Ryan!
It works.

The only thing i want to know - where can i find such argument ‘SetJobFrameRange’?
The search doesn’t match and here
( thinkboxsoftware.com/deadlin … ne_Options )
there is no info about it…

Hi Michael,

You can get the full listing of DeadlineCommand commands and arguments by running the command “deadlinecommand -help” from a console. The output is fairly long, however, so it’s probably better to pipe it to a file, by doing something like “deadlinecommand -help > deadline_command.txt”. That command will created a file called “deadline_command.txt” in the current working directory that contains the full help listing of DeadlineCommand.

If you want information on a specific command, you can specify the name of that command after the ‘-help’ argument. For example, you can execute “deadlinecommand -help SetJobFrameRange”, which will give you the help section on ‘SetJobFrameRange’ (which happends to be the snippet that Ryan provided you with in his post :slight_smile:)

Let us know if you have any more questions!

Cheers,

  • Jon

Thanks Jon!
It’s brilliant! :slight_smile:
Thank you very much for your splendid work!