@@ -74,28 +74,34 @@ Execution of a Python code snippet: `print("hello")`
74
74
75
75
``` mermaid
76
76
sequenceDiagram
77
+ actor Frontend; participant Shared Document; actor Server; participant ExecutionStack; actor Kernel
78
+ Frontend->>Shared Document: [*] busy
77
79
Frontend->>+Server: POST /api/kernels/<id>/execute
78
- Server->>+ExecutionStack: Queue request
80
+ Server->>+ExecutionStack: put() request into queue
79
81
ExecutionStack->>Kernel: Execute request msg
80
82
activate Kernel
81
83
ExecutionStack-->>Server: Task uid
82
84
Server-->>-Frontend: Returns task uid
83
85
loop Running
84
- Kernel->>Shared Document: Add output
86
+ Kernel->>Server: stream / display_data / execute_result / error msg
87
+ Server->>Shared Document: Add output
85
88
Shared Document->>Frontend: Document update
86
89
end
87
90
loop While status is 202
88
91
Frontend->>+Server: GET /api/kernels/<id>/requests/<uid>
89
- Server->>ExecutionStack: Get task result
92
+ Server->>ExecutionStack: get() task result
90
93
ExecutionStack-->>Server: null
91
94
Server-->>-Frontend: Request status 202
92
95
end
93
- Kernel-->>ExecutionStack: Execution reply
96
+ Kernel-->>Server: Execution reply
97
+ Server->>Shared Document: [𝒏] idle
98
+ Server-->>ExecutionStack: execution_count, status, outputs
99
+ Shared Document->>Frontend: [𝒏] idle
94
100
deactivate Kernel
95
101
Frontend->>+Server: GET /api/kernels/<id>/requests/<uid>
96
- Server->>ExecutionStack: Get task result
97
- ExecutionStack-->>Server: Result
98
- Server-->>-Frontend: Status 200 & result
102
+ Server->>ExecutionStack: get() task result
103
+ ExecutionStack-->>Server: execution_count, status, outputs
104
+ Server-->>-Frontend: Status 200 & { execution_count, status, outputs }
99
105
```
100
106
101
107
### With input case
@@ -104,42 +110,48 @@ Execution of a Python code snippet: `input("Age:")`
104
110
105
111
``` mermaid
106
112
sequenceDiagram
113
+ actor Frontend; participant Shared Document; actor Server; participant ExecutionStack; actor Kernel
114
+ Frontend->>Shared Document: [*] busy
107
115
Frontend->>+Server: POST /api/kernels/<id>/execute
108
- Server->>+ExecutionStack: Queue request
116
+ Server->>+ExecutionStack: put() request into queue
109
117
ExecutionStack->>Kernel: Execute request msg
110
118
activate Kernel
111
119
ExecutionStack-->>Server: Task uid
112
120
Server-->>-Frontend: Returns task uid
113
121
loop Running
114
- Kernel->>Shared Document: Add output
122
+ Kernel->>Server: stream / display_data / execute_result / error msg
123
+ Server->>Shared Document: Add output
115
124
Shared Document->>Frontend: Document update
116
125
end
117
126
loop While status is 202
118
127
Frontend->>+Server: GET /api/kernels/<id>/requests/<uid>
119
- Server->>ExecutionStack: Get task result
128
+ Server->>ExecutionStack: get() task result
120
129
ExecutionStack-->>Server: null
121
130
Server-->>-Frontend: Request status 202
122
131
end
123
132
Kernel->>ExecutionStack: Set pending input
124
133
Frontend->>+Server: GET /api/kernels/<id>/requests/<uid>
125
- Server->>ExecutionStack: Get task result
134
+ Server->>ExecutionStack: get() task result
126
135
ExecutionStack-->>Server: Pending input
127
136
Server-->>-Frontend: Status 300 & Pending input
128
137
Frontend->>+Server: POST /api/kernels/<id>/input
129
138
Server->>Kernel: Send input msg
130
139
Server-->>-Frontend: Returns
131
140
loop While status is 202
132
141
Frontend->>+Server: GET /api/kernels/<id>/requests/<uid>
133
- Server->>ExecutionStack: Get task result
142
+ Server->>ExecutionStack: get() task result
134
143
ExecutionStack-->>Server: null
135
144
Server-->>-Frontend: Request status 202
136
145
end
137
- Kernel-->>ExecutionStack: Execution reply
146
+ Kernel-->>Server: Execution reply
147
+ Server->>Shared Document: [𝒏] idle
148
+ Server-->>ExecutionStack: execution_count, status, outputs
149
+ Shared Document->>Frontend: [𝒏] idle
138
150
deactivate Kernel
139
151
Frontend->>+Server: GET /api/kernels/<id>/requests/<uid>
140
- Server->>ExecutionStack: Get task result
141
- ExecutionStack-->>Server: Result
142
- Server-->>-Frontend: Status 200 & result
152
+ Server->>ExecutionStack: get() task result
153
+ ExecutionStack-->>Server: execution_count, status, outputs
154
+ Server-->>-Frontend: Status 200 & { execution_count, status, outputs }
143
155
```
144
156
145
157
> \[ !NOTE\]
0 commit comments