3 ms·
(Late to the party, but PyCoder's Weekly brought me here) The method I use for my autograder research platform is: 1) Build a test suite as a JSON string that
by tsumnia 5y ago
(Late to the party, but PyCoder's Weekly brought me here)
The method I use for my autograder research platform is:
1) Build a test suite as a JSON string that gets passed to queue; on the student's side, they're given a Job ID that will check every few seconds on the job's status
2) When its their turn, I pass the submission to a Docker image
3) The docker image dumps the student's code into a "submission.py" file and then dynamically builds the test cases based on what came in the JSON file (using Python's unittest library)
3) Save the code's test results to my DB and mark the job ID as "done"
4) Once the student's AJAX request sees a "done", it also returns the test results as a JSON string, which is then parsed on to the screen
In terms of "safety", the big issues you'll need to test for are making sure that Docker does not have root access. Try to dig up some Docker vulnerabilities to poke holes in your system. You can also whitelist only a select number of libraries so users don't go importing things with vulnerabilities.