New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[server] Use the multiprocess
library on every platform
#4095
base: master
Are you sure you want to change the base?
Conversation
Did some tests on windows, and I could use the multiprocess lib without issues. I will remove the branching completely. |
8d12a44
to
12888c1
Compare
@vodorok Let's just make sure these claims hold true for sufficiently old Python versions such as 3.9. Other than that, I think this is good to go. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Barring the stylistic changes, LGTM! @vodorok)
Even though we swapped a higher level interface to a lower level (ProcessPoolExecutor -> Multiprocess.Pool), it is worth it because on all 3 systems the multiprocess handling is the same. Multiprocessing is broken on osx, (probably because of the fork -> spawn change.) This patch intends to correct it by using the newly added multiprocess library. On Windows only single threaded execution is supported. With the introduction of the multiprocess lib multiprocessing is now available.
12888c1
to
f8e6f56
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. But please re-check everything on real machines as well. Does the WINDOWS library version appropriately ignore the pool.map
which was previously not passed? Or with this new library, everything works fine in a pool?
Do not merge yet |
if sys.platform in ["darwin", "win32"]:
from multiprocessing import Pool as MultiProcessPool
elif sys.platform == ":
from concurrent.futures import ProcessPoolExecutor as MultiProcessPool
from codechecker_common.multiprocessing import MultiProcessPool
# ...
with MultiProcessPool(...) as pool:
...(..., pool.map) |
Made a different implementation where the linux platform still uses the ProcessPoolExecutor class. |
multiprocess
library on every platform
Multiprocessing is broken on osx, (probably because of the fork -> spawn change). This patch intends to correct it by using the newly added multiprocess library.