Search - User list
Full Version: random work item ignore
Root » PDG/TOPs » random work item ignore
doodlemaker
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)
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:
doodlemaker
thank you Tomas!
coding is on my bucket list... hope to get around to dive in to that more in the future.
doodlemaker
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?
doodlemaker
[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
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)
doodlemaker
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!
cybernetix
wondering if there is a way to delete any duplicate work items before i render?
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