class Dynflow::Config
Public Class Methods
config_attr(name, *types, &default)
click to toggle source
# File lib/dynflow/config.rb, line 9 def self.config_attr(name, *types, &default) self.send(:define_method, "validate_#{name}!") do |value| Type! value, *types unless types.empty? end self.send(:define_method, name) do var_name = "@#{name}" if instance_variable_defined?(var_name) return instance_variable_get(var_name) else return default end end self.send(:attr_writer, name) end
Public Instance Methods
queues()
click to toggle source
# File lib/dynflow/config.rb, line 78 def queues @queues ||= QueuesConfig.new end
validate(config_for_world)
click to toggle source
# File lib/dynflow/config.rb, line 199 def validate(config_for_world) if defined? ::ActiveRecord::Base begin ar_pool_size = ::ActiveRecord::Base.connection_pool.instance_variable_get(:@size) if (config_for_world.pool_size / 2.0) > ar_pool_size config_for_world.world.logger.warn 'Consider increasing ActiveRecord::Base.connection_pool size, ' + "it's #{ar_pool_size} but there is #{config_for_world.pool_size} " + 'threads in Dynflow pool.' end rescue ActiveRecord::ConnectionNotEstablished # If in tests or in an environment where ActiveRecord doesn't have a # real DB connection, we want to skip AR configuration altogether end end end
validate_executor!(value)
click to toggle source
# File lib/dynflow/config.rb, line 106 def validate_executor!(value) accepted_executors = [Executors::Parallel::Core] accepted_executors << Executors::Sidekiq::Core if defined? Executors::Sidekiq::Core if value && !accepted_executors.include?(value) raise ArgumentError, "Executor #{value} is expected to be one of #{accepted_executors.inspect}" end end