Skip to content

Commit

Permalink
[Bugfix:Autograding] regrading vcs/git submissions (Submitty#6185)
Browse files Browse the repository at this point in the history
* fix vcs regrading

* bugfix

* stray_comment
  • Loading branch information
bmcutler authored Feb 8, 2021
1 parent 8fb8042 commit 8b00136
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 16 deletions.
4 changes: 2 additions & 2 deletions autograder/autograder/autograding_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ def setup_for_validation(config, working_directory, complete_config, is_vcs, tes

# Copy required submission/checkout files
pattern_copy("submission_to_validation", patterns['submission_to_validation'], submission_path, tmp_work, tmp_logs)
if is_vcs:
checkout_subdir_path = os.path.join(tmp_submission, 'checkout', checkout_subdirectory)
checkout_subdir_path = os.path.join(tmp_submission, 'checkout', checkout_subdirectory)
if os.path.exists(checkout_subdir_path):
pattern_copy("checkout_to_validation", patterns['submission_to_validation'],checkout_subdir_path,tmp_work,tmp_logs)

for c in testcases:
Expand Down
45 changes: 31 additions & 14 deletions bin/regrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ def main():
raise SystemExit("ERROR: path reconstruction failed")
# add them to the queue

# FIXME: This will be incorrect if the username includes an underscore
if '_' not in my_who:
my_user = my_who
my_team = ""
Expand All @@ -217,22 +218,38 @@ def main():
my_team = my_who
my_is_team = True

# FIXME: Set this value appropriately
# Note: If the initial checkout failed, or if
# autograding failed to create a results subdirectory
# or create a history file, regrading will also fail.
history_file=os.path.join(data_dir, my_semester, my_course,
"results", my_gradeable, my_who,
my_version, "history.json")
is_vcs_checkout = False
if os.path.exists(history_file):
with open(history_file) as hf:
obj = json.load(hf)
if len(obj) > 0 and 'revision' in obj[0]:
is_vcs_checkout = True
revision = obj[0]['revision']

grade_queue.append({"semester": my_semester,
"course": my_course,
"gradeable": my_gradeable,
"user": my_user,
"team": my_team,
"who": my_who,
"is_team": my_is_team,
"version": my_version,
"vcs_checkout": is_vcs_checkout,
"required_capabilities" : required_capabilities,
"queue_time":queue_time,
"regrade":True,
"max_possible_grading_time" : max_grading_time})
obj = {"semester": my_semester,
"course": my_course,
"gradeable": my_gradeable,
"user": my_user,
"team": my_team,
"who": my_who,
"is_team": my_is_team,
"version": my_version,
"vcs_checkout": is_vcs_checkout,
"required_capabilities" : required_capabilities,
"queue_time":queue_time,
"regrade":True,
"max_possible_grading_time" : max_grading_time}

if is_vcs_checkout:
obj['revision'] = revision

grade_queue.append(obj)

# Check before adding a very large number of systems to the queue
if len(grade_queue) > 50 and not args.no_input:
Expand Down

0 comments on commit 8b00136

Please sign in to comment.