Skip to content

Commit

Permalink
PDG: Submit Job As Graph
Browse files Browse the repository at this point in the history
References: #514.

(documentation just started - header added)
  • Loading branch information
timurhai committed Jul 13, 2021
1 parent 24cc075 commit 9a0e69b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/changes_log/changes_log.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ v3.2.1

2021.07.02

- Houdini Afanasy `TOP Scheduler </software/houdini.html#afanasy-top>`_.

- Each not numeric task can have an own extra `environment <../afanasy/job_task.html#environment>`_.

- **Bugfixes**
Expand Down
3 changes: 3 additions & 0 deletions docs/software/houdini.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
========

Expand Down
Binary file modified plugins/houdini/afanasyscheduler.hda
Binary file not shown.
29 changes: 27 additions & 2 deletions plugins/houdini/pdg/types/afanasyscheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9a0e69b

Please sign in to comment.