Remove usage of DockerClient from execution_environments_controller.rb

This commit is contained in:
Sebastian Serth
2021-10-24 11:21:24 +02:00
parent 541afa92f3
commit 2b98905acb
5 changed files with 25 additions and 5 deletions

View File

@ -9,6 +9,10 @@ class Runner::Strategy
raise NotImplementedError
end
def self.available_images
raise NotImplementedError
end
def self.sync_environment(_environment)
raise NotImplementedError
end

View File

@ -8,6 +8,13 @@ class Runner::Strategy::DockerContainerPool < Runner::Strategy
@config ||= CodeOcean::Config.new(:docker).read(erb: true)
end
def self.available_images
DockerClient.check_availability!
DockerClient.image_tags
rescue DockerClient::Error => e
raise Runner::Error::InternalServerError.new(e.message)
end
def self.sync_environment(_environment)
# There is no dedicated sync mechanism yet
true

View File

@ -13,6 +13,13 @@ class Runner::Strategy::Poseidon < Runner::Strategy
@config ||= CodeOcean::Config.new(:code_ocean).read[:runner_management] || {}
end
def self.available_images
# Images are pulled when needed for a new execution environment
# and cleaned up automatically if no longer in use.
# Hence, there is no additional image that we need to return
[]
end
def self.headers
@headers ||= {'Content-Type' => 'application/json', 'Poseidon-Token' => config[:token]}
end