Generalize method and constant names for runner management

This commit is contained in:
Sebastian Serth
2021-09-13 12:49:56 +02:00
parent e752df1b3c
commit 30603cb7ab
18 changed files with 139 additions and 110 deletions

View File

@ -8,6 +8,11 @@ class Runner::Strategy::DockerContainerPool < Runner::Strategy
@config ||= CodeOcean::Config.new(:docker).read(erb: true)
end
def self.sync_environment(_environment)
# There is no dedicated sync mechanism yet
true
end
def self.request_from_management(environment)
container_id = JSON.parse(Faraday.get("#{config[:pool][:location]}/docker_container_pool/get_container/#{environment.id}").body)['id']
container_id.presence || raise(Runner::Error::NotAvailable.new("DockerContainerPool didn't return a container id"))