diff --git a/lib/docker_client.rb b/lib/docker_client.rb index 62e84032..77c7544a 100644 --- a/lib/docker_client.rb +++ b/lib/docker_client.rb @@ -90,10 +90,14 @@ class DockerClient def execute_command(command, before_execution_block, output_consuming_block) tries ||= 0 @container = DockerContainerPool.get_container(@execution_environment) - before_execution_block.try(:call) - send_command(command, @container, &output_consuming_block) + 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 diff --git a/lib/docker_container_pool.rb b/lib/docker_container_pool.rb index 7d58f138..0dc536f5 100644 --- a/lib/docker_container_pool.rb +++ b/lib/docker_container_pool.rb @@ -17,7 +17,7 @@ class DockerContainerPool end def self.create_container(execution_environment) - DockerClient.create_container(execution_environment) + DockerClient.create_container(execution_environment) end def self.return_container(container, execution_environment) @@ -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