mamba-org / gator

Conda environment and package management extension from within Jupyter
Other
260 stars 31 forks source link

Feature: Cache Location #130

Open hakasapl opened 3 years ago

hakasapl commented 3 years ago

This is a feature request.

I'm running gator on a clustered installation served using JupyterHub. After looking over the code I've learned how gator caches packages - using the /tmp folder on the system and writing to everyone. Traditionally, this folder is not clustered - it is specific to the server. It would be great to have an option to set the "cache" location, in my case that would be a shared network location. That way when a cache gets updated it gets updated across the cluster.

I could work on a PR for this - although I'm not sure where you'd want the configuration option for this to live?

fcollonval commented 3 years ago

Thanks for reaching out @hakasapl

I could work on a PR for this - although I'm not sure where you'd want the configuration option for this to live?

The line that need to be parametrized is:

https://github.com/mamba-org/gator/blob/master/mamba_gator/handlers.py#L368

The ideal approach

In Jupyter ecosystem, it is recommended to use Configurable object for server settings. You can look at an example in jupyterlab-github.

Basically, once you have define the configurable and loaded it (see that line), you can add an option when starting the server; e.g. with the github extension

jupyter lab --GitHubConfig.access_token='< YOUR_ACCESS_TOKEN >'

or set it in a configuration file https://jupyter-server.readthedocs.io/en/stable/users/configuration.html

The quick approach

You can try reading a environment variable as the cache file. And if it does not exist fall back to the default.

You can even combine the two by defining a default for function for the settings - see for example: https://github.com/krassowski/jupyterlab-lsp/blob/master/python_packages/jupyter_lsp/jupyter_lsp/manager.py#L81

hakasapl commented 3 years ago

Thanks for this info, I would also prefer the ideal approach (or maybe both?). Let me do some more research on this and hopefully, I can get something going.