From 9a0e69bc24d3a09f007d8bcd2c3eb13f4156a316 Mon Sep 17 00:00:00 2001 From: timurhai Date: Tue, 13 Jul 2021 10:16:42 +0300 Subject: [PATCH] PDG: Submit Job As Graph References: #514. (documentation just started - header added) --- docs/changes_log/changes_log.rst | 2 ++ docs/software/houdini.rst | 3 ++ plugins/houdini/afanasyscheduler.hda | Bin 13297 -> 13941 bytes plugins/houdini/pdg/types/afanasyscheduler.py | 29 ++++++++++++++++-- 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/docs/changes_log/changes_log.rst b/docs/changes_log/changes_log.rst index 09b3b0562..808432426 100644 --- a/docs/changes_log/changes_log.rst +++ b/docs/changes_log/changes_log.rst @@ -18,6 +18,8 @@ v3.2.1 2021.07.02 +- Houdini Afanasy `TOP Scheduler `_. + - Each not numeric task can have an own extra `environment <../afanasy/job_task.html#environment>`_. - **Bugfixes** diff --git a/docs/software/houdini.rst b/docs/software/houdini.rst index 4fdf94a3d..2d67af71b 100644 --- a/docs/software/houdini.rst +++ b/docs/software/houdini.rst @@ -270,6 +270,9 @@ This can be used to explain other ROP network what to do with Afanasy node. That default script will execute *Submit* button on a specified Afanasy ROP. +Afanasy TOP +=========== + Examples ======== diff --git a/plugins/houdini/afanasyscheduler.hda b/plugins/houdini/afanasyscheduler.hda index 27fb185aaf939b08244f290799cf690c97eb44b1..2da1310e572f2c193ca7b98ceb937ed861668160 100644 GIT binary patch delta 714 zcmZ{i&u-H|5XQ$&NsC*MP)P!jD60r5Nfq2u{zz~@iVA9jL{msrag1YcVz-WW*3*XV{+nd*u z)Lkpyt@L$+pH@|ZG&*~aUSy9tEy>6zPb+8IsLGXXh8=->E(@ptsGI>9_cEjd_YLZZSLc6m`dg^C4Ewk#g0p&-umGV zz_mSq%b)v4@5_1}`xD`l=qd5y5Cd%0Rqu8G+nqIe$t+u2Gxf$;(`UEL4@bbJxfEs~O5L`RT--Z_XE{kW<`3_4d$-96qTx)y@@R_3!=M*p3+| zObHj%rNc}UoXc`6H_+jaUr{|^B!<#Iv<^?pOg7+tUjOquCF4ep-6Jt`)fqzpK-O=6 F{0$NS)6xI{ delta 255 zcmeyG^D%vb7W0$9GZS^?!IZxoo6+P1kU;T6DImoF0iJ#?5l|+GVxOGHC{{1F6QmHx z<#8@bO)N<5qFZK8D%=`_PeAc=AR{;XGOgm+ti$7>!2%RwoV?of6abb^Os)U` diff --git a/plugins/houdini/pdg/types/afanasyscheduler.py b/plugins/houdini/pdg/types/afanasyscheduler.py index 68b5d2f6a..44e9763d0 100644 --- a/plugins/houdini/pdg/types/afanasyscheduler.py +++ b/plugins/houdini/pdg/types/afanasyscheduler.py @@ -4,11 +4,13 @@ import sys import traceback +import hou import pdg from pdg.scheduler import PyScheduler from pdg.job.callbackserver import CallbackServerMixin from pdg.utils import expand_vars +import cgruconfig import af logging.basicConfig(level = logging.DEBUG) @@ -312,9 +314,32 @@ def submitAsJob(self, graph_file, node_path): graph_file Path to a .hip file containing the TOP Network, relative to $PDG_DIR. node_path Op path to the TOP Network """ - # not supported, yet logger.debug("submitAsJob({},{})".format(graph_file, node_path)) - return "" + + # Constuct a command for hython + topcook script + cmd = 'hython' + # Use PDG licence + cmd += ' --pdg' + # Specify script that cooks graph + cmd += ' "%s/pdgjob/topcook.py"' % os.getenv('HHP') + # Set verbosity level + cmd += ' --verbosity 2' + # Set hip file: + cmd += ' --hip "%s"' % hou.hipFile.path() + # Set top network to cook + cmd += ' --toppath "%s"' % node_path + + # Constuct a job: + job = self._constructJob() + block = af.Block('PDG-GRAPH','hbatch') + task = af.Task(node_path) + task.setCommand(cmd) + task.setEnv('AF_USERNAME', cgruconfig.VARS['USERNAME']) + block.tasks.append(task) + job.blocks.append(block) + job.send() + + return None # Register Afanasy Scheduler type