Commit 6d0c430
feat: implement XqueueViewSet with full xqueue-watcher compatibility
- Add XqueueViewSet with complete xqueue-watcher service compatibility
- Implement get_submission service for retrieving pending submissions
- Add put_result service with row-level locking (select_for_update(nowait=True)) to prevent race conditions
- Ensure concurrent xqueue-watcher instances process each submission exactly once, even under high load
- Implement standardized response format for backward compatibility
- Add session management and authentication handling for XWatcher clients
- Add comprehensive test coverage for core interactions
feat: Improve transaction handling to prevent concurrent processing and add timeout mechanism (Get Submission)
- Implemented locking to ensure submissions are processed by a single xqueue watcher.
- Added timeout mechanism for submissions stuck in 'pulled' state.
- Updated tests to cover new error scenarios and timeout handling.
feat: Optimize submission retrieval and processing flow
- Renamed variables from 'submission_record' to 'external_grader' throughout the
codebase for better consistency with model naming
- Added new 'retry' status to integrate with submission processing retry services
- Removed unused 'is_processable' method that wasn't providing any value
- Enhanced test coverage
- Add new status external grader detail migration
feat: Add event emission for external grader scores
This commit adds the EXTERNAL_GRADER_SCORE_SUBMITTED event emission to the
put_result endpoint in the XQueueViewSet. When a grader submits a result and
the score is successfully saved, the system now emits an event with all the
necessary information for the LMS to render the graded XBlock.
Key changes:
- Add queue_key field to ExternalGraderDetail model
- Include queue_key in create_external_grader_detail method
- Emit EXTERNAL_GRADER_SCORE_SUBMITTED event after successful score update
- Implement robust false to propagate error and put submission in pending queue again
- Add migration for the new queue_key field
- Add openedx-events dependency
This enables the event-driven approach for updating XBlocks with scoring data
from the edx-submissions service, supporting the gradual migration away from
HTTP-based XQueue callbacks.1 parent 81cc930 commit 6d0c430
18 files changed
Lines changed: 458 additions & 399 deletions
File tree
- docs/source/decisions
- requirements
- submissions
- migrations
- tests
- views
Lines changed: 33 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | | - | |
27 | | - | |
| 27 | + | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
28 | 32 | | |
29 | 33 | | |
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
33 | 37 | | |
34 | | - | |
| 38 | + | |
35 | 39 | | |
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
39 | 43 | | |
40 | 44 | | |
41 | | - | |
42 | | - | |
| 45 | + | |
| 46 | + | |
43 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
44 | 52 | | |
45 | 53 | | |
46 | 54 | | |
47 | 55 | | |
48 | 56 | | |
49 | | - | |
| 57 | + | |
50 | 58 | | |
51 | 59 | | |
52 | 60 | | |
53 | 61 | | |
| 62 | + | |
54 | 63 | | |
55 | 64 | | |
56 | 65 | | |
| |||
60 | 69 | | |
61 | 70 | | |
62 | 71 | | |
63 | | - | |
| 72 | + | |
64 | 73 | | |
65 | 74 | | |
66 | 75 | | |
| |||
70 | 79 | | |
71 | 80 | | |
72 | 81 | | |
| 82 | + | |
73 | 83 | | |
74 | 84 | | |
75 | | - | |
76 | | - | |
77 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
78 | 90 | | |
| 91 | + | |
79 | 92 | | |
80 | 93 | | |
| 94 | + | |
81 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
82 | 101 | | |
83 | 102 | | |
84 | | - | |
85 | | - | |
86 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
87 | 110 | | |
88 | 111 | | |
89 | | - | |
90 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
91 | 119 | | |
92 | 120 | | |
93 | 121 | | |
94 | 122 | | |
95 | 123 | | |
96 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
97 | 129 | | |
98 | 130 | | |
99 | | - | |
100 | | - | |
101 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
102 | 138 | | |
103 | 139 | | |
104 | | - | |
105 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
106 | 147 | | |
107 | | - | |
108 | | - | |
| 148 | + | |
| 149 | + | |
109 | 150 | | |
110 | | - | |
| 151 | + | |
111 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
112 | 157 | | |
113 | 158 | | |
114 | 159 | | |
| |||
125 | 170 | | |
126 | 171 | | |
127 | 172 | | |
128 | | - | |
| 173 | + | |
129 | 174 | | |
130 | 175 | | |
131 | 176 | | |
| |||
137 | 182 | | |
138 | 183 | | |
139 | 184 | | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
144 | 189 | | |
145 | 190 | | |
146 | 191 | | |
| |||
150 | 195 | | |
151 | 196 | | |
152 | 197 | | |
153 | | - | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
154 | 201 | | |
155 | 202 | | |
156 | 203 | | |
| |||
169 | 216 | | |
170 | 217 | | |
171 | 218 | | |
172 | | - | |
173 | | - | |
| 219 | + | |
| 220 | + | |
174 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
175 | 226 | | |
176 | | - | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
177 | 232 | | |
178 | 233 | | |
179 | 234 | | |
| |||
207 | 262 | | |
208 | 263 | | |
209 | 264 | | |
210 | | - | |
| 265 | + | |
211 | 266 | | |
212 | | - | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
213 | 276 | | |
214 | 277 | | |
215 | | - | |
216 | | - | |
| 278 | + | |
| 279 | + | |
217 | 280 | | |
218 | 281 | | |
219 | 282 | | |
| |||
226 | 289 | | |
227 | 290 | | |
228 | 291 | | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
233 | 296 | | |
234 | 297 | | |
235 | 298 | | |
| |||
248 | 311 | | |
249 | 312 | | |
250 | 313 | | |
251 | | - | |
252 | | - | |
253 | | - | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
254 | 318 | | |
255 | 319 | | |
256 | 320 | | |
| |||
261 | 325 | | |
262 | 326 | | |
263 | 327 | | |
264 | | - | |
| 328 | + | |
265 | 329 | | |
266 | 330 | | |
267 | 331 | | |
| |||
320 | 384 | | |
321 | 385 | | |
322 | 386 | | |
| 387 | + | |
| 388 | + | |
323 | 389 | | |
324 | 390 | | |
325 | 391 | | |
| |||
333 | 399 | | |
334 | 400 | | |
335 | 401 | | |
| 402 | + | |
336 | 403 | | |
337 | 404 | | |
338 | 405 | | |
| |||
343 | 410 | | |
344 | 411 | | |
345 | 412 | | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
0 commit comments