notebook icon indicating copy to clipboard operation
notebook copied to clipboard

Prevent re-execution of a cell that is already running

Open henridf opened this issue 9 years ago • 1 comments
trafficstars

If you start the second cell below and then run it multiple times (e.g. with shift+enter) while it is already running, the value of i will be equal to the number of times it was run.

# initialization cell
i = 0
# cell to run concurrently
import time
time.sleep(5)
print("done %d"  % i)
i = i + 1

We ran into this in the context of long-running spark jobs, where a user mistakenly ran an already-running (long-lived) cell, leading to errors.

It seems like an easier-to-understand behavior would be simply to ignore "run cell" commands for a cell that is already running.

henridf avatar Sep 07 '16 12:09 henridf