Add information if execution timed out during scoring

This commit is contained in:
Sebastian Serth
2020-05-12 13:44:28 +02:00
parent 1ec345d47d
commit b6db9e186c
4 changed files with 11 additions and 3 deletions

View File

@ -56,6 +56,10 @@ module SubmissionScoring
unless output.nil? unless output.nil?
score += output[:score] * output[:weight] score += output[:score] * output[:weight]
end end
if output[:status] == :timeout
output[:stderr] += "\n\n#{t('exercises.editor.timeout', permitted_execution_time: submission.exercise.execution_environment.permitted_execution_time.to_s)}"
end
end end
end end
submission.update(score: score) submission.update(score: score)

View File

@ -431,6 +431,7 @@ de:
finishing_rate: Abschlussrate finishing_rate: Abschlussrate
submit: submit:
failure: Beim Übermitteln Ihrer Punktzahl ist ein Fehler aufgetreten. Bitte versuchen Sie es später erneut. failure: Beim Übermitteln Ihrer Punktzahl ist ein Fehler aufgetreten. Bitte versuchen Sie es später erneut.
too_late: Ihre Abgabe wurde erfolgreich gespeichert, ging jedoch nach der Abgabefrist ein.
full_score_redirect_to_rfc: Herzlichen Glückwunsch! Sie haben die maximale Punktzahl für diese Aufgabe an den Kurs übertragen. Ein anderer Teilnehmer hat eine Frage zu der von Ihnen gelösten Aufgabe. Er würde sich sicherlich sehr über ihre Hilfe und Kommentare freuen. full_score_redirect_to_rfc: Herzlichen Glückwunsch! Sie haben die maximale Punktzahl für diese Aufgabe an den Kurs übertragen. Ein anderer Teilnehmer hat eine Frage zu der von Ihnen gelösten Aufgabe. Er würde sich sicherlich sehr über ihre Hilfe und Kommentare freuen.
full_score_redirect_to_own_rfc: Herzlichen Glückwunsch! Sie haben die maximale Punktzahl für diese Aufgabe an den Kurs übertragen. Ihre Frage ist damit wahrscheinlich gelöst? Falls ja, fügen Sie doch den entscheidenden Kniff als Antwort hinzu und markieren die Frage als gelöst, bevor sie das Fenster schließen. full_score_redirect_to_own_rfc: Herzlichen Glückwunsch! Sie haben die maximale Punktzahl für diese Aufgabe an den Kurs übertragen. Ihre Frage ist damit wahrscheinlich gelöst? Falls ja, fügen Sie doch den entscheidenden Kniff als Antwort hinzu und markieren die Frage als gelöst, bevor sie das Fenster schließen.
study_group_dashboard: study_group_dashboard:

View File

@ -431,6 +431,7 @@ en:
finishing_rate: Finishing Rate finishing_rate: Finishing Rate
submit: submit:
failure: An error occurred while transmitting your score. Please try again later. failure: An error occurred while transmitting your score. Please try again later.
too_late: Your submission was saved successfully but was received after the deadline passed.
full_score_redirect_to_rfc: Congratulations! You achieved and submitted the highest possible score for this exercise. Another participant has a question concerning the exercise you just solved. Your help and comments will be greatly appreciated! full_score_redirect_to_rfc: Congratulations! You achieved and submitted the highest possible score for this exercise. Another participant has a question concerning the exercise you just solved. Your help and comments will be greatly appreciated!
full_score_redirect_to_own_rfc: Congratulations! You achieved and submitted the highest possible score for this exercise. Your question concerning the exercise is solved? If so, please share the essential insight with your fellows and mark the question as solved, before you close this window! full_score_redirect_to_own_rfc: Congratulations! You achieved and submitted the highest possible score for this exercise. Your question concerning the exercise is solved? If so, please share the essential insight with your fellows and mark the question as solved, before you close this window!
study_group_dashboard: study_group_dashboard:

View File

@ -450,9 +450,9 @@ class DockerClient
def send_command(command, container) def send_command(command, container)
result = {status: :failed, stdout: '', stderr: ''} result = {status: :failed, stdout: '', stderr: ''}
output = nil output = nil
Timeout.timeout(@execution_environment.permitted_execution_time.to_i) do Timeout.timeout(@execution_environment.permitted_execution_time.to_i - 29) do
# TODO: check phusion doku again if we need -i -t options here # TODO: check phusion doku again if we need -i -t options here
output = container.exec(['bash', '-c', command]) output = container.exec(['bash', '-c', "#{command} > /proc/1/fd/1 2> /proc/1/fd/2"], tty: false)
end end
Rails.logger.debug 'output from container.exec' Rails.logger.debug 'output from container.exec'
Rails.logger.debug output Rails.logger.debug output
@ -467,8 +467,10 @@ class DockerClient
result result
rescue Timeout::Error rescue Timeout::Error
Rails.logger.info('got timeout error for container ' + container.to_s) Rails.logger.info('got timeout error for container ' + container.to_s)
stdout = container.logs(stdout: true).force_encoding('utf-8').gsub(/.*\/workspace\$\ /, '')
stderr = container.logs(stderr: true).force_encoding('utf-8').gsub(/.*\/workspace\$\ /, '')
kill_container(container) kill_container(container)
{status: :timeout} {status: :timeout, stdout: stdout, stderr: stderr}
end end
private :send_command private :send_command