Log more autograding errors
Integrating a few of cg2v's improvements:
* Log more autograding errors
Try to always send something to the course log when autograding
submission to tango fails or is incomplete
* Fix logging (flash is a string, not array)
MODIFY
app/controllers/assessment/autograde.rb
app/controllers/assessment/autograde.rb
@@ -175,6 +175,10 @@ module AssessmentAutograde
flash[:success] = ("Submitted file #{submissions[0].filename} (#{link}) for autograding." \
" Refresh the page to see the results.").html_safe
end
+ if job < 0
+ COURSE_LOGGER.log("SendJob failed for #{submissions[0].id}: code #{job}")
+ COURSE_LOGGER.log("SendJob user error message #{flash[:error]}")
+ end
job
end
@@ -220,6 +224,7 @@ module AssessmentAutograde
File.open(f["localFile"], "rb").read)
rescue TangoClient::TangoException => e
flash[:error] = "Error while uploading autograding files: #{e.message}"
+ COURSE_LOGGER.log("Error while uploading autograding files for #{submission.id}: #{e.message}")
return -4, nil
end
end
@@ -235,16 +240,21 @@ module AssessmentAutograde
# Generate the dave number/string, this is used when autograding is done.
# The key is not guaranteed to be unique, but it's gonna be unique.
dave = (0...60).map { 65.+(rand(25)).chr }.join
-
- begin
+ failed = false
# save dave keys. These let us know which submissions to save the autoresult for
ActiveRecord::Base.transaction do
submissions.each do |submission|
submission.dave = dave
- submission.save!
+ if not submission.save
+ COURSE_LOGGER.log("Error while updating submission #{submission.id} callback key:")
+ submission.errors.full_messages.each do |msg|
+ COURSE_LOGGER.log(" (#{submission.id}): #{msg}")
end
+ failed = true
end
- rescue
+ end
+ end
+ if failed
return -13, nil
end
@@ -302,6 +312,7 @@ module AssessmentAutograde
response = TangoClient.addjob("#{course.name}-#{assessment.name}", job_properties)
rescue TangoClient::TangoException => e
flash[:error] = "Error while adding job to the queue: #{e.message}"
+ COURSE_LOGGER.log("Error while adding job to the queue: #{e.message}")
return -9, nil
end
[0, response]
@@ -326,14 +337,17 @@ module AssessmentAutograde
end
end
rescue Timeout::Error
+ COURSE_LOGGER.log("Error while polling for #{submissions[0].id} job status: Timeout")
return -11
rescue TangoClient::TangoException => e
flash[:error] = "Error while polling for job status: #{e.message}"
+ COURSE_LOGGER.log("Error while polling for #{submissions[0].id} job status: #{e.message}")
return -11
end
if feedback.nil?
return -12
+ COURSE_LOGGER.log("Error while polling for #{submissions[0].id} job status: No feedback")
else
if assessment.overwrites_method?(:autogradeDone)
assessment.config_module.autogradeDone(submissions, feedback)
@@ -366,7 +380,7 @@ module AssessmentAutograde
existing_files = TangoClient.open("#{course.name}-#{assessment.name}")
rescue TangoClient::TangoException => e
flash[:error] = "Error with open request on Tango: #{e.message}"
- COURSE_LOGGER.log("#{e.message}")
+ COURSE_LOGGER.log("Error with open request on Tango for submission #{submissions[0].id}: #{e.message}")
return -1
end
@@ -588,7 +602,7 @@ module AssessmentAutograde
rescue StandardError => error
COURSE_LOGGER.log(error)
- COURSE_LOGGER.log(error.backtrace)
+ error.backtrace.each { |line| COURSE_LOGGER.log(line) }
raise error
end
end

Log more autograding errors (#709)

Integrating a few of cg2v's improvements:

* Log more autograding errors

Try to always send something to the course log when autograding
submission to tango fails or is incomplete

* Fix logging (flash is a string, not array)