Skip to content
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

Implement file ID service #244

Merged
merged 6 commits into from
Nov 24, 2022
Merged

Conversation

davidbrochart
Copy link
Collaborator

This is the counterpart of jupyter-server-fileid.

@kevin-bates
Copy link
Member

I thought the path parameter to index() and get_id(), etc. was an api-path (i.e., a path relative to the root_dir or what would be termed as the content_root), but I don't see anywhere that is pre-pending a "root" to the api-path.

Does Jupyverse have the notion of a source root or are all paths absolute from the git-go? Does it support non-filesystem-based content? (I suppose this is purely a matter of "plugging in" a different contents module.)

@davidbrochart
Copy link
Collaborator Author

Does Jupyverse have the notion of a source root or are all paths absolute from the git-go?

Not yet, see #236.

Does it support non-filesystem-based content?

There is currently only a filesystem-based contents plugin, but this is definitely coming.

@davidbrochart davidbrochart marked this pull request as ready for review November 10, 2022 11:26
@davidbrochart davidbrochart marked this pull request as draft November 10, 2022 11:37
Copy link
Member

@kevin-bates kevin-bates left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi David. I hope its okay to provide some suggestions even while this is in draft mode.

plugins/contents/fps_contents/fileid.py Outdated Show resolved Hide resolved
plugins/contents/fps_contents/fileid.py Outdated Show resolved Hide resolved
plugins/contents/fps_contents/fileid.py Outdated Show resolved Hide resolved
plugins/contents/fps_contents/fileid.py Outdated Show resolved Hide resolved
@davidbrochart
Copy link
Collaborator Author

Hi David. I hope its okay to provide some suggestions even while this is in draft mode.

Thanks for the comments Kevin! They are all very relevant, I'll make the suggested changes 👍

@Wh1isper
Copy link
Contributor

Out of curiosity, why not use os.stat_result.st_ino to identify whether the file is the original file (in the case of mv, etc.)

@Wh1isper
Copy link
Contributor

Out of curiosity, why not use os.stat_result.st_ino to identify whether the file is the original file (in the case of mv, etc.)

For those of you who have the same questions as me, there doesn't seem to be a good solution across systems

jupyter-server/jupyter_server_fileid#2 (comment)

@davidbrochart
Copy link
Collaborator Author

There is this error on server shutdown:

[E 2022-11-23 15:51:17 asyncio] unhandled exception during asyncio.run() shutdown
task: <Task finished name='Task-3' coro=<FileIdManager.watch_files() done, defined at /home/david/github/davidbrochart/jupyverse/plugins/contents/fps_contents/fileid.py:84> exception=RuntimeError('Already borrowed')>
Traceback (most recent call last):
  File "/home/david/github/davidbrochart/jupyverse/plugins/contents/fps_contents/fileid.py", line 102, in watch_files
    async for changes in awatch("."):
  File "/home/david/.local/share/hatch/env/virtual/jupyverse/PUXaZIS7/dev.jupyterlab-noauth/lib/python3.10/site-packages/watchfiles/main.py", line 238, in awatch
    with RustNotify([str(p) for p in paths], debug, force_polling, poll_delay_ms, recursive) as watcher:
RuntimeError: Already borrowed

See these issues:

Co-authored-by: Wh1isper <9573586@qq.com>
@davidbrochart davidbrochart merged commit 1c71f80 into jupyter-server:main Nov 24, 2022
@davidbrochart davidbrochart deleted the file_id branch November 24, 2022 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants