<commit_before>module Wukong
  module Load

    # Runs the wu-load command.
    class Runner

      include Logging

      # Initialize and begin running a new instance of `wu-load`.
      #
      # @param [COnfigliere:Param] settings
      def self.run settings
        begin
          new(settings).run
        rescue Error => e
          log.error(e.message)
          exit(127)
        end
      end

      # This runner's settings
      attr_accessor :settings

      # Create new instance of `wu-load` with the given settings.
      def initialize settings
        self.settings = settings
      end

      # The command-line args.
      #
      # @return [Array<String>]
      def args
        settings.rest
      end

      # The name of the data store
      #
      # @return [String]
      def data_store_name
        args.first
      end

      # The name of the processor that should handle the data store
      #
      # @return [String]
      def processor_name
        case data_store_name
        when 'elasticsearch' then :elasticsearch_loader
        when nil
          settings.dump_help
          exit(1)
        else
          raise Error.new("No loader defined for data store: #{data_store_name}")
        end
      end

      # Run this loader.
      def run
        EM.run do
          StupidServer.new(processor_name, settings).run!
        end
      end
      
    end
  end
end<commit_msg>don't need EM for StupidServer<commit_after>module Wukong
  module Load

    # Runs the wu-load command.
    class Runner

      include Logging

      # Initialize and begin running a new instance of `wu-load`.
      #
      # @param [COnfigliere:Param] settings
      def self.run settings
        begin
          new(settings).run
        rescue Error => e
          log.error(e.message)
          exit(127)
        end
      end

      # This runner's settings
      attr_accessor :settings

      # Create new instance of `wu-load` with the given settings.
      def initialize settings
        self.settings = settings
      end

      # The command-line args.
      #
      # @return [Array<String>]
      def args
        settings.rest
      end

      # The name of the data store
      #
      # @return [String]
      def data_store_name
        args.first
      end

      # The name of the processor that should handle the data store
      #
      # @return [String]
      def processor_name
        case data_store_name
        when 'elasticsearch' then :elasticsearch_loader
        when nil
          settings.dump_help
          exit(1)
        else
          raise Error.new("No loader defined for data store: #{data_store_name}")
        end
      end

      # Run this loader.
      def run
        StupidServer.new(processor_name, settings).run!
      end
      
    end
  end
end
{'fraction_non_alphanumeric': 0.0617678381256656, 'fraction_numerical': 0.0028399006034788782, 'mean_word_length': 1.6262814538676607, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4521280', 'n_tokens_mistral': 790, 'n_tokens_neox': 766, 'n_words': 254}