Problem with the grading queue in the online judge

I am working on creating an online judge using django and I have the following problem:

  • Let’s say I have a website that can score 6 (this number can be changed by admin) submissions at the same time.
  • A user logged into the website can submit a submission for grading and if there are currently 6 submissions being graded it will enter something called a " queue " and wait for one of the submissions to finish scoring it will start dot. Same problem with multiple users submitting submissions to my website.

How can I do that? (Here I treat grading as a " task ", no matter what the task does.)

There are a couple different ways to handle this. It’s not that there’s one “right” way to do it.

If I were working on something like this, my choices would be affected by some external factors like knowing how many submissions total may need to be processed, how frequently they come in, how long it takes to perform a task on an entry in the queue, whether or not the tasks are performed on the submissions in the strict order in which they’re submitted, and how many different people will be performing tasks on that queue.

But, the simplest way to handle it is that is to just sort the list of submissions by date and “status” (assuming “status” lets you identify which submissions still need to be processed) and only display the first n number as being available to be selected. Unless you’re talking about some truly large numbers here, I wouldn’t over-think it too much.

1 Like