Skip to content

Emit events about file changes in Contents Manager API? #1580

@krassowski

Description

@krassowski

Problem

Currently we use polling/infinite loops to check for file/directory status:

  • frontends check for directory updates every 10 seconds
  • jupyter-collaboration checks for file modifications every 1 second

This can mean that we end up hitting the Contents Manager GET too often and that users do not get updates as soon as they should. In case of out-of-band reload monitoring, this can generate many false-positive 404 logs as described in jupyterlab/jupyter-collaboration#517.

Proposed Solution

  • listen to the filesystem changes
    • easy on linux with inotify (there are many Python wrappers)
    • there are good cross-platform solutions with a Python API:
  • emit events about changes in the root directory and its subdirectories to the frontend:
    • we could use jupyter-events
  • add an optional method to the ContentsManager allowing to check if it supports notification events for a given directory; this is because ContentsManagers could dispatch to different sources as in HybridContentsManager
    • we may also add a dedicated REST API endpoint or instead include this information in directory response (similar to how we added hash)

Additional context

We discussed using watchdog or watchfiles in jupyter-server/jupyter_server_fileid#80 too.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions