Use concurrent.futures and improve user feedback in mmap_extract.py. #2559
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🍰 Pullrequest
This is a continuation of #2541 and improves the code of mmap_extract.py further. It uses
concurrent.futures
for the subprocesses instead of the previous thread-based parallelism, which is more efficient than the thread-keepalive check that existed beforehand and also allows us to easily check whether the function raised any exception (i.e. theMoveMapGen
executable returned a non-zero exit code), which is hard when subclassingthreading.Thread
. It also determines the platform-specific configuration for running theMoveMapGen
executable only once and then caches it, instead of running the same logic in every new thread.The output of the
MoveMapGen
executable is now swallowed and instead the user is presented with a simple overview that makes it easier to follow and see which maps have finished processing and if there were any errors. This should be more appropriate in non-debug scenarios where all the user cares about is the end result instead of seeing the progress of each individual tile. It looks like this:Finally, I've decided to look up the initial CMaNGOS commit that introduced the script and adjusted the copyright notice accordingly. If that's not desirable I can remove it, of course, but it would be a lot more accurate compared to the current situation (where VMaNGOS isn't even mentioned).
Proof
Issues
How2Test
mmap_extract.py
next toMoveMapGen
Buildings
,maps
etc. is in)mmap_extract.py
(from the data directory)Todo / Checklist