Do not create container if pooling is on and all containers are gone
This commit is contained in:
@ -90,10 +90,14 @@ class DockerClient
|
||||
def execute_command(command, before_execution_block, output_consuming_block)
|
||||
tries ||= 0
|
||||
@container = DockerContainerPool.get_container(@execution_environment)
|
||||
if @container
|
||||
before_execution_block.try(:call)
|
||||
send_command(command, @container, &output_consuming_block)
|
||||
else
|
||||
raise('Alle Slots belegt. Versuche es später nochmal.')
|
||||
end
|
||||
rescue Excon::Errors::SocketError => error
|
||||
(tries += 1) <= RETRY_COUNT ? retry : raise(error)
|
||||
#(tries += 1) <= RETRY_COUNT ? retry : raise(error)
|
||||
end
|
||||
|
||||
[:run, :test].each do |cause|
|
||||
@ -187,7 +191,7 @@ class DockerClient
|
||||
|
||||
# we may need to stop the exec call here..!!!
|
||||
FileUtils.rm_rf(local_workspace_path(container)) if local_workspace_path(container)
|
||||
FileUtils.mkdir(local_workspace_path)
|
||||
FileUtils.mkdir(local_workspace_path(container))
|
||||
DockerContainerPool.return_container(container, @execution_environment)
|
||||
}
|
||||
end
|
||||
|
@ -26,7 +26,7 @@ class DockerContainerPool
|
||||
|
||||
def self.get_container(execution_environment)
|
||||
if config[:active]
|
||||
@containers[execution_environment.id].try(:shift) || create_container(execution_environment)
|
||||
@containers[execution_environment.id].try(:shift) || nil
|
||||
else
|
||||
create_container(execution_environment)
|
||||
end
|
||||
@ -49,6 +49,7 @@ class DockerContainerPool
|
||||
def self.refill_for_execution_environment(execution_environment)
|
||||
refill_count = [execution_environment.pool_size - @containers[execution_environment.id].length, config[:refill][:batch_size]].min
|
||||
@containers[execution_environment.id] += refill_count.times.map { create_container(execution_environment) }
|
||||
#refill_count.times.map { create_container(execution_environment) }
|
||||
end
|
||||
|
||||
def self.start_refill_task
|
||||
|
Reference in New Issue
Block a user