minerl
minerl copied to clipboard
Process-safe launching of minecraft instance to solve creating multiple minerl environments in parallel
Adds a simple thread lock to prevent multiple processes from accessing the launch script. This prevents gradle build errors when trying to create multiple minerl environments in parallel. This passes asynchronous creation in #334 with the help of #351
Does this require waiting for one instance to lock then launching the next?
@minerllabs Yes, one thread acquires the lock first, then other threads wait in a queue to acquire the lock after the first one exits. There could be a way to narrow the scope of the lock period, but so far as I see it, there isn't a good way as the logic is controlled in the Minecraft client. But in practice, I didn't see much of an issue with the locking, other than it taking a while to launch all of the environments.
I found that this solution doesn't work with certain multiprocessing techniques to parallelize the environments, such as in RLlib. So this pull might not be the best to merge yet. I'll be looking into this.
Hello @juliusfrost! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
- In the file
minerl/env/core.py:
Line 51:80: E501 line too long (84 > 79 characters)
Comment last updated at 2020-07-14 20:43:18 UTC
@MadcowD @minerllabs What should be done further to merge this?
Hey this would be nice to have @MadcowD @minerllabs. Can we approve this PR?
Any update on this?
This seems to have been fixed in the latest version. At least this test script runs fine (but for some reason runs slow on my machine, even with a single environment. Might be my mangled environments). Parallel instances do not work on Windows, tho.