Skip to content

Commit 45e3639

Browse files
authored
Merge branch 'jupyter-server:main' into Add-Host-Available-Memory
2 parents 31de904 + a84a8ad commit 45e3639

File tree

13 files changed

+80
-32
lines changed

13 files changed

+80
-32
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@v3
14+
uses: actions/checkout@v4
1515

1616
- name: Checkout
17-
uses: actions/checkout@v3
17+
uses: actions/checkout@v4
1818

1919
- name: Base Setup
2020
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

.github/workflows/check-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
check_release:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1818
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
1919
- name: Check Release
2020
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@v3
16+
uses: actions/checkout@v4
1717

1818
- name: Base Setup
1919
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
os: [ubuntu-latest, macos-latest, windows-latest]
16-
python-version: ["3.8", "3.11"]
16+
python-version: ["3.9", "3.13"]
1717

1818
steps:
1919
- name: Checkout
20-
uses: actions/checkout@v3
20+
uses: actions/checkout@v4
2121

2222
- name: Base Setup
2323
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
@@ -37,6 +37,6 @@ jobs:
3737
check_links:
3838
runs-on: ubuntu-latest
3939
steps:
40-
- uses: actions/checkout@v3
40+
- uses: actions/checkout@v4
4141
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
4242
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1

CHANGELOG.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22

33
<!-- <START NEW CHANGELOG ENTRY> -->
44

