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: README.md
+97-2Lines changed: 97 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,83 @@ that the server extension is enabled:
34
34
jupyter server extension list
35
35
```
36
36
37
+
## How does it works
38
+
39
+
### Generic case
40
+
41
+
Execution of a Python code snippet: `print("hello")`
42
+
43
+
```mermaid
44
+
sequenceDiagram
45
+
Frontend->>+Server: POST /api/kernels/<id>/execute
46
+
Server->>+ExecutionStack: Create asyncio.Task
47
+
ExecutionStack->>Kernel: Execute request msg
48
+
activate Kernel
49
+
ExecutionStack-->>Server: Task uid
50
+
Server-->>-Frontend: Returns task uid
51
+
loop Running
52
+
Kernel->>Shared Document: Add output
53
+
Shared Document->>Frontend: Document update
54
+
end
55
+
loop While status is 202
56
+
Frontend->>+Server: GET /api/kernels/<id>/requests/<uid>
57
+
Server->>ExecutionStack: Get task result
58
+
ExecutionStack-->>Server: null
59
+
Server-->>-Frontend: Request status 202
60
+
end
61
+
Kernel-->>ExecutionStack: Execution reply
62
+
deactivate Kernel
63
+
Frontend->>+Server: GET /api/kernels/<id>/requests/<uid>
64
+
Server->>ExecutionStack: Get task result
65
+
ExecutionStack-->>Server: Result
66
+
Server-->>-Frontend: Status 200 & result
67
+
```
68
+
69
+
### With input case
70
+
71
+
72
+
Execution of a Python code snippet: `input("Age:")`
73
+
74
+
```mermaid
75
+
sequenceDiagram
76
+
Frontend->>+Server: POST /api/kernels/<id>/execute
77
+
Server->>+ExecutionStack: Create asyncio.Task
78
+
ExecutionStack->>Kernel: Execute request msg
79
+
activate Kernel
80
+
ExecutionStack-->>Server: Task uid
81
+
Server-->>-Frontend: Returns task uid
82
+
loop Running
83
+
Kernel->>Shared Document: Add output
84
+
Shared Document->>Frontend: Document update
85
+
end
86
+
loop While status is 202
87
+
Frontend->>+Server: GET /api/kernels/<id>/requests/<uid>
88
+
Server->>ExecutionStack: Get task result
89
+
ExecutionStack-->>Server: null
90
+
Server-->>-Frontend: Request status 202
91
+
end
92
+
Kernel->>ExecutionStack: Set pending input
93
+
Frontend->>+Server: GET /api/kernels/<id>/requests/<uid>
94
+
Server->>ExecutionStack: Get task result
95
+
ExecutionStack-->>Server: Pending input
96
+
Server-->>-Frontend: Status 300 & Pending input
97
+
Frontend->>+Server: POST /api/kernels/<id>/input
98
+
Server->>Kernel: Send input msg
99
+
Server-->>-Frontend:
100
+
loop While status is 202
101
+
Frontend->>+Server: GET /api/kernels/<id>/requests/<uid>
102
+
Server->>ExecutionStack: Get task result
103
+
ExecutionStack-->>Server: null
104
+
Server-->>-Frontend: Request status 202
105
+
end
106
+
Kernel-->>ExecutionStack: Execution reply
107
+
deactivate Kernel
108
+
Frontend->>+Server: GET /api/kernels/<id>/requests/<uid>
109
+
Server->>ExecutionStack: Get task result
110
+
ExecutionStack-->>Server: Result
111
+
Server-->>-Frontend: Status 200 & result
112
+
```
113
+
37
114
## Contributing
38
115
39
116
### Development install
@@ -46,7 +123,6 @@ jupyter server extension list
46
123
pip install -e .
47
124
```
48
125
49
-
50
126
You can watch the source directory and run your Jupyter Server-based application at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension. For example,
51
127
when running JupyterLab:
52
128
@@ -61,6 +137,25 @@ server directly:
61
137
jupyter server --autoreload
62
138
```
63
139
140
+
### Manual testing
141
+
142
+
```bash
143
+
# Terminal 1.
144
+
jupyter server --port 8888 --autoreload --ServerApp.disable_check_xsrf=True --IdentityProvider.token= --ServerApp.port_retries=0
145
+
146
+
# Terminal 2.
147
+
KERNEL=$(curl -X POST http://localhost:8888/api/kernels)
0 commit comments