Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve handling of "rapid fire" completion requests #241

Closed
jameskoch opened this issue Oct 18, 2018 · 7 comments
Closed

Improve handling of "rapid fire" completion requests #241

jameskoch opened this issue Oct 18, 2018 · 7 comments

Comments

@jameskoch
Copy link

The nteract front end is far more aggressive than Jupyter notebook about requesting completions from the kernel as the user types. There's some great UX that can be unlocked if this could work more seamlessly w/ Almond.

Ideally, when Almond receives a new completion request it would quickly interrupt an in-flight one to prioritize the new/latest one.

Would need to think about how this works in the "multiple front-ends attached to a single kernel" model (I don't know much about that world).

Discussed a bit in this nteract issue.

@jameskoch
Copy link
Author

jameskoch commented Oct 18, 2018

nsc Global docs here describe that certain requests may be prioritized higher than existing requests. Hard to tell under which exact conditions this would occur, and whether, once newer requests finish, older ones would be resumed. I might try to monkey-patch my way around Ammonite's CompilerLifecycleManager.complete being synchronized and just feed concurrent requests into its Pressy and see what happens.

@rgbkrk
Copy link

rgbkrk commented Oct 18, 2018

"multiple front-ends attached to a single kernel"

We made the architecture for this in Jupyter and while it's handy for debugging, it's not widely used (from a ZeroMQ standpoint). However, each client should have a unique session ID so it could be keyed on that.

@alexarchambault
Copy link
Member

alexarchambault commented Oct 19, 2018

@jameskoch The scala presentation compiler, which handles completions, should support concurrent completion requests, yes. Ammonite doesn't use that and just blocks until a completion result arrives.

I guess the ammonite.interp.Pressy API can be tweaked, so that we can submit concurrent requests.

I'm going to tweak the almond.interpreter.Interpreter API here so that it allows to run completions in a non-blocking and cancellable way.

@alexarchambault
Copy link
Member

#242 allows Interpreter implementations to handle completion requests asynchronously (by overriding Interpreter.asyncComplete rather than Interpreter.complete) and make them cancellable, and automatically cancels the currently running one when a new completion request arrives.

@alexarchambault
Copy link
Member

@jameskoch I can look into having Ammonite accept concurrent completion requests, if you haven't already.

@jameskoch
Copy link
Author

I haven't pushed ahead on this, and I wouldn't be nearly as effective as you in doing so. Have at it!

@alexarchambault
Copy link
Member

com-lihaoyi/Ammonite#893 should allow to handle more of the completion logic from almond, and make it interruptible in particular.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants