Skip to content

Instantly share code, notes, and snippets.

@altendky
Created April 18, 2018 14:47
Show Gist options
  • Save altendky/2c00e61f10ca695d4be4115d665fab82 to your computer and use it in GitHub Desktop.
Save altendky/2c00e61f10ca695d4be4115d665fab82 to your computer and use it in GitHub Desktop.
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