Catch two more exceptions from production
This commit is contained in:
@ -26,7 +26,12 @@ class DockerClient
|
|||||||
|
|
||||||
local_workspace_path = local_workspace_path(container)
|
local_workspace_path = local_workspace_path(container)
|
||||||
if local_workspace_path && Pathname.new(local_workspace_path).exist?
|
if local_workspace_path && Pathname.new(local_workspace_path).exist?
|
||||||
Pathname.new(local_workspace_path).children.each{ |p| p.rmtree}
|
Pathname.new(local_workspace_path).children.each do |p|
|
||||||
|
p.rmtree
|
||||||
|
rescue Errno::ENOENT => error
|
||||||
|
Raven.capture_exception(error)
|
||||||
|
Rails.logger.error('clean_container_workspace: Got Errno::ENOENT: ' + error.to_s)
|
||||||
|
end
|
||||||
#FileUtils.rmdir(Pathname.new(local_workspace_path))
|
#FileUtils.rmdir(Pathname.new(local_workspace_path))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -197,12 +202,17 @@ class DockerClient
|
|||||||
container.stop.kill
|
container.stop.kill
|
||||||
container.port_bindings.values.each { |port| PortPool.release(port) }
|
container.port_bindings.values.each { |port| PortPool.release(port) }
|
||||||
clean_container_workspace(container)
|
clean_container_workspace(container)
|
||||||
|
|
||||||
|
# Checks only if container assignment is not nil and not whether the container itself is still present.
|
||||||
if container
|
if container
|
||||||
container.delete(force: true, v: true)
|
container.delete(force: true, v: true)
|
||||||
end
|
end
|
||||||
rescue Docker::Error::NotFoundError => error
|
rescue Docker::Error::NotFoundError => error
|
||||||
Rails.logger.error('destroy_container: Rescued from Docker::Error::NotFoundError: ' + error.to_s)
|
Rails.logger.error('destroy_container: Rescued from Docker::Error::NotFoundError: ' + error.to_s)
|
||||||
Rails.logger.error('No further actions are done concerning that.')
|
Rails.logger.error('No further actions are done concerning that.')
|
||||||
|
rescue Docker::Error::ConflictError => error
|
||||||
|
Rails.logger.error('destroy_container: Rescued from Docker::Error::ConflictError: ' + error.to_s)
|
||||||
|
Rails.logger.error('No further actions are done concerning that.')
|
||||||
end
|
end
|
||||||
|
|
||||||
#currently only used to check if containers have been started correctly, or other internal checks
|
#currently only used to check if containers have been started correctly, or other internal checks
|
||||||
@ -400,6 +410,7 @@ class DockerClient
|
|||||||
begin
|
begin
|
||||||
clean_container_workspace(container)
|
clean_container_workspace(container)
|
||||||
rescue Docker::Error::NotFoundError => error
|
rescue Docker::Error::NotFoundError => error
|
||||||
|
# FIXME: Create new container?
|
||||||
Rails.logger.info('return_container: Rescued from Docker::Error::NotFoundError: ' + error.to_s)
|
Rails.logger.info('return_container: Rescued from Docker::Error::NotFoundError: ' + error.to_s)
|
||||||
Rails.logger.info('Nothing is done here additionally. The container will be exchanged upon its next retrieval.')
|
Rails.logger.info('Nothing is done here additionally. The container will be exchanged upon its next retrieval.')
|
||||||
end
|
end
|
||||||
|
@ -52,13 +52,13 @@ class DockerContainerPool
|
|||||||
def self.create_container(execution_environment)
|
def self.create_container(execution_environment)
|
||||||
Rails.logger.info('trying to create container for execution environment: ' + execution_environment.to_s)
|
Rails.logger.info('trying to create container for execution environment: ' + execution_environment.to_s)
|
||||||
container = DockerClient.create_container(execution_environment)
|
container = DockerClient.create_container(execution_environment)
|
||||||
container.status = 'available'
|
container.status = 'available' # FIXME: String vs Symbol usage?
|
||||||
#Rails.logger.debug('created container ' + container.to_s + ' for execution environment ' + execution_environment.to_s)
|
#Rails.logger.debug('created container ' + container.to_s + ' for execution environment ' + execution_environment.to_s)
|
||||||
container
|
container
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.return_container(container, execution_environment)
|
def self.return_container(container, execution_environment)
|
||||||
container.status = 'available'
|
container.status = 'available' # FIXME: String vs Symbol usage?
|
||||||
if(@containers[execution_environment.id] && !@containers[execution_environment.id].include?(container))
|
if(@containers[execution_environment.id] && !@containers[execution_environment.id].include?(container))
|
||||||
@containers[execution_environment.id].push(container)
|
@containers[execution_environment.id].push(container)
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user