Skip to content
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

How to cleanly end processes in a Pool? #419

Open
nedbat opened this issue Dec 27, 2024 · 0 comments
Open

How to cleanly end processes in a Pool? #419

nedbat opened this issue Dec 27, 2024 · 0 comments

Comments

@nedbat
Copy link

nedbat commented Dec 27, 2024

Coverage.py needs subprocesses to end cleanly so that all the measured data will be written out. With multiprocessing, this works to make the workers end correctly:

def test_foo():
    with multiprocessing.Pool(processes=1) as pool:
        # ... use the pool, for example: pool.apply(complex_math_verification)
        pool.close()
        pool.join()

Similar code with billiard does not end the processes cleanly:

from billiard.pool import Pool

def test_foo():
    with Pool(processes=1) as pool:
        pool.apply(complex_math_verification)
        pool.close()
        pool.join()

Coverage issues nedbat/coveragepy#1673 and nedbat/coveragepy#1910 have more details.

Is this a bug in billiard, or does it need different code to cleanly end the worker processes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant