@@ -34,12 +34,12 @@ jupyter nbextension enable --py nbresuse --sys-prefix
34
34
### Memory Limit
35
35
36
36
` nbresuse ` can display a memory limit (but not enforce it). You can set this
37
- in serveral ways:
37
+ in several ways:
38
38
39
- 1 . ` MEM_LIMIT ` environment variable. This is set by [ JupyterHub] ( http ://github.com/jupyterhub/jupyterhub/)
39
+ 1 . ` MEM_LIMIT ` environment variable. This is set by [ JupyterHub] ( https ://github.com/jupyterhub/jupyterhub/)
40
40
if using a spawner that supports it.
41
41
2 . In the commandline when starting ` jupyter notebook ` , as ` --ResourceUseDisplay.mem_limit ` .
42
- 3 . In your jupyter notebook [ traitlets] ( https://traitlets.readthedocs.io/en/stable/ ) config file
42
+ 3 . In your Jupyter notebook [ traitlets] ( https://traitlets.readthedocs.io/en/stable/ ) config file
43
43
44
44
The limit needs to be set as an integer in Bytes.
45
45
@@ -53,7 +53,36 @@ The threshold for this warning can be configured as a fraction of the memory lim
53
53
If you want to flash the warning to the user when they are within 10% of the memory limit, you
54
54
can set the parameter ` --ResourceUseDisplay.mem_warning_threshold=0.1 ` .
55
55
56
+
57
+ ### CPU Usage
58
+
59
+ ` nbresuse ` can also track CPU usage and report a ` cpu_percent ` value as part of the ` /metrics ` response.
60
+
61
+ You can set the ` cpu_limit ` in several ways:
62
+
63
+ 1 . ` CPU_LIMIT ` environment variable. This is set by [ JupyterHub] ( https://github.com/jupyterhub/jupyterhub/ )
64
+ if using a spawner that supports it.
65
+ 2 . In the command line when starting ` jupyter notebook ` , as ` --ResourceUseDisplay.cpu_limit ` .
66
+ 3 . In your Jupyter notebook [ traitlets] ( https://traitlets.readthedocs.io/en/stable/ ) config file
67
+
68
+ The limit corresponds to the number of cpus the user has access to, but does not enforce it.
69
+
70
+ Additionally, you can set the ` track_cpu_percent ` trait to enable CPU usage tracking (disabled by default):
71
+
72
+ ``` python
73
+ c = get_config()
74
+ c.NotebookApp.ResourceUseDisplay.track_cpu_percent = True
75
+ ```
76
+
77
+ As a command line argument:
78
+
79
+ ``` bash
80
+ jupyter notebook --ResourceUseDisplay.track_cpu_percent=True
81
+ ```
82
+
56
83
## Resources displayed
57
84
58
85
Currently it only displays Memory usage (just RSS). Other metrics will be
59
- added in the future as needed.
86
+ added in the future as needed.
87
+
88
+ The notebook extension currently doesn't show CPU usage.
0 commit comments