PDG Services: Writing to work item attributes?

   1461   3   1
User Avatar
Member
184 posts
Joined: 2月 2016
Offline
Hi,
I was wondering if there was any way to send work item attributes back when cooking with a service.
What I'm trying to do is cache some geometry + store some stats about that cache as PDG attributes.

When using out of process cooking there is this (from docs):
from pdgjson import WorkItem
# create WorkItem object from the data serialized to `$PDG_TEMP/data/workitem.json`
work_item = WorkItem.fromJobEnvironment()
# read attrib values from the running work item
val = work_item.attribValue('myintattrib')
# Send data back to PDG work item via network calls
work_item.setStringAttrib('runtime_attrib', 'test value', 0)
work_item.addOutputFile('/tmp/myoutput.txt')

Is there a equivalent to this using services?
User Avatar
Member
20 posts
Joined: 12月 2020
Offline
Bump, any update or solution to this?

I'm trying to find a way to pass attributes between TOPs/Scripts running on a Houdini Service Block.
User Avatar
Member
184 posts
Joined: 2月 2016
Offline
I did not find anything for my needs, but took a look at the new service blocks - and those can easily write to attributes.

Attaching an hello world example here



What I wanted to achieve was writing to pdg attributes from e.g. Python Sop nodes inside my hython services
Edited by AslakKS - 2024年5月27日 04:30:26

Attachments:
service_block_write_attrib.png (120.7 KB)
service_block_write_attrib.v001.hiplc (162.1 KB)

User Avatar
Member
20 posts
Joined: 12月 2020
Offline
Cheers AslakKS, I wasn't quite understanding the difference between a pdgjson.WorkItem and pdg.WorkItem until having a play with your example scene but now it makes sense they're quite different depending on whether or not you're using services. My initial problem is solved now, thanks,

Adam
  • Quick Links