Canceling a jupyter kernel request - to support fast completion

43 views
Skip to first unread message

Rich Chiodo

unread,
Sep 11, 2020, 8:52:09 PM9/11/20
to Project Jupyter
Hi, 

I was hoping to discuss making it possible to 'cancel' a kernel request. Or at least ask if anybody else has thought of this and why or why not it's possible. 

I didn't want to make a JEP just yet as thought there might already be a discussion around this.

This is in reference to problems my team is having with auto complete and IPython:

I ran some profiling when the problem occurs and it looks like we're in the middle of waiting for the completion request to return before we can execute a cell.

This might be solved a number of ways:
- Modify Jedi/IPython to support a timeout for completion
- Skip doing autocompletion in VS code from Jupyter
- Provide a way to cancel a kernel request

The cancel idea sounds the most interesting to me.

Any feedback would be great.

Thanks.

Rich Chiodo

unread,
Sep 11, 2020, 10:38:10 PM9/11/20
to Project Jupyter
Oh I'm an idiot. Kernel interrupt is already the cancel mechanism. This will likely work to cancel the completion request. And if it crashes IPython I can always submit a PR there to catch the keyboard interrupt and return empty completion results.

Sorry for the dumb idea.

Matthias Bussonnier

unread,
Sep 12, 2020, 2:56:00 PM9/12/20
to jup...@googlegroups.com
IPython does already have a timeout for completion;
--Completer.jedi_compute_type_timeout ,
Though there is an initial step that cannot be interrupted, and this
typically make the first few completion with jedi slower.

Interrupting may or may not work as expected depending on whether you
have cell execution queued.

Note that vscode should know whether the kernel is busy and then could
decide to (not) send completion request to the kernel.

That is at least what classic notebook does; if the kernel is busy it
will rely on CodeMirror completion which is completely independent of
kernel, but less complete.
I'm not familiar with VS Code internal but I don't see any reason the
same approach can't be taken.
--
M
> --
> You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/98f78a21-e439-4538-a05c-cc34f7614319o%40googlegroups.com.

Rich Chiodo

unread,
Sep 14, 2020, 12:06:23 PM9/14/20
to Project Jupyter
Skipping completion doesn't work in this case because the user just typed 'df.head()'. The '.' in the causes autocompletion to occur. 

We can try the timeout first to see if that works. That would be better than having to track completion requests and just interrupt them.

Thanks


On Friday, September 11, 2020 at 5:52:09 PM UTC-7, Rich Chiodo wrote:
Reply all
Reply to author
Forward
0 new messages