Skip to content

Commit 22c74d8

Browse files
authored
Merge pull request #16 from mwakaba2/pr-update-time
Fix: display notifications for set minimum execution time > 60
2 parents 0c90352 + 134f76a commit 22c74d8

File tree

2 files changed

+40
-13
lines changed

2 files changed

+40
-13
lines changed

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ const extension: JupyterFrontEndPlugin<void> = {
8989
metadata
9090
);
9191
const diff = new Date(<any>cellEndTime - <any>cellStartTime);
92-
if (diff.getSeconds() >= minimumCellExecutionTime) {
92+
const diffSeconds = Math.floor(diff.getTime() / 1000);
93+
if (diffSeconds >= minimumCellExecutionTime) {
9394
const cellDuration = diff.toISOString().substr(11, 8);
9495
const cellNumber =
9596
cellNumberType === 'cell_index'

tutorial/notebook_notification_py3_demo.ipynb

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
"execution_count": 1,
66
"metadata": {
77
"execution": {
8-
"iopub.execute_input": "2021-05-16T01:17:43.398697Z",
9-
"iopub.status.busy": "2021-05-16T01:17:43.398438Z",
10-
"iopub.status.idle": "2021-05-16T01:17:43.406473Z",
11-
"shell.execute_reply": "2021-05-16T01:17:43.405574Z",
12-
"shell.execute_reply.started": "2021-05-16T01:17:43.398631Z"
8+
"iopub.execute_input": "2021-06-18T16:13:11.410779Z",
9+
"iopub.status.busy": "2021-06-18T16:13:11.410414Z",
10+
"iopub.status.idle": "2021-06-18T16:13:11.423394Z",
11+
"shell.execute_reply": "2021-06-18T16:13:11.422189Z",
12+
"shell.execute_reply.started": "2021-06-18T16:13:11.410668Z"
1313
},
1414
"tags": []
1515
},
@@ -28,14 +28,40 @@
2828
},
2929
{
3030
"cell_type": "code",
31-
"execution_count": 2,
31+
"execution_count": 5,
32+
"metadata": {
33+
"execution": {
34+
"iopub.execute_input": "2021-06-18T16:23:33.407046Z",
35+
"iopub.status.busy": "2021-06-18T16:23:33.406829Z",
36+
"iopub.status.idle": "2021-06-18T16:23:36.529019Z",
37+
"shell.execute_reply": "2021-06-18T16:23:36.528045Z",
38+
"shell.execute_reply.started": "2021-06-18T16:23:33.407023Z"
39+
}
40+
},
41+
"outputs": [
42+
{
43+
"name": "stdout",
44+
"output_type": "stream",
45+
"text": [
46+
"hello!\n"
47+
]
48+
}
49+
],
50+
"source": [
51+
"!sleep 3\n",
52+
"print(\"hello!\")"
53+
]
54+
},
55+
{
56+
"cell_type": "code",
57+
"execution_count": 6,
3258
"metadata": {
3359
"execution": {
34-
"iopub.execute_input": "2021-05-16T01:17:43.408122Z",
35-
"iopub.status.busy": "2021-05-16T01:17:43.407871Z",
36-
"iopub.status.idle": "2021-05-16T01:17:46.537467Z",
37-
"shell.execute_reply": "2021-05-16T01:17:46.536828Z",
38-
"shell.execute_reply.started": "2021-05-16T01:17:43.408099Z"
60+
"iopub.execute_input": "2021-06-18T16:23:46.212426Z",
61+
"iopub.status.busy": "2021-06-18T16:23:46.212217Z",
62+
"iopub.status.idle": "2021-06-18T16:24:52.337429Z",
63+
"shell.execute_reply": "2021-06-18T16:24:52.336762Z",
64+
"shell.execute_reply.started": "2021-06-18T16:23:46.212401Z"
3965
},
4066
"tags": []
4167
},
@@ -49,7 +75,7 @@
4975
}
5076
],
5177
"source": [
52-
"!sleep 3\n",
78+
"!sleep 66\n",
5379
"print(\"hello world!\")"
5480
]
5581
},

0 commit comments

Comments
 (0)