I did one hack here. Instead of iterating over dictionary, I iterated over its keys. Then I don’t have to implement the iter() pattern any more. Its working now, but there is a IndexError when I run it for 8 workers. For one worker, it works fine.