Package: jupyter-resource-usage
Installation|Configuration|Resources Displayed|Contributingjupyter-resource-usageJupyter Resource Usage is an extension for Jupyter Notebooks and JupyterLab that
displays an indication of how much resources your current notebook server and
its children (kernels, terminals, etc) are using. This is displayed in the
status bar in the JupyterLab and notebook, refreshing every 5s.Kernel resource usage can be displayed in a sidebar for IPython kernels withipykernel>= 6.11.0.The kernel usage is available for Notebook 7.x too which can be enabled atView -> Right Sidebar -> Show Kernel Usage. In the case of JupyterLab interface, it is
enough to clicktachometericon on the right sidebar.The package provides an alternative frontend for thejupyter-resource-usagemetrics:Previously, this extension used to be distributed withjupyterlab-system-monitorpackage.
Starting from1.0.0, the alternative frontend has been integrated into the
current repository. CheckAlternative frontendsection
on how to enable and configure this alternative frontend.Notethat for JupyterLab 3.x and 2.x, users should install the alternative frontend
fromjupyterlab-system-monitor.InstallationJupyterLab 4.x and Notebook 7.xYou should install the latest version>=1.0.0for JupyterLab 4 compatability.pipinstalljupyter-resource-usageOr withconda:condainstall-cconda-forgejupyter-resource-usageJupyterLab 3.x and Notebook 6.xYou should pin the versions to<1.0.0pipinstall'jupyter-resource-usage<1.0.0'Or withconda:condainstall-cconda-forge'jupyter-resource-usage<1.0.0'If your notebook version is < 5.3, you need to enable the extension manually.jupyter serverextension enable --py jupyter_resource_usage --sys-prefix
jupyter nbextension install --py jupyter_resource_usage --sys-prefix
jupyter nbextension enable --py jupyter_resource_usage --sys-prefixConfigurationMemory Limitjupyter-resource-usagecan display a memory limit (but not enforce it). You can set this
in several ways:MEM_LIMITenvironment variable. This is set byJupyterHubif using a spawner that supports it.In the commandline when startingjupyter notebook, as--ResourceUseDisplay.mem_limit.In your Jupyter notebooktraitletsconfig fileThe limit needs to be set as an integer in Bytes.Memory usage warning thresholdThe background of the resource display can be changed to red when the user is near a memory limit.
The threshold for this warning can be configured as a fraction of the memory limit.If you want to flash the warning to the user when they are within 10% of the memory limit, you
can set the parameter--ResourceUseDisplay.mem_warning_threshold=0.1.CPU Usagejupyter-resource-usagecan also track CPU usage and report acpu_percentvalue as part of the/api/metrics/v1response.You can set thecpu_limitin several ways:CPU_LIMITenvironment variable. This is set byJupyterHubif using a spawner that supports it.In the command line when startingjupyter notebook, as--ResourceUseDisplay.cpu_limit.In your Jupyter notebooktraitletsconfig fileThe limit corresponds to the number of cpus the user has access to, but does not enforce it.Additionally, you can set thetrack_cpu_percenttrait to enable CPU usage tracking (disabled by default):c=get_config()c.ResourceUseDisplay.track_cpu_percent=TrueAs a command line argument:jupyternotebook--ResourceUseDisplay.track_cpu_percent=TrueWhentrack_cpu_percentis set toTrue, status will report CPU utilisation along with
memory:Disable Prometheus MetricsThere is aknown bugwith Prometheus metrics which
causes "lag"/pauses in the UI. To workaround this you can disable Prometheus metric reporting using:--ResourceUseDisplay.enable_prometheus_metrics=FalseEnable alternative frontendBy default, the alternative frontend is disabled. To enable it, users should go toSettings -> Settings Editor -> Resource Usage Indicatorwhich will render following
formBy checking "Enable resource usage indicators" and refreshing the browser tab will
render the alternative frontend in the topbar.Users can change the label and refresh rate for the alternative frontend using settings
editor.Resources DisplayedCurrently the server extension only reports memory usage and CPU usage. Other metrics will be added in the future as needed.Memory usage will show the PSS whenever possible (Linux only feature), and default to RSS otherwise.The notebook extension currently doesn't show CPU usage, only memory usage.ContributingIf you would like to contribute to the project, please read theCONTRIBUTING.md. TheCONTRIBUTING.mdfile
explains how to set up a development installation and how to run the test suite.