Expended Result Data and Batching

   1471   2   0
User Avatar
Member
209 posts
Joined: 11月 2010
Offline
Hi,

Maybe I'm doing something wrong but expectedRusltData doesn't work for batched items.
I'm trying to get value from resultData to downstream parameters.
Can you please take look at example files:

Thanks
Ostap
Edited by Ostap - 2020年4月2日 23:38:09

Attachments:
Screen Shot 2020-04-03 at 3.54.32 PM.png (37.0 KB)
batching_pdg_input.hipnc (57.1 KB)
2batch.py (1.2 KB)

User Avatar
スタッフ
585 posts
Joined: 5月 2014
Offline
The issue is that the files are being added during the onPrepareTask hook. That code runs immediately before the work items are scheduled, which happens after the graph has been generated. It's typically used to add information that's only know right before a work item cooks, such accessing outputs from cooked dependencies upstream in the graph. The attribute create is doing its evaluation and adding its attributes when the work items are generated.

If you know the file paths ahead of time, you may want to do something the following instead (I modified the onGenerate in your .py file):

    def onGenerate(self, item_holder, upstream_items, generation_type):
        item = item_holder.addWorkItem(batch=True, batchSize=1)
        item.setFrame(1, 1)
        item.setCommand("hython -c {}".format(python_exec))

        for sub_item in item.batchItems:
            sub_item.addExpectedResultData("someoutput.{}.bgeo".format(sub_item.frame),"custom/tag")

That's also an example of how you can have a per-frame expected output file on each item in the batch. That's effectively what the ROP Fetch node is doing, except it gets the file path by evaluating the output file parm on the target ROP.
Edited by tpetrick - 2020年4月3日 12:45:33
User Avatar
Member
209 posts
Joined: 11月 2010
Offline
That explains all those issues.
Huge thanks for examples!
  • Quick Links