Simpy Store Batch Processing
I'm trying to create a producer/consumer simulation where the consumer processes items in batches. The problem is that the Store.get() function removes items from the Store as soon as it is called, but I need it to wait until I've called yield: import simpy def producer(env, Q): item = 0 while True: yield Q.put(item) print('Submit item:%d'%item) item += 1 def consumer(env, Q): while True: yield env.timeout(20) events = [Q.get() for i in range(4)] items = yield env.all_of(events) print([items for items in items.values()]) env = simpy.Environment() maxQD = 2 Q = simpy.Store(env, capacity=maxQD)