googlecolab / colabtools

Python libraries for Google Colaboratory
Apache License 2.0
2.12k stars 696 forks source link

Allow cancel of queued block prior to execution #2411

Open dodger opened 2 years ago

dodger commented 2 years ago

Is your feature request related to a problem? Please describe.

Imagine I am experimenting with some things and I have a command line call that generates stuff, and it's slow: ! generate_stuff > stuff

Now imagine I've tested this a few times and so I have another line: ! rm stuff

And then I have another code block that does something. Like... do_stuff_with_stuff(stuff)

So, intending to click the first and third one, I brain fart and click all three. With the brain fart continuing, let's say it doesn't dawn on me that I did this until a few minutes in. So generate_stuff has been running for three or four minutes and I don't want to waste that time spent.

Colab is happily churning along with the "generate_stuff" block, and is cued up to then execute both of the other two blocks in turn. But the second block will make the third fail (because "stuff" is missing), and will also make the time spent on generate_stuff useless.

I can, of course, interrupt execution of all three in turn, but I'll have to start the WHOLE THING over. I cannot say "wait, belay execution of number 2, I changed my mind!"

What I would like to see happen: Stop button appears immediately after click of play button, with the waiting spinner until execution started. If clicked before cell execution has started, button will remove cell from execution queue and restore play button without any spinners.

As I see it, the only other option is cancelling everything, including the one you want to keep running, to get Colab to execute the later blocks allowing them to be cancelled (if it can even be clicked that fast)

blois commented 2 years ago

This is currently a limitation of the Jupyter protocol, see https://github.com/jupyter/notebook/issues/2340#issuecomment-581587924 for some background.

Y-T-G commented 2 years ago

Paperspace Gradient has this feature in their own notebook interface. I wonder how they are able to do it if it is a protocol limitation.

RavindraWiguna commented 4 months ago

Any idea to bring attention to this issue?