Commit 80371c7
authored
Chore: refactor autograding classes (#305)
* refactor: Start refactoring the LocalAutogradeExecutor class
Split methods into smaller ones, improve logging and error handling
* refactor: [WIP] Prepare GenerateFeedbackExecutor for refactoring
Reflect some of the changes from the base class, LocalAutogradeExecutor,
and improve error handling etc.
* fix: Fix a circular import
* chore: Make all helper methods in kube grader 'private' (for consistency)
* cleanup: Remove redundant recreation of output dirs in graders
* refactor: [WIP] Extract git-related logic from LocalAutogradeExecutor and derrived classes
Also:
- move getting all whitelist patterns to a method in Assignment (seems to fit there better),
- remove some duplicated code from the child classes of the AutogradeExecutor,
sometimes making their behaviour more consistent with the parent,
- add missing type annotations and improve a few clearly outdated docstrings, etc.
* tests: Add tests for the LocalAutogradeExecutor
* refactor: Remove explicit gradebook file deletion (is done in _cleanup)
* fix: Fix writing gradebook in GenerateFeedbackProcessExecutor
* fix: Remove unused attributes from GenerateFeedbackExecutor
* test: Write tests for local feedback generation executors
* fix: Use the full commit hash when creating a submission in tests setup
* fix: Fix reading stderr in the process executors
process.stderr is a str already, no need to read().decode() it - it fails
* fix: Remove unexpected (and unused) param from GenerateFeedbackApp.start()
* cleanup: Clean up fixtures for autograding tests
* fix: Re-add missing updating of submission logs; log process errors more consistently
* tests: Add tests for LocalProcessAutogradeExecutor, improve tests for local feedback
* refactor: Simplify autograding/feedback log collection
* refactor: Improve running subprocesses, adjust and add tests
* refactor: Pass git commands to subprocess.run as lists, not strings
We execute the git commands with variables potentially provided by users
(filenames, usernames, etc.). Passing them as strings and then splitting,
potentially could enable constructing these variables in such a way
so as to execute malicious commands.
An alternative would be to use `shlex.quote` with any variables,
but it seems more cumbersome.
* refactor: Small tweaks in the local grader and local feedback, update docstrings
* tests: Add tests for the collect_logs context manager
* fix: Feedback repo path, do not save feedback logs in submission.logs
Until now feedback logs have also not been appended to submission.logs.
* chore: Small improvements in tests
* fix: Only commit html files when generating feedback
Previously, all student-supplied files were included in the feedback,
even though feedback is actually only generated for the jupyter notebooks
that are included in the gradebook.
Now only the generated html files will be included in the feedback files.
* fix: Protect against fabricated usernames in git repo paths in autograders
* refactor: Move git manager to a separate module
* chore: Small cleanup in autograde executors
* chore: Make autograding/feedback executor class names more consistent
* fix: Do not write `self.grading_logs` in local feedback executors
We don't use these logs anywhere, so it's not necessary to collect them.
All the logs are still logged with the regular `self.log` logger.1 parent d845077 commit 80371c7
File tree
16 files changed
+1005
-435
lines changed- docs/source/admin
- grader_service
- autograding
- celery
- kube
- convert/converters
- handlers
- orm
- tests
- autograding
- handlers
16 files changed
+1005
-435
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
| 117 | + | |
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| |||
| 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 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
| |||
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
23 | | - | |
24 | 22 | | |
25 | 23 | | |
26 | 24 | | |
| |||
282 | 280 | | |
283 | 281 | | |
284 | 282 | | |
285 | | - | |
| 283 | + | |
286 | 284 | | |
287 | 285 | | |
288 | 286 | | |
| |||
312 | 310 | | |
313 | 311 | | |
314 | 312 | | |
315 | | - | |
| 313 | + | |
316 | 314 | | |
317 | 315 | | |
318 | 316 | | |
| |||
325 | 323 | | |
326 | 324 | | |
327 | 325 | | |
328 | | - | |
| 326 | + | |
329 | 327 | | |
330 | 328 | | |
331 | 329 | | |
| |||
334 | 332 | | |
335 | 333 | | |
336 | 334 | | |
337 | | - | |
| 335 | + | |
338 | 336 | | |
339 | 337 | | |
340 | 338 | | |
| |||
369 | 367 | | |
370 | 368 | | |
371 | 369 | | |
372 | | - | |
| 370 | + | |
373 | 371 | | |
374 | 372 | | |
375 | 373 | | |
376 | | - | |
| 374 | + | |
377 | 375 | | |
378 | 376 | | |
379 | | - | |
| 377 | + | |
380 | 378 | | |
381 | 379 | | |
382 | 380 | | |
| |||
406 | 404 | | |
407 | 405 | | |
408 | 406 | | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | 407 | | |
414 | 408 | | |
415 | | - | |
| 409 | + | |
416 | 410 | | |
417 | 411 | | |
418 | 412 | | |
| |||
429 | 423 | | |
430 | 424 | | |
431 | 425 | | |
432 | | - | |
433 | | - | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
434 | 429 | | |
435 | 430 | | |
436 | 431 | | |
| |||
0 commit comments