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?
Make work item indices unique
2095 3 1- lloydwood
- Member
- 105 posts
- Joined: 11月 2007
- Offline
- Andr
- Member
- 900 posts
- Joined: 2月 2016
- Offline
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
Edited by Andr - 2019年7月10日 08:59:55
- lloydwood
- Member
- 105 posts
- Joined: 11月 2007
- Offline
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
Edited by lloydwood - 2019年7月10日 09:33:53
- chrisgreb
- Member
- 603 posts
- Joined: 9月 2016
- Offline
-
- Quick Links