-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Reliable list_running_servers(runtime_dir) design #5716
base: 6.4.x
Are you sure you want to change the base?
Conversation
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.
Thanks for opening this pull request. I understand why this is being done, although I'm curious how often you're finding the PIDs getting recycled (I know some OSs recycle much more frequently than others) and wonder why you're encountering "stale" nbserver files in the first place. How are you terminating the Notebook server normally? Is there some interaction that is using SIGKILL
instead of SIGTERM
or a larger problem where the server is improperly terminating? I suppose it takes just one bad apple (i.e., stale PID) and things can go wrong, and, I agree, this approach helps mitigate that - I'm just not sure about the trade-off.
I've provided a few comments and observations that I hope you find helpful. I didn't comment on the test code and it appears some socket-based tests are failing which rely on the list and stop functionality.
Returns True if the server was stopped by any means, False if stopping it | ||
failed (on Windows). | ||
""" | ||
def kernel_request(server_info, path='/login', method='GET', body=None, headers=None, timeout=5, log=None): |
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 method should be renamed since its unrelated to kernel. Perhaps server_request
?
Also, please remove the default value from path
since that should be explicitly provided by the caller (which is already the case anyway).
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 method should be renamed since its unrelated to kernel. Perhaps
server_request
?
we creator have this naming right;
with respect to Guido name Python; and their first creator name IPython and Jupyter also Anaconda;
i am working on my IPython Swift Kernel, kernel in my brain;
don't mind, different think lead sparks.
Also, please remove the default value from
path
since that should be explicitly provided by the caller (which is already the case anyway).
caller will provide their; this default value does not conflict to different path
;
we use '/login' as 'default value' to remind caller authentication first.
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 method needs to change and the default for path
either removed or updated to /api
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.
Yeah, I agree with @kevin-bates here. This method needs to be renamed to something like api_request
before we can accept it. It's not requesting a response from a "kernel" (as we define it in the Jupyter ecosystem). It's just a general server API ping.
I also agree, the default path should probably be /api
.
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.
who create new who own naming rights.
answered.
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.
The name matters here. It obscures this library's API if function names are not clear.
kernel_request
is the wrong name for this function. In the Jupyter ecosystem, kernel refers specifically to the underlying language kernel being executed by calls to the server's kernel
API. This method is not making a kernel request. It's making a generic request the server's REST API. Let's generalize this function name to something like server_request
or api_request
.
particularly because Jupyter has a notion of kernels that is specific.
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.
I'm setting this conversation to unresolved, since this change is necessary.
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.
def kernel_request(server_info, path='/login', method='GET', body=None, headers=None, timeout=5, log=None): | |
def api_request(server_info, path='/api', method='GET', body=None, headers=None, timeout=5, log=None): |
i am building a Dockerfile on RedHat's quay.io, to deploy my Cloud based Amazon.com Crawler on Mac/Linux/...;
your sparks are welcome. |
Accepted, Thanks. Co-authored-by: Kevin Bates <[email protected]>
Accepted. Co-authored-by: Kevin Bates <[email protected]>
I just now found that Lab returns yet a different title. This implies any front-end extension will have a different "title", making this approach too fragile. Since those applications could also rely on |
reopen |
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.
Thanks @abaelhe - this is getting much closer. I'm still slightly concerned about requiring the use of the same notebook version, but I'm not sure that's a very big deal. It's certainly better than terminating the wrong process! To that point, and as I noted in the review, we should probably eliminate the PID-based termination altogether for this PR.
Co-authored-by: Kevin Bates <[email protected]>
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.
Thanks @abaelhe - this is getting much closer. I'm still slightly concerned about requiring the use of the same notebook version, but I'm not sure that's a very big deal. It's certainly better than terminating the wrong process! To that point, and as I noted in the review, we should probably eliminate the PID-based termination altogether for this PR.
really useful key point;
i will change the "/api" protocol, define a better policy for jupyter determination;
and i still invite you as the reviewer.
commit 978d883
commit 07570c6 |
Hi @abaelhe - thank you for your patience. I believe this is getting too complicated for the original goals.
Instead of adding a version to the Let's try to keep these changes as simple as possible. Does that work for you? |
we are on the way to build a reliable ipython/jupyter; a right way requires a bit efforts;
no matter reused process is processing a billions transaction or just hello world;
the response status is success if response.body marked with JUPYTER_NOTEBOOK_TAG; |
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.
Thank you @abaelhe. There is no need to alter the REST API for this change. Let's just use the fact that a response was successful and issue a message if the version strings don't match.
I still ask that the name and signature of kernel_request()
be changed. Thank you.
Returns True if the server was stopped by any means, False if stopping it | ||
failed (on Windows). | ||
""" | ||
def kernel_request(server_info, path='/login', method='GET', body=None, headers=None, timeout=5, log=None): |
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 method needs to change and the default for path
either removed or updated to /api
Ah, I see. You're right. That is an issue. I agree with you, the Here's the problem... changing the response model is a significant REST API breaking change. Such changes take longer to review for us (at Jupyter). As I mentioned before, this type of change affects multiple other applications. In order to accept it, we would have to get buy-in from the larger community. That could take weeks (or even months). What you're trying to achieve in this PR is a rather small change (though much appreciate!!). To move forward, I see two possible choices:
Unfortunately, I (and likely @kevin-bates) don't have the bandwidth to shepherd (2) through the process, but I'd be happy to review a proposal over there. In full disclosure, (2) will likely take much longer to happen. If you decide (1) is the direction you want to go, I'm happy to merge this after the final review. Thanks again, @abaelhe, for all your work here. It's great stuff! |
Returns True if the server was stopped by any means, False if stopping it | ||
failed (on Windows). | ||
""" | ||
def kernel_request(server_info, path='/login', method='GET', body=None, headers=None, timeout=5, log=None): |
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.
def kernel_request(server_info, path='/login', method='GET', body=None, headers=None, timeout=5, log=None): | |
def api_request(server_info, path='/api', method='GET', body=None, headers=None, timeout=5, log=None): |
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.
kernel_request() MUST retrieve Jupyter Notebook identification tag before or after authentication.
and "api/status" is an AUTHENTICATED ONLY call.Ah, I see. You're right. That is an issue. I agree with you, the
/api
endpoint should probably return more specific information about the application (namely, Jupyter Notebook).Here's the problem... changing the response model is a significant REST API breaking change. Such changes take longer to review for us (at Jupyter). As I mentioned before, this type of change affects multiple other applications. In order to accept it, we would have to get buy-in from the larger community. That could take weeks (or even months).
add one JUPYTER_NOTEBOOK_TAG feature is transparent to those who using "verson" field from "/api";
i don't see that is a break to REST API response model; they are compatible.
What you're trying to achieve in this PR is a rather small change (though much appreciate!!). To move forward, I see two possible choices:
less code, better product; more user.so,
focus on our main road;
- Drop the API breaking change to the response model in this PR and merge the
api_request
function that pings the server to verify it's running whenlist_running_servers
is called. Then, sometime in a later PR, we can lobby to change the/api
endpoint and improve this function further.- Pause any further review on this PR, propose the change to the REST API through the Jupyter Enhancement Proposals repository, wait for approval there, then return to this PR once everything is approved.
Unfortunately, I (and likely @kevin-bates) don't have the bandwidth to shepherd (2) through the process, but I'd be happy to review a proposal over there. In full disclosure, (2) will likely take much longer to happen.
If you decide (1) is the direction you want to go, I'm happy to merge this after the final review.
Thanks again, @abaelhe, for all your work here. It's great stuff!
thanks to customers tolerantly using Jupyter Notebook with previous check_pid().
systematic design principle to flexible and diverse methods; shield to spear; they are all unity.
Apple's Logo keeps one bite in history;
why not place JUPYTER_NOTEBOOK_TAG at "/api" or somewhere required; for us, for users.
we break DOS into Windows; RPC into REST API; and many things.
we keep break REST API if that is reasonable;
merge into master branch first;
JUST DO IT!
This isn't how we do things in the Jupyter ecosystem, for better or worse. Jupyter's REST API is an old protocol that many applications depend on. Changes require formal review through the enhancement proposal process. In this case, we need to follow Jupyter's process. If you want to propose such a change, we'd appreciate if you'd open the discussion on the enhancement-proposals repo. I am guessing you'll get plenty of support for this idea and we'll be able to move forward fairly quickly. (I just don't have the bandwidth to champion this change myself.) As this PR stands, we can't accept it until that process is complete or we drop the changes to the REST API. |
active check whether that process is really available via real HTTP request;
process pid maybe recycle and reused by host Operating System that i encountered;
and we must use real HTTP request other than the past check_pid(info['pid']).