5+
## 1.2.0
6+
7+
([Full Changelog](https://github.com/jupyter-server/jupyter-resource-usage/compare/@jupyter-server/[email protected]))
8+
9+
### Enhancements made
10+
11+
- Configure `standby` callback to polling [#247](https://github.com/jupyter-server/jupyter-resource-usage/pull/247) ([@mahendrapaipuri](https://github.com/mahendrapaipuri))
12+
13+
### Contributors to this release
14+
15+
([GitHub contributors page for this release](https://github.com/jupyter-server/jupyter-resource-usage/graphs/contributors?from=2025-02-04&to=2025-08-19&type=c))
16+
17+
[@jtpio](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter-resource-usage+involves%3Ajtpio+updated%3A2025-02-04..2025-08-19&type=Issues) | [@mahendrapaipuri](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter-resource-usage+involves%3Amahendrapaipuri+updated%3A2025-02-04..2025-08-19&type=Issues)
18+
19+
<!-- <END NEW CHANGELOG ENTRY> -->
20+
521
## 1.1.1
622

723
([Full Changelog](https://github.com/jupyter-server/jupyter-resource-usage/compare/@jupyter-server/[email protected]))
@@ -25,8 +41,6 @@
2541

2642
[@evsasha](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter-resource-usage+involves%3Aevsasha+updated%3A2024-07-31..2025-02-04&type=Issues) | [@jtpio](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter-resource-usage+involves%3Ajtpio+updated%3A2024-07-31..2025-02-04&type=Issues) | [@krassowski](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter-resource-usage+involves%3Akrassowski+updated%3A2024-07-31..2025-02-04&type=Issues) | [@pinksi](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter-resource-usage+involves%3Apinksi+updated%3A2024-07-31..2025-02-04&type=Issues) | [@welcome](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter-resource-usage+involves%3Awelcome+updated%3A2024-07-31..2025-02-04&type=Issues)
2743

28-
<!-- <END NEW CHANGELOG ENTRY> -->
29-
3044
## 1.1.0
3145

3246
([Full Changelog](https://github.com/jupyter-server/jupyter-resource-usage/compare/@jupyter-server/[email protected]))

jupyter_resource_usage/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.1.1"
1+
__version__ = "1.2.0"

jupyter_resource_usage/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ async def get(self):
9898
def _get_cpu_percent(self, all_processes):
9999
def get_cpu_percent(p):
100100
try:
101-
return p.cpu_percent(interval=0.05)
101+
return p.cpu_percent()
102102
# Avoid littering logs with stack traces complaining
103103
# about dead processes having no CPU usage
104104
except:

jupyter_resource_usage/tests/test_basic.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,18 @@ def test_import_serverextension(self):
3030
nbapp_mock.web_app.settings = {"base_url": ""}
3131

3232
# mock these out for unit test
33-
with patch("tornado.ioloop.PeriodicCallback") as periodic_callback_mock, patch(
34-
"jupyter_resource_usage.server_extension.ResourceUseDisplay"
35-
) as resource_use_display_mock, patch(
36-
"jupyter_resource_usage.server_extension.PrometheusHandler"
37-
) as prometheus_handler_mock, patch(
38-
"jupyter_resource_usage.server_extension.PSUtilMetricsLoader"
39-
) as psutil_metrics_loader:
33+
with (
34+
patch("tornado.ioloop.PeriodicCallback") as periodic_callback_mock,
35+
patch(
36+
"jupyter_resource_usage.server_extension.ResourceUseDisplay"
37+
) as resource_use_display_mock,
38+
patch(
39+
"jupyter_resource_usage.server_extension.PrometheusHandler"
40+
) as prometheus_handler_mock,
41+
patch(
42+
"jupyter_resource_usage.server_extension.PSUtilMetricsLoader"
43+
) as psutil_metrics_loader,
44+
):
4045
# load up with mock
4146
load_jupyter_server_extension(nbapp_mock)
4247

packages/labextension/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jupyter-server/resource-usage",
3-
"version": "1.1.1",
3+
"version": "1.2.0",
44
"description": "JupyterLab extension to add resource usage UI items",
55
"keywords": [
66
"jupyter",

packages/labextension/src/index.ts

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
ILabShell,
33
JupyterFrontEnd,
44
JupyterFrontEndPlugin,
5+
JupyterLab,
56
} from '@jupyterlab/application';
67

78
import { IToolbarWidgetRegistry } from '@jupyterlab/apputils';
@@ -70,14 +71,25 @@ const resourceStatusPlugin: JupyterFrontEndPlugin<void> = {
7071
id: '@jupyter-server/resource-usage:status-item',
7172
autoStart: true,
7273
requires: [ITranslator],
73-
optional: [IStatusBar],
74+
optional: [IStatusBar, JupyterLab.IInfo],
7475
activate: (
7576
app: JupyterFrontEnd,
7677
translator: ITranslator,
77-
statusBar: IStatusBar | null
78+
statusBar: IStatusBar | null,
79+
info: JupyterLab.IInfo | null
7880
) => {
81+
const refreshRate = DEFAULT_REFRESH_RATE;
82+
7983
const trans = translator.load('jupyter-resource-usage');
80-
const item = new ResourceUsageStatus(trans);
84+
const item = new ResourceUsageStatus(trans, {
85+
refreshRate,
86+
refreshStandby: () => {
87+
if (info) {
88+
return !info.isConnected || 'when-hidden';
89+
}
90+
return 'when-hidden';
91+
},
92+
});
8193

8294
if (statusBar) {
8395
statusBar.registerStatusItem(resourceStatusPlugin.id, {
@@ -98,11 +110,12 @@ const systemMonitorPlugin: JupyterFrontEndPlugin<void> = {
98110
id: '@jupyter-server/resource-usage:topbar-item',
99111
autoStart: true,
100112
requires: [IToolbarWidgetRegistry],
101-
optional: [ISettingRegistry],
113+
optional: [ISettingRegistry, JupyterLab.IInfo],
102114
activate: async (
103115
app: JupyterFrontEnd,
104116
toolbarRegistry: IToolbarWidgetRegistry,
105-
settingRegistry: ISettingRegistry | null
117+
settingRegistry: ISettingRegistry | null,
118+
info: JupyterLab.IInfo | null
106119
) => {
107120
let enablePlugin = DEFAULT_ENABLE_SYSTEM_MONITOR;
108121
let refreshRate = DEFAULT_REFRESH_RATE;
@@ -126,7 +139,15 @@ const systemMonitorPlugin: JupyterFrontEndPlugin<void> = {
126139
diskLabel = diskSettings.label;
127140
}
128141

129-
const model = new ResourceUsage.Model({ refreshRate });
142+
const model = new ResourceUsage.Model({
143+
refreshRate,
144+
refreshStandby: () => {
145+
if (info) {
146+
return !info.isConnected || 'when-hidden';
147+
}
148+
return 'when-hidden';
149+
},
150+
});
130151
await model.refresh();
131152

132153
if (enablePlugin && model.cpuAvailable) {

0 commit comments

Comments
 (0)