diff --git a/app/assets/javascripts/editor.js b/app/assets/javascripts/editor.js index 09c23bba..7aa32fc0 100644 --- a/app/assets/javascripts/editor.js +++ b/app/assets/javascripts/editor.js @@ -651,6 +651,11 @@ $(function() { })) { showTimeoutMessage(); } + if (_.some(response, function(result) { + return result.status === 'container_depleted'; + })) { + showContainerDepletedMessage(); + } if (qa_api) { // send test response to QA qa_api.executeCommand('syncOutput', [response]); @@ -828,6 +833,13 @@ $(function() { } }; + var showContainerDepletedMessage = function() { + $.flash.danger({ + icon: ['fa', 'fa-clock-o'], + text: $('#editor').data('message-depleted') + }); + }; + var showTab = function(index) { $('a[data-toggle="tab"]').eq(index || 0).tab('show'); }; diff --git a/app/views/exercises/_editor.html.slim b/app/views/exercises/_editor.html.slim index b8450c29..09d07190 100644 --- a/app/views/exercises/_editor.html.slim +++ b/app/views/exercises/_editor.html.slim @@ -1,4 +1,4 @@ -#editor.row data-exercise-id=exercise.id data-message-timeout=t('exercises.editor.timeout', permitted_execution_time: @exercise.execution_environment.permitted_execution_time) data-errors-url=execution_environment_errors_path(exercise.execution_environment) data-submissions-url=submissions_path data-user-id=@current_user.id +#editor.row data-exercise-id=exercise.id data-message-depleted=t('exercises.editor.depleted') data-message-timeout=t('exercises.editor.timeout', permitted_execution_time: @exercise.execution_environment.permitted_execution_time) data-errors-url=execution_environment_errors_path(exercise.execution_environment) data-submissions-url=submissions_path data-user-id=@current_user.id .col-sm-3 = render('editor_file_tree', files: @files) #frames.col-sm-9 - @files.each do |file| diff --git a/config/locales/de.yml b/config/locales/de.yml index fa725fde..a58493c3 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -166,6 +166,7 @@ de: confirm_start_over: Wollen Sie wirklich von vorne anfangen? confirm_submit: Wollen Sie Ihren Code wirklich zur Bewertung abgeben? create_file: Neue Datei + depleted: Alle Ausführungsausgebungen sind momentan in Benutzung. Probiere es später nochmal. destroy_file: Datei löschen download: Herunterladen dummy: Keine Aktion diff --git a/config/locales/en.yml b/config/locales/en.yml index 64cd0eda..d27552bf 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -166,6 +166,7 @@ en: confirm_start_over: Do you really want to start over? confirm_submit: Do you really want to submit your code for grading? create_file: New File + depleted: All execution environments are busy. Please try again later. destroy_file: Delete File download: Download dummy: No Action diff --git a/lib/docker_client.rb b/lib/docker_client.rb index 692198a7..284a66fe 100644 --- a/lib/docker_client.rb +++ b/lib/docker_client.rb @@ -96,7 +96,7 @@ class DockerClient before_execution_block.try(:call) send_command(command, @container, &output_consuming_block) else - raise('Alle Slots belegt. Versuche es nachher nochmal.') + {status: :container_depleted} end rescue Excon::Errors::SocketError => error # socket errors seems to be normal when using exec