-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Allow Multiple ContentsManager #3233
Comments
@Carreau and @KesterTong already built something like this called MixedContentsManager as part of a project to integrate Jupyter with Google Drive. It hasn't been touched for a while, but maybe there's something useful to work with there. From the notebook's point of view, I think it's fine to do this entirely within the ContentsManager, which is already pluggable. So I'd suggest building it as a separate thing for now, and then proposing it for inclusion in |
Yep there was some plan to make the mixed content manager the default, and just allow to add/remove extra content managers. @ian-r-rose may have also worked on that with his github and google drive plugins for JupyterLab. |
Yes, I have worked on a client-side approach to this in JupyterLab, which dispatches requests to different storage backends, each of which implements the Contents API. This is currently used for the JupyterLab Google Drive and GitHub plugins. |
This code is a WIP but does work: A ContentsManager that passes to other ContentsManagers who also have a manages_path function:
Example manager (typically manages_path has a regexp in it):
Now in a jupyter config:
Any suggestions? |
This seems to be a ready made solution: |
Can we make it possible to allow for multiple content managers in notebook server?
In a complex environment there may be a more than one type of notebook source so it is better to compose them from the right managers. For example, some notebooks may be from disk, others from a database, while others that purely are read only and exist in memory. Which content manager you call should be driven by the path (
/file/full/path/to/file
,/db/table/entry
).I was able to write something that works as a POC for this by taking a ContextManager and then dispatching all calls to a list of internally managed ContextMangers. It simply goes in order of those managers and calls an additional function on each, manages_path(path), which returns true if it wants to manage this path. It then passes on the call to this manager and returns its output. This is crude and would be better if there was a fully supported way to make this happen as I imagine there will likely be similar issues with things like the FileCheckpoints etc.
Would this be something this project would be open to taking up?
The text was updated successfully, but these errors were encountered: