random work item ignore

   2075   7   1
User Avatar
Member
16 posts
Joined: Feb. 2015
Offline
hi everyone

i am looking for a solution to a pdg question i have.

after generating many different version of an asset, is there a way to remove random work items at the end of the tree before they are being rendered in a rop node?

//EDIT//

i just noticed a different post that filters the amount of workitems and deletes an amount, via a python processor. (https://www.sidefx.com/forum/topic/84535/)
being a python noob, how would this be rewritten into keeping an amount of workitems?

import random

choices = random.sample(range(0, len(upstream_items)), k=200)

for index, upstream_item in enumerate(upstream_items):
if index not in choices:
item_holder.addWorkItem(parent=upstream_item)
Edited by doodlemaker - June 5, 2022 13:49:00
User Avatar
Member
8532 posts
Joined: July 2007
Offline
you can use the same code as in the attached post
tweak K=200 to how many you want to keep, like k=10, etc
and change
if index not in choices:
to
if index in choices:
Edited by tamte - June 7, 2022 12:16:56
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
16 posts
Joined: Feb. 2015
Offline
thank you Tomas!
coding is on my bucket list... hope to get around to dive in to that more in the future.
User Avatar
Member
16 posts
Joined: Feb. 2015
Offline
tamte
you can use the same code as in the attached post
tweak K=200 to how many you want to keep, like k=10, etc
and change
if index not in choices:
to
if index in choices:

i have a follow up question, i batched 500 workitems and send them to deadline to be rendered with an OPENGL rop.
they are 500 randomly chosen of 960 total variations.

during the render my pc crashed, about 260 were rendered.

now when restarting, the index of the randomly chosen list has changed, 500 new variations are chosen.

is there a way to 'bake' a list of random items, so houdini, when restarting, can use those and find the previous rendered results on disk?

=edit=

after the crash, the connection to deadline also appears to be gone. the unfinished, queued items cannot continue.
can one keep this connection alive after restarting houdini?
Edited by doodlemaker - June 14, 2022 05:48:25
User Avatar
Member
16 posts
Joined: Feb. 2015
Offline
[quote=Ä

is there a way to 'bake' a list of random items, so houdini, when restarting, can use those and find the previous rendered results on disk?

Note for future references, there is an option to save the task graph on the top network node.
This also saves the index of the tree, including the randomly generated variations. So in case there is a crash, loading up the task graph file will get the same “build” as before and the cook will find the files on disk
User Avatar
Member
8532 posts
Joined: July 2007
Offline
doodlemaker
now when restarting, the index of the randomly chosen list has changed, 500 new variations are chosen.
that's how random in python works by default, every time it generates different set of sample values, which is obviously not good
to get stable sample set every time it cooks you need to initialize the seed for the random generator

import random
 
k = 50
k = min(k, len(upstream_items))  # limit to n items to avoid overflow

random.seed(10)  # you can change 10 to different number to ger different set of random numbers
choices = random.sample(range(0, len(upstream_items)), k)

for index, upstream_item in enumerate(upstream_items):
    if index in choices:
        item_holder.addWorkItem(parent=upstream_item)
Edited by tamte - June 15, 2022 20:17:00
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
16 posts
Joined: Feb. 2015
Offline
tamte
doodlemaker
now when restarting, the index of the randomly chosen list has changed, 500 new variations are chosen.
that's how random in python works by default, every time it generates different set of sample values, which is obviously not good
to get stable sample set every time it cooks you need to initialize the seed for the random generator

import random
 
k = 50
k = min(k, len(upstream_items))  # limit to n items to avoid overflow

random.seed(10)  # you can change 10 to different number to ger different set of random numbers
choices = random.sample(range(0, len(upstream_items)), k)

for index, upstream_item in enumerate(upstream_items):
    if index in choices:
        item_holder.addWorkItem(parent=upstream_item)

Thanks Tomas!
That solution is much more practical!
User Avatar
Member
22 posts
Joined: Sept. 2015
Offline
wondering if there is a way to delete any duplicate work items before i render?
  • Quick Links