adjusted log levels for docker exit and kill messages

This commit is contained in:
Ralf Teusner
2017-01-11 16:04:55 +01:00
parent ab5438d5ed
commit 254e8c65d1
2 changed files with 5 additions and 3 deletions

View File

@ -108,7 +108,7 @@ class DockerClient
container.status = :created container.status = :created
container container
rescue Docker::Error::NotFoundError => error rescue Docker::Error::NotFoundError => error
Rails.logger.info('create_container: Got Docker::Error::NotFoundError: ' + error.to_s) Rails.logger.error('create_container: Got Docker::Error::NotFoundError: ' + error.to_s)
destroy_container(container) destroy_container(container)
#(tries += 1) <= RETRY_COUNT ? retry : raise(error) #(tries += 1) <= RETRY_COUNT ? retry : raise(error)
end end
@ -390,8 +390,8 @@ class DockerClient
Timeout.timeout(@execution_environment.permitted_execution_time.to_i) do Timeout.timeout(@execution_environment.permitted_execution_time.to_i) 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])
Rails.logger.info "output from container.exec" Rails.logger.debug "output from container.exec"
Rails.logger.info output Rails.logger.debug output
result = {status: output[2] == 0 ? :ok : :failed, stdout: output[0].join.force_encoding('utf-8'), stderr: output[1].join.force_encoding('utf-8')} result = {status: output[2] == 0 ? :ok : :failed, stdout: output[0].join.force_encoding('utf-8'), stderr: output[1].join.force_encoding('utf-8')}
end end
# if we use pooling and recylce the containers, put it back. otherwise, destroy it. # if we use pooling and recylce the containers, put it back. otherwise, destroy it.

View File

@ -7,7 +7,9 @@ class DockerContainerPool
@containers = ThreadSafe::Hash[ExecutionEnvironment.all.map { |execution_environment| [execution_environment.id, ThreadSafe::Array.new] }] @containers = ThreadSafe::Hash[ExecutionEnvironment.all.map { |execution_environment| [execution_environment.id, ThreadSafe::Array.new] }]
#as containers are not containing containers in use #as containers are not containing containers in use
@all_containers = ThreadSafe::Hash[ExecutionEnvironment.all.map { |execution_environment| [execution_environment.id, ThreadSafe::Array.new] }] @all_containers = ThreadSafe::Hash[ExecutionEnvironment.all.map { |execution_environment| [execution_environment.id, ThreadSafe::Array.new] }]
def self.clean_up def self.clean_up
Rails.logger.info('Container Pool is now performing a cleanup. ')
@refill_task.try(:shutdown) @refill_task.try(:shutdown)
@all_containers.values.each do |containers| @all_containers.values.each do |containers|
DockerClient.destroy_container(containers.shift) until containers.empty? DockerClient.destroy_container(containers.shift) until containers.empty?