diff --git a/plugins/houdini/otls/afanasyscheduler.hda b/plugins/houdini/otls/afanasyscheduler.hda index 488240665..d342f9adb 100644 Binary files a/plugins/houdini/otls/afanasyscheduler.hda and b/plugins/houdini/otls/afanasyscheduler.hda differ diff --git a/plugins/houdini/pdg/types/afanasyscheduler.py b/plugins/houdini/pdg/types/afanasyscheduler.py index 39bc15172..06cefd49e 100644 --- a/plugins/houdini/pdg/types/afanasyscheduler.py +++ b/plugins/houdini/pdg/types/afanasyscheduler.py @@ -52,9 +52,42 @@ def _initData(self): self._local_addr = self._getLocalAddr() + def _getWorkItemServiceAndParser(self, work_item): + # Set the default service values + service = 'hbatch' + # PDG uses "ALF_PROGRESS" everywhere + parser = 'mantra' + + topnode = work_item.node.topNode() + toptype = topnode.type().name() + if toptype == 'ropfetch': + # Try to detect ROP type + roppath = topnode.parm('roppath') + if roppath is not None: + ropnode = hou.node(roppath.eval()) + if ropnode: + roptype = ropnode.type().name() + if roptype == 'ifd': + service = 'hbatch_mantra' + elif toptype == 'ffmpegencodevideo': + service = 'ffmpeg' + parser = 'ffmpeg' + + # Service can be specified directly: + value = self.evaluateStringOverride(work_item.node, self.parmprefix, 'service', work_item, '') + if value is not None and len(value): + service = value + + # Parser can be specified directly: + value = self.evaluateStringOverride(work_item.node, self.parmprefix, 'parser', work_item, '') + if value is not None and len(value): + parser = value + + return service, parser + + def _constructJob(self): job = af.Job(self['job_name'].evaluateString()) - job.setBranch(self['job_branch'].evaluateString()) job.setPriority(self['priority'].evaluateInt()) job.setMaxRunningTasks(self['afanasy_max_running_tasks'].evaluateInt()) @@ -66,7 +99,9 @@ def _constructJob(self): def _constructBlock(self, work_item): - block = af.Block(work_item.node.name, 'hbatch_mantra') + service, parser = self._getWorkItemServiceAndParser(work_item) + block = af.Block(work_item.node.name, service) + block.setParser(parser) block.setCapacity(self.evaluateIntOverride(work_item.node, self.parmprefix, 'capacity', work_item, -1)) block.setHostsMask(self.evaluateStringOverride(work_item.node, self.parmprefix, 'hosts_mask', work_item, '')) block.setHostsMaskExclude(self.evaluateStringOverride(work_item.node, self.parmprefix, 'hosts_mask_exclude', work_item, '')) @@ -75,9 +110,6 @@ def _constructBlock(self, work_item): block.setNeedMemory(self.evaluateIntOverride(work_item.node, self.parmprefix, 'need_memory', work_item, -1)*1024) block.setTaskMinRunTime(self.evaluateIntOverride(work_item.node, self.parmprefix, 'task_min_run_time', work_item, -1)) block.setTaskMaxRunTime(int(self.evaluateFloatOverride(work_item.node, self.parmprefix, 'task_max_run_time', work_item, -1)*3600.0)) - # Check service and parser: - # PDG uses "ALF_PROGRESS" everywhere - block.setParser('mantra') return block @@ -86,7 +118,7 @@ def _constructTask(self, work_item): task = af.Task(work_item.name) task.setCommand(self.expandCommandTokens(work_item.command, work_item)) - # Set Environment Task Variables + # Set environment variables task.setEnv('PDG_RESULT_SERVER', str(self.workItemResultServerAddr())) task.setEnv('PDG_ITEM_NAME', str(work_item.name)) task.setEnv('PDG_DIR', str(self.workingDir(False))) diff --git a/plugins/houdini/topscheduler.user.ds b/plugins/houdini/topscheduler.user.ds index 180746607..71129d1c6 100644 --- a/plugins/houdini/topscheduler.user.ds +++ b/plugins/houdini/topscheduler.user.ds @@ -91,3 +91,25 @@ help "Task maximum running time in hours." } + + parm { + name "afanasy_service" + label "Service" + type string + default { "" } + parmtag { "pdg::scheduler" "" } + parmtag { spare_category "Afanasy" } + help "Tasks service." + } + + + parm { + name "afanasy_parser" + label "Parser" + type string + default { "" } + parmtag { "pdg::scheduler" "" } + parmtag { spare_category "Afanasy" } + help "Tasks output parser." + } +