def genJob(self, blockparams): if VERBOSE: print 'Generating job on "%s"' % self.job_name if len(blockparams) < 1: print('Can`t generate job without any blocks on "%s"' % self.afnode.name()) return # Calculate temporary hip name: ftime = time.time() tmphip = hou.hipFile.name() + '_' + afcommon.filterFileName( self.job_name) + time.strftime('.%m%d-%H%M%S-') + str( ftime - int(ftime))[2:5] + ".hip" # use mwrite, because hou.hipFile.save(tmphip) # changes current scene file name to tmphip, at least in version 9.1.115 hou.hscript('mwrite -n "%s"' % tmphip) job = af.Job() job.setName(self.job_name) if self.start_paused: job.offLine() if self.platform != '': if self.platform == 'any': job.setNeedOS('') else: job.setNeedOS(self.platform) if self.priority != -1: job.setPriority(self.priority) if self.depend_mask != '': job.setDependMask(self.depend_mask) if self.depend_mask_global != '': job.setDependMaskGlobal(self.depend_mask_global) if self.max_runtasks > -1: job.setMaxRunningTasks(self.max_runtasks) if self.maxperhost > -1: job.setMaxRunTasksPerHost(self.maxperhost) if self.hosts_mask != '': job.setHostsMask(self.hosts_mask) if self.hosts_mask_exclude != '': job.setHostsMaskExclude(self.hosts_mask_exclude) for blockparam in blockparams: job.blocks.append(blockparam.genBlock(tmphip)) job.setCmdPost('deletefiles "%s"' % tmphip) if VERBOSE: job.output(True) job.send()
def genJob( self, blockparams): if VERBOSE: print 'Generating job on "%s"' % self.job_name if len( blockparams) < 1: print('Can`t generate job without any blocks on "%s"' % self.afnode.name()) return # Calculate temporary hip name: ftime = time.time() tmphip = hou.hipFile.name() + '_' + afcommon.filterFileName(self.job_name) + time.strftime('.%m%d-%H%M%S-') + str(ftime - int(ftime))[2:5] + ".hip" # use mwrite, because hou.hipFile.save(tmphip) # changes current scene file name to tmphip, at least in version 9.1.115 hou.hscript('mwrite -n "%s"' % tmphip) job = af.Job() job.setName( self.job_name ) if self.start_paused: job.offLine() if self.platform != '': if self.platform == 'any': job.setNeedOS('') else: job.setNeedOS( self.platform) if self.priority != -1: job.setPriority( self.priority) if self.depend_mask != '': job.setDependMask( self.depend_mask) if self.depend_mask_global != '': job.setDependMaskGlobal( self.depend_mask_global) if self.max_runtasks > -1: job.setMaxRunningTasks( self.max_runtasks) if self.maxperhost > -1: job.setMaxRunTasksPerHost( self.maxperhost) if self.hosts_mask != '': job.setHostsMask( self.hosts_mask) if self.hosts_mask_exclude != '': job.setHostsMaskExclude( self.hosts_mask_exclude) for blockparam in blockparams: job.blocks.append( blockparam.genBlock( tmphip)) job.setCmdPost('deletefiles "%s"' % tmphip) if VERBOSE: job.output( True) job.send()
def genJob(self, blockparams): if VERBOSE: print('Generating job on "%s"' % self.job_name) if len(blockparams) < 1: print('Can`t generate job without any blocks on "%s"' % self.afnode.name()) return job = af.Job() job.setName(self.job_name) if self.afnode.parm('wait_time').eval(): hours = int(self.afnode.parm('wait_time_hours').eval()) minutes = int(self.afnode.parm('wait_time_minutes').eval()) hours = max(0, min(hours, 23)) minutes = max(0, min(minutes, 59)) now_sec = int(time.time()) now_day = int((now_sec - time.timezone) / (24 * 3600)) * (24 * 3600) + time.timezone sec = now_sec % 60 wait_sec = now_day + (hours * 3600) + (minutes * 60) + sec if wait_sec <= now_sec: if hou.ui.displayMessage( ('Now is greater than %d:%d\nOffset by 1 day?' % (hours, minutes)), buttons=('Offset', 'Abort'), default_choice=0, close_choice=1, title=('Wait Time')) == 0: wait_sec += (24 * 3600) else: return job.setWaitTime(wait_sec) renderhip = hou.hipFile.name() if self.afnode.parm('render_temp_hip').eval(): # Calculate temporary hip name: ftime = time.time() renderhip = '%s/%s%s%s.hip' % ( os.path.dirname(renderhip), afcommon.filterFileName(self.job_name), time.strftime('.%m%d-%H%M%S-'), str(ftime - int(ftime))[2:5]) # use mwrite, because hou.hipFile.save(renderhip) # changes current scene file name to renderhip, # at least in version 9.1.115 hou.hscript('mwrite -n "%s"' % renderhip) if self.start_paused: job.offLine() if self.preview_approval: job.setPPApproval() if self.platform != '': if self.platform == 'any': job.setNeedOS('') else: job.setNeedOS(self.platform) if self.job_branch != '': job.setBranch(self.job_branch) if self.priority != -1: job.setPriority(self.priority) if self.depend_mask != '': job.setDependMask(self.depend_mask) if self.depend_mask_global != '': job.setDependMaskGlobal(self.depend_mask_global) if self.max_runtasks > -1: job.setMaxRunningTasks(self.max_runtasks) if self.maxperhost > -1: job.setMaxRunTasksPerHost(self.maxperhost) if self.hosts_mask != '': job.setHostsMask(self.hosts_mask) if self.hosts_mask_exclude != '': job.setHostsMaskExclude(self.hosts_mask_exclude) job.setFolder('input', os.path.dirname(hou.hipFile.name())) images = None for blockparam in blockparams: job.blocks.append(blockparam.genBlock(renderhip)) # Set ouput folder from the first block with images to preview: if images is None and blockparam.preview != '': images = blockparam.preview job.setFolder('output', os.path.dirname(images)) if self.afnode.parm('render_temp_hip').eval(): job.setCmdPost('deletefiles "%s"' % renderhip) if VERBOSE: job.output(True) job.send()
def genJob(self, blockparams): if VERBOSE: print('Generating job on "%s"' % self.job_name) if len(blockparams) < 1: print('Can`t generate job without any blocks on "%s"' % self.afnode.name()) return renderhip = hou.hipFile.name() if self.afnode.parm('render_temp_hip').eval(): # Calculate temporary hip name: ftime = time.time() renderhip = '%s_%s%s%s.hip' % ( renderhip, afcommon.filterFileName(self.job_name), time.strftime('.%m%d-%H%M%S-'), str(ftime - int(ftime))[2:5]) # use mwrite, because hou.hipFile.save(renderhip) # changes current scene file name to renderhip, # at least in version 9.1.115 hou.hscript('mwrite -n "%s"' % renderhip) job = af.Job() job.setName(self.job_name) if self.start_paused: job.offLine() if self.preview_approval: job.setPPApproval() if self.platform != '': if self.platform == 'any': job.setNeedOS('') else: job.setNeedOS(self.platform) if self.priority != -1: job.setPriority(self.priority) if self.depend_mask != '': job.setDependMask(self.depend_mask) if self.depend_mask_global != '': job.setDependMaskGlobal(self.depend_mask_global) if self.max_runtasks > -1: job.setMaxRunningTasks(self.max_runtasks) if self.maxperhost > -1: job.setMaxRunTasksPerHost(self.maxperhost) if self.hosts_mask != '': job.setHostsMask(self.hosts_mask) if self.hosts_mask_exclude != '': job.setHostsMaskExclude(self.hosts_mask_exclude) job.setFolder('input', os.path.dirname(hou.hipFile.name())) images = None for blockparam in blockparams: job.blocks.append(blockparam.genBlock(renderhip)) # Set ouput folder from the first block with images to preview: if images is None and blockparam.preview != '': images = blockparam.preview job.setFolder('output', os.path.dirname(images)) if self.afnode.parm('render_temp_hip').eval(): job.setCmdPost('deletefiles "%s"' % renderhip) if VERBOSE: job.output(True) job.send()
def genJob(self, blockparams): if VERBOSE: print('Generating job on "%s"' % self.job_name) if len(blockparams) < 1: print('Can`t generate job without any blocks on "%s"' % self.afnode.name()) return job = af.Job() job.setName(self.job_name) if self.afnode.parm('wait_time').eval(): hours = int(self.afnode.parm('wait_time_hours').eval()) minutes = int(self.afnode.parm('wait_time_minutes').eval()) hours = max(0,min(hours,23)) minutes = max(0,min(minutes,59)) now_sec = int(time.time()) now_day = int((now_sec - time.timezone) / (24*3600)) * (24*3600) + time.timezone sec = now_sec % 60 wait_sec = now_day + (hours * 3600) + (minutes * 60) + sec if wait_sec <= now_sec: if hou.ui.displayMessage( ('Now is greater than %d:%d\nOffset by 1 day?' % (hours,minutes)), buttons=('Offset', 'Abort'), default_choice=0, close_choice=1, title=('Wait Time') ) == 0: wait_sec += (24*3600) else: return job.setWaitTime(wait_sec) renderhip = hou.hipFile.name() if self.afnode.parm('render_temp_hip').eval(): # Calculate temporary hip name: ftime = time.time() renderhip = '%s/%s%s%s.hip' % ( os.path.dirname(renderhip), afcommon.filterFileName(self.job_name), time.strftime('.%m%d-%H%M%S-'), str(ftime - int(ftime))[2:5] ) # use mwrite, because hou.hipFile.save(renderhip) # changes current scene file name to renderhip, # at least in version 9.1.115 hou.hscript('mwrite -n "%s"' % renderhip) if self.start_paused: job.offLine() if self.preview_approval: job.setPPApproval() if self.platform != '': if self.platform == 'any': job.setNeedOS('') else: job.setNeedOS(self.platform) if self.job_branch != '': job.setBranch(self.job_branch) if self.priority != -1: job.setPriority(self.priority) if self.depend_mask != '': job.setDependMask(self.depend_mask) if self.depend_mask_global != '': job.setDependMaskGlobal(self.depend_mask_global) if self.max_runtasks > -1: job.setMaxRunningTasks(self.max_runtasks) if self.maxperhost > -1: job.setMaxRunTasksPerHost(self.maxperhost) if self.hosts_mask != '': job.setHostsMask(self.hosts_mask) if self.hosts_mask_exclude != '': job.setHostsMaskExclude(self.hosts_mask_exclude) job.setFolder('input', os.path.dirname(hou.hipFile.name())) images = None for blockparam in blockparams: job.blocks.append(blockparam.genBlock(renderhip)) # Set ouput folder from the first block with images to preview: if images is None and blockparam.preview != '': images = blockparam.preview job.setFolder('output', os.path.dirname(images)) if self.afnode.parm('render_temp_hip').eval(): job.setCmdPost('deletefiles "%s"' % renderhip) if VERBOSE: job.output(True) job.send()
def genJob(self, blockparams): if VERBOSE: print('Generating job on "%s"' % self.job_name) if len(blockparams) < 1: print('Can`t generate job without any blocks on "%s"' % self.afnode.name()) return # Calculate temporary hip name: ftime = time.time() tmphip = '%s_%s%s%s.hip' % ( hou.hipFile.name(), afcommon.filterFileName(self.job_name), time.strftime('.%m%d-%H%M%S-'), str(ftime - int(ftime))[2:5] ) # use mwrite, because hou.hipFile.save(tmphip) # changes current scene file name to tmphip, # at least in version 9.1.115 hou.hscript('mwrite -n "%s"' % tmphip) job = af.Job() job.setName(self.job_name) if self.start_paused: job.offLine() if self.platform != '': if self.platform == 'any': job.setNeedOS('') else: job.setNeedOS(self.platform) if self.priority != -1: job.setPriority(self.priority) if self.depend_mask != '': job.setDependMask(self.depend_mask) if self.depend_mask_global != '': job.setDependMaskGlobal(self.depend_mask_global) if self.max_runtasks > -1: job.setMaxRunningTasks(self.max_runtasks) if self.maxperhost > -1: job.setMaxRunTasksPerHost(self.maxperhost) if self.hosts_mask != '': job.setHostsMask(self.hosts_mask) if self.hosts_mask_exclude != '': job.setHostsMaskExclude(self.hosts_mask_exclude) job.setFolder('input', os.path.dirname( hou.hipFile.name())) images = None for blockparam in blockparams: job.blocks.append(blockparam.genBlock(tmphip)) # Set ouput folder from the first block with images to preview: if images is None and blockparam.preview != '': images = blockparam.preview job.setFolder('output', os.path.dirname( images)) job.setCmdPost('deletefiles "%s"' % tmphip) if VERBOSE: job.output(True) job.send()