Author Topic: cannot get chunk frame working  (Read 11083 times)

bijuramavfx

  • Sr. Member
  • ****
  • Posts: 40
cannot get chunk frame working
« on: November 05, 2012, 09:54:28 PM »
Hi there:

Here is the code I am trying to execute for render chekc of frames as one job - but the jobs are not taking into account the specified chunk parameter. ..? In the Job properties in Qube GUI, it does shows up those value

Package
cmdline         : rez-run "katana" -- "CUE_THREADS=24 katana" --batch  "/home/bramachandran/dropbox/katanatest/testKatana.katana"  -t QB_FRAME_START-QB_FRAME_END --render-node="Render"
frameCount      : 10
range           : 1-10
rangeChunkSize  : 2
rangeExecution  : chunks:2
rendernode      : Render
script          : /home/bramachandran/dropbox/katanatest/testKatana.katana
simpleCmdType   : Katana REZ

Code:--
 
        qubeJob = qb.Job()
        qubeJob['name'] = job.sceneName
        qubeJob['prototype'] = 'cmdrange'
        qubeJob['package'] = {'cmdline' : jobCommandLine,
                              'range'   :   job.frames,
                              'frameCount'  : 10,
                              'renderNode'  : 'Render',
                              'script'      : job.scene,
                              'rangeChunkSize' : job.frameBatchSize,
                              'rangeExecution' : "chunks:" + str(job.frameBatchSize)
                                                          
                              }
        qubeJob['agenda'] = qb.genframes(qubeJob['package']['range'])
        jobId = qb.submit(qubeJob)
        return '%(id)s' %jobId[0]            

Thanks
/Biju

bijuramavfx

  • Sr. Member
  • ****
  • Posts: 40
Re: cannot get chunk frame working
« Reply #1 on: November 05, 2012, 10:16:56 PM »
This worked

if job.frameBatchSize:
            qubeJob['agenda'] = qb.genchunks(qubeJob['package']['rangeChunkSize'],qubeJob['package']['range'])
        else:
            qubeJob['agenda'] = qb.genframes(qubeJob['package']['range'])

Thanks
/Biju

jburk

  • Administrator
  • *****
  • Posts: 493
Re: cannot get chunk frame working
« Reply #2 on: November 05, 2012, 11:07:15 PM »
Nice catch.  qb.genchunks is useful when you know how big the chunksize is, and you don't care how many chunks you get.
 
There is also a
Code: [Select]
qb.genpartitions() call, which is useful when you want to specify the number of chunks, and don't care how big the chunksize is.  Usually used when you want to do something like: "I'd like to render these 723 frames across 14 machines, and I want to only send 1 chunk to each machine".

qb.genpartitions(14, '1-723') returns:

['1-52', '53-104', '105-156', '157-208', '209-260', '261-312', '313-364', '365-416', '417-468', '469-520', '521-572', '573-624', '625-676', '677-723']

Code: [Select]
genpartitions(numPartitions, range, *extraRanges, **kwargs)

Generate a work agenda (individual Work items) based upon range list splitting frame range into <n> partitions.

[b]Parameters[/b]:
numPartitions (int) - number of partitions to split the range into
range (str) - Frame range string (additional ranges can be specified)

n1 (ie. 1)
n1,n2,... -- comma separated list (i.e. 1,2,3,5,10)
n1-n2 -- n1 through n2 (i.e. 1-10)
n1-n2xStep -- n1 through n2, step Step (i.e. 1-10x2)
binarySort (bool) - perform a binary sort (first, last, middle) on the resulting order (default=False)

[b]Returns[/b]:
list of Work instances. ([Work])

See Also:
rangesplit, rangechunk, rangepartition, genframes, genchunks, genpartitions


Examples:
qb.genpartitions(2, '1-10') - returns ['1-5, '6-10']
qb.genpartitions(2, '-10--1') - retruns ['-10--6', '-5--1']