-
Notifications
You must be signed in to change notification settings - Fork 134
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
JUPYTERHUB_OAUTH_SCOPES and JUPYTERHUB_OAUTH_ACCESS_SCOPES not correctly set with openpbs #300
Comments
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗 |
Can you show the actual batch script it produces? #PBS -v TEST_ENV
echo TEST_ENV: "${TEST_ENV}" and submit it with: export TEST_ENV='["item1", "item2"]'
qsub script.sh Form the looks of it, it seems like it might be in how keepvars is implemented, which might be a pain to work around. |
Taken from the service log on the hub:
|
oof, so it looks like this is an actual bug in PBS/torque where it doesn't handle environment variables with quotation marks correctly. That's going to be frustrating to work around. Can you tell the name and version of your batch system? |
Product is Altair PBS Professional. Version installed:
If this is a massive pain just for the positively ancient scheduler installed at this site, I'm happy enough just to run with the workaround in place. I've got it documented internally and it's working now. I've just tested this in OpenPBS 23.06.06 (outside of JupyterHub/batchspawner, just by hand like above), and it has the same bug. I've also tested Slurm 23.11.4, and it does not have the same bug. It's working fine. Unfortunately I'm not set up to test Torque currently. I will pass this on to the commercial support people at Altair. If it's too painful to work around this specific use case, I'm happy for the issue to be closed, and I can pass on these details to the relevant projects and commercial support groups. |
I don't know how to get a test environment set up for openpbs, but this does appear to be a clear bug in openpbs incorrectly implementing environment escaping, which I found here. The general workaround would be to have two ways to specify environment variables, one which trusts |
I guess I'll chime in here. We run PBS Pro and not OpenPBS, but they share some history. Our site made a bug report on PBS Pro at some point regarding how variables were not properly constructed at job launch (huge problem and not the only one we have), but ultimately I ended up base64 encoding all the I can try to look up to see if it's fixed in our new 2022.1.5 version or 2021.1.3 which we just upgraded from if it's of interests to you, but regarding OpenPBS, it's quite a bit behind the PBS Pro versions unfortunately 😢 Anyways, not a great solution, but has worked for a bit for us. |
@jbaksta thanks, that's useful to know. I think it's really beneficial to be able to set actual environment variables on the submitting process and include only keys in the batch script. Putting env values in the script is not ideal, because there are API keys in there. But it seems clear that in at least some real situations values do need to be in the script, so having a flag for putting env values in the script which safely encodes them like you've done seems like it might be worth doing. It's unfortunate since it is pretty clearly a bug in PBS, but it's more important to be useful and meet people where they are than blame other projects' bugs and not do anything about it. |
There are number of issues with PBS that revolve around security and JupyterHub API keys. Also, if not paying attention around the server config, often times job submitted variables are open to the world. I'm not sure of the best way to address this is without maybe implementing some encryption on things, but that might require some elements that I'm not sure would work well in our environment either. |
Presumably such systems generally have a shared filesystem, so perhaps the simplest approach is to rely on filesystem permissions:
|
Echoing out the
JUPYTERHUB_OAUTH_SCOPES
andJUPYTERHUB_OAUTH_SCOPES
environment variables from JupyterHub jobs created by batchspawner, these values appear incorrect.The current solution I'm using is noted in this issue:
jupyterhub/jupyterhub#3866
I have the following in my
batch_script
section just before running the jupyterhub-singleuser component:And it produces:
The top two lines are the default set by batchspawner, which then cause the resulting jupyterhub-singleuser instances to fail authentication. The bottom two are after I override them, and allow the instances to pass authentication and work.
Local instances of jupyterhub-singleuser, jupyter-server or JupyterLab all work fine. The problem only exists with batchspawner creating the jobs.
I'm using ProfileSpawner to build various launch profiles, and within that PBSSpawner via batchspawner.
jupyterhub_config.py
snippet:Tested under both Python 3.10 and 3.12 with the following (batchspawner installed from main today).
The text was updated successfully, but these errors were encountered: