Sha256: d7751df64df5279d1bf91011744655df7fcb7bbaab6637ce6700cfce73163313
Contents?: true
Size: 1.02 KB
Versions: 4
Compression:
Stored size: 1.02 KB
Contents
require 'rflow/daemon_process' require 'rflow/shard' require 'rflow/broker' class RFlow class Master < DaemonProcess attr_reader :shards attr_reader :brokers def initialize(config) super(config['rflow.application_name'], 'Master', pid_file_path: config['rflow.pid_file_path']) @shards = config.shards.map {|config| Shard.new(config) } RFlow.logger.context_width = @shards.flat_map(&:workers).map(&:name).map(&:length).max @brokers = config.connections.flat_map(&:brokers).map {|config| Broker.build(config) } end def spawn_subprocesses RFlow.logger.debug "Running #{brokers.count} brokers" if brokers.count > 0 brokers.each(&:spawn!) RFlow.logger.debug "#{brokers.count} brokers started: #{brokers.map { |w| "#{w.name} (#{w.pid})" }.join(', ')}" if brokers.count > 0 shards.each(&:run!) end def subprocesses brokers + shards.flat_map(&:workers) end def run_process EM.run do # TODO: Monitor the workers end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rflow-1.3.0 | lib/rflow/master.rb |
rflow-1.3.0a1 | lib/rflow/master.rb |
rflow-1.2.0 | lib/rflow/master.rb |
rflow-1.1.0 | lib/rflow/master.rb |