-
-
Save altendky/2c00e61f10ca695d4be4115d665fab82 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import concurrent.futures | |
import psutil | |
def test(x): | |
print('entering', x) | |
time.sleep(1) | |
print('exiting', x) | |
with concurrent.futures.ProcessPoolExecutor(max_workers=1) as executor: | |
out = [executor.map(test, range(100))] | |
for _ in range(20): | |
time.sleep(1) | |
for child in psutil.Process().children(): | |
print(' - - - - - -', child) | |
concurrent.futures.wait(out) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment