PDG doesn't cook full network after a Server Block

   1453   1   0
User Avatar
Member
3 posts
Joined: Sept. 2016
Offline
So I am using TOPs to query Shotgrid and return information about assets in this example. For some reason when cooking this network TOPs will only cook the Shotgrid server block and consider the graph done. If I then manually ask it to cook again, it will finish up the graph. This is a very strange behavior that I was hoping someone might have some insight into?


You can see that during the first cook the TOP net has the nodes below waiting for evaluation. But, as see in AfterCook1, these nodes are left uncompleted after the server block finishes cooking. When I force it to cook again, it quickly finishes up these nodes.


I am using the top level TOP net buttons to control the network and am using "Cook Output Node". Also the little warning on the server end block is simply an attribute incompatibility message.




Edited by FortifiedOatMilk - Nov. 22, 2022 16:08:45

Attachments:
BeforeCook1.png (65.4 KB)
DuringCook1.png (66.4 KB)
AfterCook1.png (70.0 KB)
AfterCook2.png (71.5 KB)

User Avatar
Member
3 posts
Joined: Sept. 2016
Offline
So I managed to find a work around for this behavior. Referencing this [www.sidefx.com] page on TOPs event handling, I put an event handler for when the "commandserverend" TOP completed cooking. This way immediately as that server block finishes, it will call to cook the output node at the bottom.
Here's the example snippet I placed in the OnCreated script on the HDA so the event is registered each time when the node is loaded in:
import pdg
top_node = kwargs['node'].node("./query_SG/commandserverend2")

top_node.cookWorkItems(tops_only=True)

pdg_context = top_node.getPDGGraphContext()

# Define our event handler
def cookRestOfNetwork(event):
    kwargs['node'].node("./query_SG/output0").cookWorkItems()
    
pdg_context.addEventHandler(cookRestOfNetwork, pdg.EventType.CookComplete)

This had a strange behavior in an earlier test where I was using the ui display message example from the TOPs Events page where everything would work as expected, but if I had it also cook that output node it would endlessly pop up the display message....So I just took that ui stuff out because of course its not needed and it didn't endlessly loop.

I don't know exactly what is up with this, but this seems to be working for the time being.

Would love to not have to do this though and just be able to cook the full graph as usual lol
Edited by FortifiedOatMilk - Nov. 28, 2022 11:10:31
  • Quick Links