Add null strategy for runners
* This is the default strategy used when the runner management is disabled. It might be replaced with a generic Docker strategy in the future (without pooling). For now, it allows normal "operation" of CodeOcean without any runner management. However, as no runner system is configured, no command can be executed.
This commit is contained in:
@ -11,10 +11,12 @@ class Runner < ApplicationRecord
|
||||
attr_accessor :strategy
|
||||
|
||||
def self.strategy_class
|
||||
@strategy_class ||= begin
|
||||
strategy_name = CodeOcean::Config.new(:code_ocean).read[:runner_management][:strategy]
|
||||
"runner/strategy/#{strategy_name}".camelize.constantize
|
||||
end
|
||||
@strategy_class ||= if Runner.management_active?
|
||||
strategy_name = CodeOcean::Config.new(:code_ocean).read[:runner_management][:strategy]
|
||||
"runner/strategy/#{strategy_name}".camelize.constantize
|
||||
else
|
||||
Runner::Strategy::Null
|
||||
end
|
||||
end
|
||||
|
||||
def self.management_active?
|
||||
|
Reference in New Issue
Block a user