jupyterhub / jupyterhub/batchspawner
Rethinking environment handling
- Dominant language
- Python
- Stars
- 207
- Forks
- 136
- PR merge metrics
- No merged PRs in 30d
Description
I think we need to rethink environment handling:
Currently there is `req_keepvars` which sets `{{keepvars}}` in the batch script to a comma separated list, but does *not* add them to the environment itself. The environment which is gotten from `.get_env()` which comes from JupyterHub, and JupyterHub gives only what is needed.
Problems:
* There is no way to specify kept environment variables without specifying *everything* again
* `req_keepvars` doesn't add new variables to the env dict which is passed to spawners
* The same environment is passed to the batch commands as is passed to the single-user notebook server.
I am working on rewrite (started from #119 long ago) to improve things. But it's become clear that we need a new mental model of how the variables even work.
Here is what I propose:
* a concept of "user environment" which comes from `.get_env()` (`get_env` is a JH concept)
* controlled with `req_keepvars`, which is *only* the *extra* variables which should be added, not the defalut.
* `req_keepvars_default` which take the place of old `req_keepvars`. Or this can just be left out (my first implementation will have it to avoid too many problems.
* a concept of "admin environment" which is sent to the batch commands
* by default is everything in `.get_env()`
* controlled by `admin_environment` which takes the same form as `req_keepvars`
* `.run_command()` (which executes the batch commands, poll commands, cancel commands, and so on) always gets the admin environment
* It is up to the batch scripts to be able to use `{{keepvars}}` to limit what the user has access to.
What do you think?
Contributor guide
Assessment
This issue has not been assessed yet.