-
Notifications
You must be signed in to change notification settings - Fork 88
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
Optimize checking of supported args #152
base: main
Are you sure you want to change the base?
Conversation
@@ -1,6 +1,5 @@ | |||
import getpass | |||
import os | |||
import pathlib |
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.
removed pathlib since it is not used
try: | ||
return os.getenv('JUPYTER_RSESSION_PROXY_WWW_FRAME_ORIGIN', default) | ||
except Exception: | ||
return default |
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 don't think a try/except block is relevant here, I don't know of an error to be raised that we want that can be raised in this situation using os.getenv.
try: | |
return os.getenv('JUPYTER_RSESSION_PROXY_WWW_FRAME_ORIGIN', default) | |
except Exception: | |
return default | |
return os.getenv('JUPYTER_RSESSION_PROXY_WWW_FRAME_ORIGIN', default) |
Could you update the PR title or description to try capture this is now configurable via an environment variable? Whatever is put in the title will be visible via the changelog btw
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.
Ah, I've seen #148 now.
So this PR isn't really introducing this after all, its already there?
try: | ||
thread_pool_size = int(os.getenv('RSERVER_THREAD_POOL_SIZE', "")) | ||
if thread_pool_size > 0: | ||
cmd.append('--www-thread-pool-size=' + str(thread_pool_size)) | ||
except Exception: | ||
pass | ||
|
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.
If this is errorously configured, such as having RSERVER_THREAD_POOL_SIZE
set to "asdf", I think it can make sense to error loudly instead. Of course, if its an empty string though, we shouldn't error, but we can check that without a try/except block.
I think maybe something like...
int(os.getenv('RSERVER_THREAD_POOL_SIZE') or "0")
can do the trick, assuming we only want to configure --ww-thread-pool-size if its set to something else than 0.
Hi all,
As @yuvipanda suggested in comments of this PR #151 (comment) I have split out a part that optimizes checking of supported arguments.
It would be great if we could merge this before upping the require jupyter-server-kernel. If that is possible I am happy to help with making separate PR for the other part that deals with support of unix_socket.