How to locally debug Gradescope Autograder



🤔



If you are trying to create a Gradescope Autograder then you have probably faced an issue how to properly test your docker image. Here is a solution which would create almost exact copy of the gradescope environment on your machine.

Docker file for testing

All you need is to create a second docker file which would emulate the gradescope image. Here it is:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
FROM YOUR_BASE_IMAGE_NAME

WORKDIR /autograder
COPY submission_metadata.json .

ADD test_submission.zip /autograder/submission/test_submission.zip
RUN mkdir /autograder/results
RUN unzip -d /autograder/submission ./submission/test_submission.zip

ENTRYPOINT ["/autograder/run_autograder"]

This docker file is creating an image which is based on your grading image (YOUR_BASE_IMAGE_NAME), includes dump submission metadata file (submission_metadata.json), unzip test submission from test_submission.zip and then run the entrypoint.

Here is a submission_metadata.json that I am using for testing. You may want to make it more realistic for your example, but it is good enough for me:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
{
	"created_at": "2018-07-01T14:22:32.365935-07:00",
	"assignment": {
		"due_date": "2018-07-31T23:00:00.000000-07:00",
		"late_due_date": null
	},
	"users": [
		{
			"email": "kek@gmail.com"
		}
	]
}



🧪



Testing

To run the testing suite do the following:

  1. Zip your test submission into test_submission.zip
  2. Run docker build -t YOUR_BASE_IMAGE_NAME . to create your autograder image as you usually do
  3. Run docker build -t my-test-suite -f DockerfileTest . to create a testing image
  4. Run docker run my-test-suite to run the testing suite. If you want to run your grader manully use docker run -it --entrypoint bash my-test-suite