def singleFrameTask(self, frame): """ Single frame render task. Takes a single frame as argument and adds other options from self.cmdargs Options are written to the cmdline in the order they are added to the cmd obj. """ name = 'Main_IndivFr__%s' % frame label = 'Shake : Render : %s :: %s' % (frame, name) task = Task(name, label) cmd = task.addRemoteCmd() cmd.addShell('/bin/bash -c') cmd.addExecutable('shake') cmd.service = 'ShakeRender' cmd.tags = ['shake'] cmd.addOption('-exec') cmd.addOption(self.command['file']) cmd.addOption('-vv') if self.command['proxyscale']: cmd.addOption('-proxyscale', self.command['proxyscale']) cmd.addOption('-t', frame) if self.job['progress']: cmd.addPipe(self.job['progress']) return task
def singleFrameTask(self, frame): """ Single frame render task. Takes a single frame as argument and adds other options from self.cmdargs Options are written to the cmdline in the order they are added to the cmd obj. """ name = 'Main_IndivFr__%s' % frame label = 'Nuke : Render : %s :: %s' % (frame, name) task = Task(name, label) cmd = task.addRemoteCmd() cmd.addExecutable('nuke') cmd.tags = ['nuke'] cmd.service = 'NukeRender' cmd.addOption('-x') if 'quiet' in self.command: if self.command['quiet'] == True: cmd.addOption('-q') if self.command['fullsize'] == True: cmd.addOption('-f') if 'threads' in self.command: cmd.addOption('-m', self.command['threads']) cmd.addOption('-F', frame) cmd.addOption(self.command['file']) if self.job['progress']: cmd.addPipe(self.job['progress']) return task
def multiFrameTask(self, f_range): name = 'Main_MultiFr__%s_%s' % (f_range['first'], f_range['last']) label = 'Shake : Render : %s-%s :: %s' % (f_range['first'], f_range['last'], name) task = Task(name, label) cmd = task.addRemoteCmd() cmd.addShell('/bin/bash -c') cmd.addExecutable('shake') cmd.service = 'ShakeRender' cmd.tags = ['shake'] cmd.addOption('-exec') cmd.addOption(self.command['file']) cmd.addOption('-vv') if self.command['proxyscale']: cmd.addOption('-proxyscale', self.command['proxyscale']) if 'step' in f_range: cmd.addOption( '-t', "%s-%sx%s" % (f_range['first'], f_range['last'], f_range['step'])) else: cmd.addOption('-t', "%s-%s" % (f_range['first'], f_range['last'])) if self.job['progress']: cmd.addPipe(self.job['progress']) return task
def multiFrameTask(self, f_range): name = 'Main_MultiFr__%s_%s' % ( f_range['first'], f_range['last'] ) #Main will be replaced with LAYERNAME in layer based renders label = 'Maya : Render : %s-%s' % (f_range['first'], f_range['last']) task = Task(name, label) cmd = task.addRemoteCmd() #cmd.addShell( '/bin/bash -c' ) cmd.addExecutable('maya-render') cmd.service = 'MRfMRender' cmd.tags = ['maya'] cmd.addOption('-r', "mr") cmd.addOption('-v', 5) cmd.addOption('-im', self.job['imagename']) if self.job['projectpath']: cmd.addOption('-rd', ('%s/images') % self.job['projectpath']) if 'threads' in self.command: cmd.addOption('-rt', self.command['threads']) cmd.addOption('-s', "%s" % f_range['first']) cmd.addOption('-e', "%s" % f_range['last']) if 'step' in f_range: cmd.addOption('-b', "%s" % f_range['step']) if self.job['layers']: cmd.addOption('-rl', self.job['layers']) cmd.addOption(self.command['file']) if self.job['progress']: cmd.addPipe(self.job['progress']) return task
def multiFrameTask(self, f_range): name = 'Main_MultiFr__%s_%s' % (f_range['first'], f_range['last']) label = 'Nuke : Render : %s-%s :: %s' % (f_range['first'], f_range['last'], name) task = Task(name, label) cmd = task.addRemoteCmd() cmd.addShell('/bin/bash -c') cmd.addExecutable('nuke') cmd.tags = ['nuke'] cmd.service = 'NukeRender' if 'quiet' in self.command: if self.command['quiet'] == True: cmd.addOption('-q') if self.command['fullsize'] == True: cmd.addOption('-f') if 'threads' in self.command: cmd.addOption('-m', self.command['threads']) if 'step' in f_range: cmd.addOption( '-F', "%s-%sx%s" % (f_range['first'], f_range['last'], f_range['step'])) else: cmd.addOption('-F', "%s-%s" % (f_range['first'], f_range['last'])) cmd.addOption('-x') cmd.addOption(self.command['file']) if self.job['progress']: cmd.addPipe(self.job['progress']) return task
def singleFrameTask(self, frame): """ Single frame render task. Takes a single frame as argument and adds other options from self.cmdargs Options are written to the cmdline in the order they are added to the cmd obj. """ name = 'Main_IndivFr__%s' % frame label = 'Maya : Render : %s :: %s' % (frame, name) task = Task(name, label) cmd = task.addRemoteCmd() #cmd.addShell( '/bin/bash -c' ) cmd.addExecutable('maya-render') cmd.service = 'MRfMRender' cmd.tags = ['maya'] cmd.addOption('-r', "mr") cmd.addOption('-v', 5) cmd.addOption('-im', self.job['imagename']) if self.job['projectpath']: cmd.addOption('-rd', ('%s/images') % self.job['projectpath']) if 'threads' in self.command: cmd.addOption('-rt', self.command['threads']) cmd.addOption('-s', frame) cmd.addOption('-e', frame) if self.job['layers']: cmd.addOption('-rl', self.job['layers']) cmd.addOption(self.command['file']) if self.job['progress']: cmd.addPipe(self.job['progress']) return task
#!/usr/bin/env python # # Example script demonstrating building a simple tree of tasks which # can be executed of iterated over. # from tractor.api.tasktree import Job, Task, RemoteCmd import tractor.api.serialize as serialize myjob = Job('Simple Job Script') task1 = Task('1', 'Task number 1') cmd1 = task1.addRemoteCmd(service='Default') cmd1.addExecutable('echo') cmd1.addOption('hello') myjob.addTask(task1) task2 = myjob.addTask('2') cmd2 = RemoteCmd('echo hello') task2.addRemoteCmd(cmd2) serializer = tractor.TractorSerializer(myjob) serializer.spool('stdout') """ job = { type':'job', 'label':'Simple Job Script', 'tasks': { 'task1': { 'type':'task', 'cmds': [ 'cmd1':{
def mainTask(self): maintask = Task('Main__') for thisrange in self.job['framerange']: # ['1-10x2','11-20',25] if 'last' in thisrange: rangelength = thisrange['last'] - thisrange[ 'first'] + 1 #+1 for inclusive range if rangelength > self.job['chunksize'] and self.job[ 'chunksize'] != 0: #number of frames is greater than a single chunk. need to split chunkCount = int(rangelength / self.job['chunksize']) chunkRemainder = rangelength % self.job['chunksize'] for chunk in range( chunkCount ): #frame range for the chunk (firstframe, lastframe, step) chunkrange = dict() chunkrange['first'] = thisrange['first'] + ( chunk * self.job['chunksize']) chunkrange['last'] = chunkrange['first'] + ( self.job['chunksize'] - 1 ) # inclusive of the first frame if 'step' in thisrange: chunkrange['step'] = thisrange['step'] maintask.addTask( self.multiFrameTask(chunkrange) ) # this is not strictly correct. If len(chunkrange)==1 then a single frame should be used. if chunkRemainder: if chunkRemainder > 1: remainder_range = {} remainder_range['first'] = thisrange['first'] + ( self.job['chunksize'] * chunkCount) remainder_range['last'] = thisrange['last'] if 'step' in thisrange: remainder_range['step'] = thisrange['step'] maintask.addTask( self.multiFrameTask(remainder_range)) else: maintask.addTask( self.singleFrameTask(thisrange['last'])) else: maintask.addTask(self.multiFrameTask( thisrange)) #no chunking is required for the range else: maintask.addTask(self.singleFrameTask( thisrange['first'])) #single frame task return maintask
def previewTask(self): previewtask = Task('Preview__') return previewtask