-
Notifications
You must be signed in to change notification settings - Fork 133
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
Add whitelist for environment variables to be inherited from gateway process by kernel. #280
Conversation
…process by kernel.
Travis CI detects problems with all tested Python versions except 3.3. |
The code changes look good to me. Unfortunately, I currently don't have the time to dig further into the Travis failures. @parente, would you have some cycles to spare? |
This is the Travis CI problem for all failing versions: ERROR: Failure: ImportError (cannot import name LogTrapTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
addr.filename, addr.module)
File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/home/travis/build/jupyter/kernel_gateway/kernel_gateway/tests/test_gatewayapp.py", line 10, in <module>
from tornado.testing import AsyncHTTPTestCase, LogTrapTestCase
ImportError: cannot import name LogTrapTestCase The PR doesn't mention |
For example jupyter/notebook#3023 |
Indeed, Tornado 5.0 dropped support for Python 3.3. So our Travis CI tests are failing on all Python versions for which Tornado 5.0 is available. |
@rolweber - We ran into this same problem in Enterprise Gateway (since all unittests are derived from JKG) and I had to block use of tornado >= 5.0. |
@GrahamDumpleton @rolweber - Regarding the code changes for this PR, isn't the I'm 99% certain that the As a result, I'd have to down-vote this PR unless I'm missing something. |
kernelspecs are one way to define env variables. But if the setting is not specific to the kernel, but rather to the Jupyter installation, it makes sense to pass environment variables from the Jupyter process to the kernels as well. Then you can use kernelspecs you find somewhere on the internet unmodified. |
Thanks Roland - that makes sense (and is what Graham was trying to convey previously - sorry). In fact, the current use of |
Yep, Roland got it. This isn't trying to set environment variables because a specific kernel needed them, but that they were needed for underlying stuff such as Python itself, or some other reason related to the runtime. For example, in container image I am running stuff in, I also need to ensure that As to having |
LGTM, the CI build issues are unrelated and I will submit a fix for that. |
I merged the fix for the Travis CI builds and requested a new build for this PR. |
Thanks to you, Graham and Luciano! |
As raised in #279, this PR adds ability to define a whitelist of environment variables which are allowed to be inherited from the kernel gateway process, when spawning a kernel process. This is needed to allow environment variables such as
LD_LIBRARY_PATH
,LD_PRELOAD
or other special environment variables to be passed through when executing the kernel process. In the case ofLD_LIBRARY_PATH
this avoids error such as:The list of environment variables allowed to be inherited can be set by
KG_ENV_PROCESS_WHITELIST
orKernelGatewayApp.env_process_whitelist
. Usedenv_process_whitelist
instead ofprocess_whitelist
onKernelGatewayApp
in the end so clearly distinguished fromJupyterWebsocketPersonality.env_whitelist
which is whitelist of environment variables that can be passed from client making request to start kernel. Need to be different to also avoid conflict withKG_ENV_WHITELIST
environment variable.