Search - User list
Full Version: Make work item indices unique
Root » PDG/TOPs » Make work item indices unique
lloydwood
Hello,

I have a merge in my network which means I end up with duplicate pdg_index values. What's the best way to make these unique again?
Andr
hi, this code in a python processor should do fine and manages to keep the original attribs, but you will lose the the dependencies, since you are creating brand new workitems:

i = 0
for w in upstream_items:
    newItem = item_holder.addWorkItem(index= i, cloneTarget=w)
    i += 1
lloydwood
Thanks Andr. I came up with another solution which is to use a python partitioner to create a partitions with one work item each. This produces a new index but keeps dependencies.

count = 0
for item in work_items:
    partition_holder.addItemToPartition(item, count)
    count += 1
chrisgreb
You can also use the sort node if you have an attribute to sort by.
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