Add strategy for DockerContainerPool

In order to provide an alternative to Poseidon, a strategy for the
DockerContainerPool is added that is used by the runner model.

Co-authored-by: Sebastian Serth <Sebastian.Serth@hpi.de>
This commit is contained in:
Felix Auringer
2021-06-10 16:17:02 +02:00
committed by Sebastian Serth
parent 1d3f0d7ad8
commit 704407b9fc
12 changed files with 282 additions and 69 deletions

View File

@@ -137,7 +137,7 @@ class SubmissionsController < ApplicationController
@output = +''
socket.on :output do |data|
Rails.logger.info("#{Time.zone.now.getutc}: Container sending: #{data}")
Rails.logger.info("#{Time.zone.now.getutc}: Container sending: #{data.inspect}")
@output << data if @output.size + data.size <= max_output_buffer_size
end
@@ -150,10 +150,6 @@ class SubmissionsController < ApplicationController
end
socket.on :exit do |exit_code|
# As this is sometimes called before the timeout is handled, we must not close the
# socket to the user here. The socket will be closed after handling the timeout.
next if exit_code == Runner::Connection::TIMEOUT_EXIT_STATUS
EventMachine.stop_event_loop
if @output.empty?
tubesock.send_data JSON.dump({cmd: :write, stream: :stdout, data: "#{t('exercises.implement.no_output', timestamp: l(Time.zone.now, format: :short))}\n"})