`concurrent.futures.ProcessPoolExecutor ` miss print
- Lingua principale
- Python
- Stelle
- 734
- Fork
- 412
- Merge medio
- 1g 5h
- PR unite (30g)
- 8
Descrizione
Hi, I have a jupyter notebook cell, codes show below.
```
from concurrent.futures import ProcessPoolExecutor, wait
import time
executor = ProcessPoolExecutor(4)
def is_odd(ns, i):
print('get', ns, i)
# time.sleep(10)
return [bool(n & 1) for n in ns]
```
and another cell
```
futures = []
i = 0
batch = []
for x in [1,3,5,6,7,8,9,4,12,13]:
batch.append(x)
if len(batch) == 3:
futures.append(executor.submit(is_odd, batch, i))
i += 1
batch = []
wait(futures)
print('done')
```
I run cell#1 first, then cell#2. Things go on well. **However when I run cell#2 again, there is only 'done' printed.**
If I merge these 2 cells (or put `executor = ProcessPoolExecutor(4)` in cell#2), each cell run will print out info in `is_odd` and everything is right. I uncomment the `time.sleep` line to check the program has execute the `is_odd` function.
Mac 10.14/pyenv installed python 3.7.1/ipykernel 5.1.0/jupyter 1.0.0
Run in command line program ipython is ok.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Reproduce the two-cell example with Python 3.7.1, ipykernel 5.1.0, and Jupyter, comparing a reused ProcessPoolExecutor with one created in the second cell. Start by tracing how the notebook kernel manages submitted worker processes and their stdout; done means repeated cell execution consistently shows the worker output or the behavior is clearly documented.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- jupyter-notebook, python
- Ambito
- devtools
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100