I would like to have processes requesting more than one resource from the shared resources pool.
For instance, with this code I can only request one resource:
def job(pool, total_requested):
with pool.request() as request:
yield request
if __name__ == "__main__":
env = simpy.Environment()
pool = simpy.Resource(env, RESOURCES)
env.process(job(pool, 5))
env.run()
What if I would like to allocate 5 together.
Is there any other function for my purpose?
You can maybe use Environment.all_of()
http://simpy.readthedocs.io/en/latest/topical_guides/events.html#waiting-for-multiple-events-at-once
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.