diff --git a/app/controllers/concerns/submission_scoring.rb b/app/controllers/concerns/submission_scoring.rb index 2e932631..8dfa90b8 100644 --- a/app/controllers/concerns/submission_scoring.rb +++ b/app/controllers/concerns/submission_scoring.rb @@ -56,6 +56,10 @@ module SubmissionScoring unless output.nil? score += output[:score] * output[:weight] 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 submission.update(score: score) diff --git a/config/locales/de.yml b/config/locales/de.yml index d628c81d..88b338fe 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -431,6 +431,7 @@ de: finishing_rate: Abschlussrate submit: 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_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: diff --git a/config/locales/en.yml b/config/locales/en.yml index 30442d38..db8bfa6e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -431,6 +431,7 @@ en: finishing_rate: Finishing Rate submit: 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_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: diff --git a/lib/docker_client.rb b/lib/docker_client.rb index cc65a3ed..a5d3f5df 100644 --- a/lib/docker_client.rb +++ b/lib/docker_client.rb @@ -450,9 +450,9 @@ class DockerClient def send_command(command, container) result = {status: :failed, stdout: '', stderr: ''} 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 - output = container.exec(['bash', '-c', command]) + output = container.exec(['bash', '-c', "#{command} > /proc/1/fd/1 2> /proc/1/fd/2"], tty: false) end Rails.logger.debug 'output from container.exec' Rails.logger.debug output @@ -467,8 +467,10 @@ class DockerClient result rescue Timeout::Error 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) - {status: :timeout} + {status: :timeout, stdout: stdout, stderr: stderr} end private :send_command