Add further Mnemosyne tracing to find performance issues
This commit is contained in:
@ -2,26 +2,30 @@ require 'concurrent/future'
|
|||||||
|
|
||||||
module SubmissionScoring
|
module SubmissionScoring
|
||||||
def collect_test_results(submission)
|
def collect_test_results(submission)
|
||||||
submission.collect_files.select(&:teacher_defined_test?).map do |file|
|
Mnemosyne.trace 'custom.codeocean.collect_test_results', meta: { submission: submission.id } do
|
||||||
future = Concurrent::Future.execute do
|
submission.collect_files.select(&:teacher_defined_test?).map do |file|
|
||||||
assessor = Assessor.new(execution_environment: submission.execution_environment)
|
future = Concurrent::Future.execute do
|
||||||
output = execute_test_file(file, submission)
|
Mnemosyne.trace 'custom.codeocean.collect_test_results_block', meta: { file: file.id, submission: submission.id } do
|
||||||
assessment = assessor.assess(output)
|
assessor = Assessor.new(execution_environment: submission.execution_environment)
|
||||||
passed = ((assessment[:passed] == assessment[:count]) and (assessment[:score] > 0))
|
output = execute_test_file(file, submission)
|
||||||
testrun_output = passed ? nil : 'message: ' + output[:message].to_s + "\n stdout: " + output[:stdout].to_s + "\n stderr: " + output[:stderr].to_s
|
assessment = assessor.assess(output)
|
||||||
unless testrun_output.blank?
|
passed = ((assessment[:passed] == assessment[:count]) and (assessment[:score] > 0))
|
||||||
submission.exercise.execution_environment.error_templates.each do |template|
|
testrun_output = passed ? nil : 'message: ' + output[:message].to_s + "\n stdout: " + output[:stdout].to_s + "\n stderr: " + output[:stderr].to_s
|
||||||
pattern = Regexp.new(template.signature).freeze
|
unless testrun_output.blank?
|
||||||
if pattern.match(testrun_output)
|
submission.exercise.execution_environment.error_templates.each do |template|
|
||||||
StructuredError.create_from_template(template, testrun_output, submission)
|
pattern = Regexp.new(template.signature).freeze
|
||||||
|
if pattern.match(testrun_output)
|
||||||
|
StructuredError.create_from_template(template, testrun_output, submission)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Testrun.new(submission: submission, cause: 'assess', file: file, passed: passed, output: testrun_output).save
|
||||||
|
output.merge!(assessment)
|
||||||
|
output.merge!(filename: file.name_with_extension, message: feedback_message(file, output[:score]), weight: file.weight)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Testrun.new(submission: submission, cause: 'assess', file: file, passed: passed, output: testrun_output).save
|
future.value
|
||||||
output.merge!(assessment)
|
|
||||||
output.merge!(filename: file.name_with_extension, message: feedback_message(file, output[:score]), weight: file.weight)
|
|
||||||
end
|
end
|
||||||
future.value
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
private :collect_test_results
|
private :collect_test_results
|
||||||
|
Reference in New Issue
Block a user