Search - User list
Full Version: How to "Submit Graph as Job" automatically from within TOPs?
Root » PDG/TOPs » How to "Submit Graph as Job" automatically from within TOPs?
rmayster
Hi,

I'm currently cooking a set of assets on a build farm using the “Submit Graph as Job” festure in the HQueue scheduler.
There are multiple Jobs needed for creating all the assets.
It works just fine, but I wanted to streamline the process a bit.
Instead of clicking the “submit” button multiple times to trigger all the Jobs I need, I would like to automate that - ideally in a second TOPs network.

Currently, I'm trying to do that via a python node in a separate TOPs network.
I copy&pasted some code I found in /pdg/job/top.py:

import hou
node = hou.node("/obj/TOPNET")              # find TOPs for current asset
node.cook(force=True)                       # create PDG graph
node.executeGraph(False, True, False, True) # execute PDG graph

I run the TOPs network containing tis code via “Tasks->Dirty and cook output node” on my local PC.

It does do the job, but unlike the “Submit graph as Job”, it doesn't seem to run he TOPNET on the build farm (as I hoped it would), but rather on my local PC.
I don't see any job coming up on the HQueue dashboard (the web frontend) when I run that script.
Playing around with the booelan arguments didn't help either.

Any ideas what I might be doing wrong?
matt_t
Maybe try using the “submitGraphAsJob” function instead of execute, something like:
import hou
from pdg import scheduler
schedulerNode = hou.node("/obj/TOPNET/hqueuescheduler") 

scheduler.submitGraphAsJob({}, schedulerNode, "mySchedulerName")
The first argument isn't actually used in the function, the second is the scheduler node and the third is just a nice name to give the scheduler for the pop-up telling you the graph was submitted. There's also a 4th kwarg for quiet (which disables the pop-up) which might be handy if you're doing this multiple times.

You can find this in pdg/scheduler.py for a bit more info on how the arguments get used but from the looks of things this is the function which is ultimately called by the “Submit” button on the scheduler.
rmayster
Matt, you're the man. Thanks a lot!
matt_t
All good!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB