You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/customize.rst
+18-3Lines changed: 18 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -424,13 +424,14 @@ Preheated kernels
424
424
==================
425
425
426
426
Since Voilà needs to start a new jupyter kernel and execute the requested notebook in this kernel for every connection, this would lead to a long waiting time before the widgets can be displayed in the browser.
427
-
To reduce this waiting time, especially for the heavy notebooks, users can activate the preheating kernel option of Voilà.
427
+
To reduce this waiting time, especially for heavy notebooks, users can activate the preheating kernel option of Voilà.
428
428
429
429
.. warning::
430
430
Because preheated kernels are not executed on request, this feature is incompatible with the `prelaunch-hook` functionality.
431
431
432
432
This option will enable two features:
433
433
434
+
434
435
- A pool of kernels is started for each notebook and kept in standby, then the notebook is executed in every kernel of its pool. When a new client requests a kernel, the preheated kernel in this pool is used and another kernel is started asynchronously to refill the pool.
435
436
- The HTML version of the notebook is rendered in each preheated kernel and stored, when a client connects to Voila, under some conditions, the cached HTML is served instead of re-rendering the notebook.
436
437
@@ -440,7 +441,15 @@ The preheating kernel option works with any kernel manager, it is deactivated by
440
441
441
442
voila --preheat_kernel=True --pool_size=5
442
443
443
-
If the pool size does not match the user's requirements, or some notebooks need to use environment variables..., additional settings are needed. The easiest way to change these settings is to provide a file named `voila.json` in the same folder containing the notebooks. Settings for preheating kernel ( list of notebooks does not need preheated kernels, number of kernels in pool, refilling delay, environment variables for starting kernel...) can be set under the `VoilaKernelManager` class name.
444
+
The default environment variables for preheated kernels can be set by the `VoilaKernelManager.default_env_variables` setting. For example, this command
will set the variable "FOO" in all preheated kernels.
451
+
452
+
If the pool size does not match the user's requirements, or some notebooks need to use specific environment variables..., additional settings are needed. The easiest way to change these settings is to provide a file named `voila.json` in the same folder containing the notebooks. Settings for preheating kernel ( list of notebooks does not need preheated kernels, number of kernels in pool, refilling delay, environment variables for starting kernel...) can be set under the `VoilaKernelManager` class name.
444
453
445
454
Here is an example of settings with explanations for preheating kernel option.
446
455
@@ -519,7 +528,7 @@ In preheating kernel mode, users can prepend with ``wait_for_request`` from ``vo
519
528
520
529
``wait_for_request`` will pause the execution of the notebook in the preheated kernel at this cell and wait for an actual user to connect to Voilà, set the request info environment variables and then continue the execution of the remaining cells.
521
530
522
-
If the Voilà websocket handler is not started with the default protocol (`ws`), the default IP address (`127.0.0.1`) the default port (`8866`) or with url suffix, users need to provide these values through the environment variables ``VOILA_WS_PROTOCOL``, ``VOILA_APP_IP``, ``VOILA_APP_PORT`` and ``VOILA_WS_BASE_URL``. The easiest way is to set these variables in the `voila.json` configuration file, for example:
531
+
If the Voilà websocket handler is not started with the default protocol (`ws`), the default IP address (`127.0.0.1`) the default port (`8866`) or with url suffix, users need to provide these values through the environment variables ``VOILA_WS_PROTOCOL``, ``VOILA_APP_IP``, ``VOILA_APP_PORT`` and ``VOILA_WS_BASE_URL``. One way to set these variables is in the `voila.json` configuration file, for example:
523
532
524
533
.. code-block:: python
525
534
@@ -540,6 +549,12 @@ If the Voilà websocket handler is not started with the default protocol (`ws`),
0 commit comments