DCP: Allow increasing the pool size when previously empty
This commit is contained in:
@ -81,6 +81,8 @@ class ExecutionEnvironment < ApplicationRecord
|
|||||||
runner = Runner.for(author, self)
|
runner = Runner.for(author, self)
|
||||||
output = runner.execute_command(VALIDATION_COMMAND)
|
output = runner.execute_command(VALIDATION_COMMAND)
|
||||||
errors.add(:docker_image, "error: #{output[:stderr]}") if output[:stderr].present?
|
errors.add(:docker_image, "error: #{output[:stderr]}") if output[:stderr].present?
|
||||||
|
rescue Runner::Error::NotAvailable => e
|
||||||
|
Rails.logger.info("The Docker image could not be verified: #{e}")
|
||||||
rescue Runner::Error => e
|
rescue Runner::Error => e
|
||||||
errors.add(:docker_image, "error: #{e}")
|
errors.add(:docker_image, "error: #{e}")
|
||||||
end
|
end
|
||||||
|
@ -14,10 +14,18 @@ class Runner::Strategy::DockerContainerPool < Runner::Strategy
|
|||||||
FileUtils.mkdir_p(File.expand_path(config[:workspace_root]))
|
FileUtils.mkdir_p(File.expand_path(config[:workspace_root]))
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.sync_environment(_environment)
|
def self.sync_environment(environment)
|
||||||
# There is no dedicated sync mechanism yet
|
# There is no dedicated sync mechanism yet. However, we need to emit a warning when the pool was previously
|
||||||
|
# empty for this execution environment. In this case the validation command probably was not executed.
|
||||||
|
return true unless environment.pool_size_previously_changed?
|
||||||
|
|
||||||
|
case environment.pool_size_previously_was
|
||||||
|
when nil, 0
|
||||||
|
false
|
||||||
|
else
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def self.request_from_management(environment)
|
def self.request_from_management(environment)
|
||||||
url = "#{config[:url]}/docker_container_pool/get_container/#{environment.id}"
|
url = "#{config[:url]}/docker_container_pool/get_container/#{environment.id}"
|
||||||
|
Reference in New Issue
Block a user