-
Notifications
You must be signed in to change notification settings - Fork 310
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
Make terminal_class configurable and provide a manager to detect terminal status on linux systems #626
Conversation
Codecov Report
@@ Coverage Diff @@
## master #626 +/- ##
==========================================
+ Coverage 77.63% 77.75% +0.12%
==========================================
Files 110 111 +1
Lines 10398 10509 +111
Branches 1408 1417 +9
==========================================
+ Hits 8072 8171 +99
- Misses 1929 1939 +10
- Partials 397 399 +2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thank you!
well it cannot handle the following situations
|
jupyter_server/terminal/handlers.py
Outdated
# It works well for jupyterhub-singleuser and should also work for other debian-based mirrors | ||
# fixme: May fail if terminal is not properly separated with ':' or change user after connect | ||
# (Any change to the user, hostname or environment may render it invalid) | ||
self._first_stdout = message_seg[1].split(':')[0].lstrip() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This meets my needs, but may not be a good general approach
Maybe we need to raise an issue with terminado?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I understand it, it is terminal dependent, terminado is just reading from the pty
: https://github.com/jupyter/terminado/blob/ab4ced0b77c8f198cdc27fe1d52c523635083461/terminado/websocket.py#L77
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it may be a little difficult to implement a reliable solution based on the current architecture. But we can delve into how to determine that an terminal is running
Since this is introducing state management, it seems like the culling logic should be updated to no longer cull currently 'busy' terminals. Are we confident that the 'idle' state detection is reliable? If not, then culling could be adversely affected since (if I'm following things) a terminal could get "stuck" in 'busy' and we'd probably be better off leaving culling as-is. |
Yes, we'd probably be better off leaving culling as-is. My own idea is that this functionality is provided on-demand, and if someone needs to use it, the scenario is roughly the same as mine: detect if the user's kernel and terminal have been idle for a long time with a uniformly provided mirror and scheduling system (as jupyterhub). The point of adding terminal status detection is that last_activity_time is only updated on input and output and does not reflect the running state. |
@kevin-bates @blink1073 If people use singleuser-based images, it performs well |
I tried locally to get it working on macOS, unsuccessfully. I think that perhaps this logic is too brittle to be in core, and this should be a third party Terminal manager, and we should allow the terminal manager to be configured similar to |
Good idea , I've made the terminal_manager_class configurable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems reasonable to me as-is. Thanks @Wh1isper!
Hi @Wh1isper, we discussed this PR in the weekly meeting. We think the right approach is to create a new repo and make terminals a server extension. This new class would then be a configurable part of that extension. I'll take the task of creating the repo and adding the initial content by the end of this month. |
Great, thank you for your attention to this issue, I fully agree with this approach and will continue to follow the progress |
Turn to #640 |
#625
This is a temporary solution
In Jupyterhub, each input will trigger a record, which may have performance issues