-
Notifications
You must be signed in to change notification settings - Fork 280
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
Add Session workflows documentation #808
Changes from 1 commit
f4d8b0a
052cf6f
b11e28c
49d5bde
a8cf76e
1d8d771
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -71,3 +71,95 @@ Jupyter Server contains the following components: | |||||||||
- **Kernel Spec Manager** parses files with JSON specification for a Kernels, | ||||||||||
and provides a list of available Kernel configurations. To learn about | ||||||||||
Kernel Spec, check `the Jupyter Client guide <https://jupyter-client.readthedocs.io/en/stable/kernels.html#kernel-specs>`_. | ||||||||||
|
||||||||||
Create Session Workflow | ||||||||||
----------------------- | ||||||||||
|
||||||||||
The create Session workflow can be seen in figure below: | ||||||||||
|
||||||||||
.. image:: ../images/session-create.drawio.png | ||||||||||
:alt: Create Session Workflow | ||||||||||
:width: 90% | ||||||||||
:align: center | ||||||||||
|
||||||||||
When a user starts a new Kernel, the following steps process: | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think "Kernel" should be "kernel" except when it's a proper noun (e.g., Mapping Kernel Manager, Kernel Spec Manager, etc.). I believe this was also true in the general architecture section as well. Perhaps a sweep can be made for such instances. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good, I will change it to "kernel". |
||||||||||
|
||||||||||
#. The Notebook client sends |create_session|_ request to Jupyter Server. This | ||||||||||
request has all necessary data, such as Notebook name, type, path, and Kernel | ||||||||||
name. | ||||||||||
|
||||||||||
#. **Session Manager** asks **Contents Manager** for the Kernel file system path | ||||||||||
based on the input data. | ||||||||||
|
||||||||||
#. **Session Manager** sends Kernel path to **Mapping Kernel Manager**. | ||||||||||
|
||||||||||
#. **Mapping Kernel Manager** starts the Kernel create process by using | ||||||||||
**Multi Kernel Manager** and **Kernel Manager**. You can learn more about | ||||||||||
**Multi Kernel Manager** in | ||||||||||
`the Jupyter Client APIs <https://jupyter-client.readthedocs.io/en/latest/api/manager.html#multikernelmanager-controlling-multiple-kernels>`_. | ||||||||||
|
||||||||||
#. **Kernel Manager** uses provisioner layer to launch a new Kernel. | ||||||||||
|
||||||||||
#. **Kernel Provisioner** is responsible for launching Kernels based on the | ||||||||||
Kernel specification. If Kernel specification doesn't define provisioner, | ||||||||||
it uses `Local Provisioner <https://jupyter-client.readthedocs.io/en/latest/api/provisioners.html#jupyter_client.provisioning.local_provisioner.LocalProvisioner>`_ | ||||||||||
to launch the Kernel. You can use | ||||||||||
`Kernel Provisioner Base <https://jupyter-client.readthedocs.io/en/latest/api/provisioners.html#jupyter_client.provisioning.provisioner_base.KernelProvisionerBase>`_ | ||||||||||
and | ||||||||||
`Kernel Provisioner Factory <https://jupyter-client.readthedocs.io/en/latest/api/provisioners.html#jupyter_client.provisioning.factory.KernelProvisionerFactory>`_ | ||||||||||
to create custom provisioners. | ||||||||||
|
||||||||||
#. **Kernel Spec Manager** gets the Kernel specification from the JSON file. | ||||||||||
The specification is located in ``kernel.json`` file. | ||||||||||
|
||||||||||
#. Once **Kernel Provisioner** launches the Kernel, | ||||||||||
**Kernel Manager** generates the new Kernel ID for **Session Manager**. | ||||||||||
|
||||||||||
#. **Session Manager** saves the new Session data to the SQLite3 DataBase | ||||||||||
(Session ID, Notebook path, Notebook name, Notebook type, and Kernel ID). | ||||||||||
|
||||||||||
#. Notebook client receives the created Session data. | ||||||||||
|
||||||||||
.. _create_session: https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/jupyter_server/master/jupyter_server/services/api/api.yaml#/sessions/post_api_sessions | ||||||||||
|
||||||||||
.. |create_session| replace:: the *POST /api/sessions* | ||||||||||
|
||||||||||
Delete Session Workflow | ||||||||||
----------------------- | ||||||||||
|
||||||||||
The delete Session workflow can be seen in figure below: | ||||||||||
|
||||||||||
.. image:: ../images/session-delete.drawio.png | ||||||||||
:alt: Delete Session Workflow | ||||||||||
:width: 80% | ||||||||||
:align: center | ||||||||||
|
||||||||||
When a user stops a Kernel, the following steps process: | ||||||||||
|
||||||||||
#. The Notebook client sends |delete_session|_ request to Jupyter Server. This | ||||||||||
request has the Session ID that Kernel is currently using. | ||||||||||
|
||||||||||
#. **Session Manager** gets the Session data from the SQLite3 DataBase and sends | ||||||||||
the Kernel ID to **Mapping Kernel Manager**. | ||||||||||
|
||||||||||
#. **Mapping Kernel Manager** starts the Kernel shutdown process by using | ||||||||||
**Multi Kernel Manager** and **Kernel Manager**. | ||||||||||
|
||||||||||
#. **Kernel Manager** receives interrupt mode from **Kernel Spec Manager**. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
**Kernel Manager** supports ``Signal`` and ``Message`` interrupt modes. | ||||||||||
By default, the ``Signal`` interrupt mode is being used. | ||||||||||
|
||||||||||
- When interrupt mode is ``Signal``, **Kernel Provisioner** kills the Kernel | ||||||||||
with ``SIGINT`` operating system signal. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The diagram for the signal-based interrupt should probably replace |
||||||||||
|
||||||||||
- When interrupt mode is ``Message``, **Session** sends | ||||||||||
the ``interrupt_request`` message on the control channel. Check the | ||||||||||
`messaging in Jupyter guide <https://jupyter-client.readthedocs.io/en/latest/messaging.html#msging-interrupt>`_ | ||||||||||
to know more about it. | ||||||||||
|
||||||||||
#. When Kernel is shutdown, **Session Manager** deletes the Session data from | ||||||||||
the SQLite3 DataBase and responses 204 Status Code to the Notebook client. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the kernel's shutdown be detailed similar to its interrupt? I know that can be a lot and we might be trying to limit text. Perhaps we could do something like... When the kernel is shutdown, ... and point to the code (or documentation produced from the code)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kevin-bates I think that makes sense. I added steps after kernel interrupt. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
.. _delete_session: https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/jupyter_server/master/jupyter_server/services/api/api.yaml#/sessions/delete_api_sessions__session_ | ||||||||||
|
||||||||||
.. |delete_session| replace:: the *DELETE /api/sessions/{session_id}* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.