Skip to main content

A server extension for synching managers in a running Jupyter Server.

Project description

Jupyter Server Synchronizer

A server extension that synchronizes all managers in a running Jupyter Server.

This is particularly useful for Jupyter Servers running remote kernels and contents.

Basic usage

Install and enable the extension:

pip install jupyter_server_synchronizer

jupyter server extension enable jupyter_server_synchronizer

When you start a Jupyter Server, it synchronize all managers before the Web application is started.

jupyter server

To synchronize periodically, enable the auto-synchronizing feature using the autosync config option. For example,

jupyter server --SynchronizerExtension.autosync=True

Otherwise, you can trigger the synchronization making a POST request to the /api/sync endpoint.

Example

Below is a example of running the synchronizer with Jupyter Server talking to a Jupyter Kernel Gateway as its "remote" kernel service provider.

First, start the Kernel Gateway. You'll need to enable the list_kernels method. In the example, we are assuming the Kernel Gateway is not multi-tenant; i.e. there is a single KG for a single Jupyter Server. We'll set the port to 9999 to free up 8888 for our Jupyter Server.

jupyter kernelgateway \
    --port 9999 \
    --JupyterWebsocketPersonality.list_kernels=True

Second, start the Jupyter Server and point it at the Kernel Gateway. Note that we set a database_filepath trait in both the SessionManager and SynchronizerExtension (these paths don't need to be the same). The Synchronize relies on saving/storing of information about Jupyter kernels and sessions in a persistent database. This information is necessary to rehydrate and synchronize.

We'll enable the "autosync" feature to periodically synchronize the server.

jupyter lab \
    --gateway-url=http://127.0.0.1:9999 \
    --SessionManager.database_filepath=jupyter-database.db \
    --SynchronizerExtension.database_filepath=jupyter-database.db \
    --SynchronizerExtension.autosync=True \
    --SynchronizerExtension.log_level=DEBUG

Now, let's kill that server:

kill -9 $(echo $(pgrep -lf jupyter-lab) | awk '{print $1;}')

And restart it to see if the kernels rehydrate and begin synchronizing again.

jupyter lab \
    --gateway-url=http://127.0.0.1:9999 \
    --SessionManager.database_filepath=jupyter-database.db \
    --SynchronizerExtension.database_filepath=jupyter-database.db \
    --SynchronizerExtension.autosync=True \
    --SynchronizerExtension.log_level=DEBUG

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jupyter_server_synchronizer-0.0.3.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file jupyter_server_synchronizer-0.0.3.tar.gz.

File metadata

File hashes

Hashes for jupyter_server_synchronizer-0.0.3.tar.gz
Algorithm Hash digest
SHA256 4d969a2f9f7c09d2ed4e05e63e0d576114a5e38891f7366b859953d932d33084
MD5 28e4fd56bb9b8d5da90dd6d80f086b9d
BLAKE2b-256 490f34ac7d3bc9e941590d4551065bb80f9903ec11673a6a0975d754cfff45c6

See more details on using hashes here.

Provenance

File details

Details for the file jupyter_server_synchronizer-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for jupyter_server_synchronizer-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 17f1c1456307a1ab61e48edc39f3e2964a0e46eed1ff947f999492b5ecb61869
MD5 4e26895c2aa949ea84ca0c940ff98b9b
BLAKE2b-256 ad3b585f4048efb73c9e872af04b6242d409fecd5c5f951d18b5921c2fdfe7a0

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page