Skip to content

Commit 6fef2a8

Browse files
authored
Merge pull request #324 from mwakaba2/async-contents-api
Asynchronous Contents API
2 parents 28f784b + 7d863f3 commit 6fef2a8

File tree

21 files changed

+1658
-216
lines changed

21 files changed

+1658
-216
lines changed

docs/source/developers/contents.rst

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,19 +192,19 @@ methods:
192192
ContentsManager.is_hidden
193193

194194
You may be required to specify a Checkpoints object, as the default one,
195-
``FileCheckpoints``, could be incompatible with your custom
195+
``FileCheckpoints``, could be incompatible with your custom
196196
ContentsManager.
197197

198198
Customizing Checkpoints
199199
-----------------------
200200
.. currentmodule:: jupyter_server.services.contents.checkpoints
201201

202-
Customized Checkpoint definitions allows behavior to be
202+
Customized Checkpoint definitions allows behavior to be
203203
altered and extended.
204204

205205
The ``Checkpoints`` and ``GenericCheckpointsMixin`` classes
206206
(from :mod:`jupyter_server.services.contents.checkpoints`)
207-
have reusable code and are intended to be used together,
207+
have reusable code and are intended to be used together,
208208
but require the following methods to be implemented.
209209

210210
.. autosummary::
@@ -220,7 +220,7 @@ No-op example
220220
~~~~~~~~~~~~~
221221

222222
Here is an example of a no-op checkpoints object - note the mixin
223-
comes first. The docstrings indicate what each method should do or
223+
comes first. The docstrings indicate what each method should do or
224224
return for a more complete implementation.
225225

226226
.. code-block:: python
@@ -238,7 +238,7 @@ return for a more complete implementation.
238238
def delete_checkpoint(self, checkpoint_id, path):
239239
"""deletes a checkpoint for a file"""
240240
def list_checkpoints(self, path):
241-
"""returns a list of checkpoint models for a given file,
241+
"""returns a list of checkpoint models for a given file,
242242
default just does one per file
243243
"""
244244
return []
@@ -267,3 +267,24 @@ ContentsManager.
267267
.. _NBFormat: https://nbformat.readthedocs.io/en/latest/index.html
268268
.. _PGContents: https://github.com/quantopian/pgcontents
269269
.. _PostgreSQL: https://www.postgresql.org/
270+
271+
Asynchronous Support
272+
--------------------
273+
274+
An asynchronous version of the Contents API is available to run slow IO processes concurrently.
275+
276+
- :class:`~manager.AsyncContentsManager`
277+
- :class:`~filemanager.AsyncFileContentsManager`
278+
- :class:`~largefilemanager.AsyncLargeFileManager`
279+
- :class:`~checkpoints.AsyncCheckpoints`
280+
- :class:`~checkpoints.AsyncGenericCheckpointsMixin`
281+
282+
.. note::
283+
284+
.. _contentfree:
285+
286+
In most cases, the non-asynchronous Contents API is performant for local filesystems.
287+
However, if the Jupyter Notebook web application is interacting with a high-latent virtual filesystem, you may see performance gains by using the asynchronous version.
288+
For example, if you're experiencing terminal lag in the web application due to the slow and blocking file operations, the asynchronous version can reduce the lag.
289+
Before opting in, comparing both non-async and async options' performances is recommended.
290+

0 commit comments

Comments
 (0)