omf_ec 6.1.3.pre.1 → 6.1.3.pre.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/example/config/logging_to_oml.yml +36 -0
- data/example/config/with_custom_logging.yml +2 -1
- data/lib/omf_ec/runner.rb +15 -8
- metadata +5 -4
| @@ -0,0 +1,36 @@ | |
| 1 | 
            +
            communication:
         | 
| 2 | 
            +
              url: amqp://localhost
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            # This setup will silent STDOUT,
         | 
| 5 | 
            +
            # send info messages to OML SERVER,
         | 
| 6 | 
            +
            # and everything to ROLLING LOG FILES
         | 
| 7 | 
            +
            #
         | 
| 8 | 
            +
            # In this example, these setting are identical to EC default
         | 
| 9 | 
            +
            logging:
         | 
| 10 | 
            +
              level:
         | 
| 11 | 
            +
                default: debug
         | 
| 12 | 
            +
              appenders:
         | 
| 13 | 
            +
                # Turn off STDOUT
         | 
| 14 | 
            +
                stdout:
         | 
| 15 | 
            +
                  level: :info
         | 
| 16 | 
            +
                # To Rolling log file, and log everything
         | 
| 17 | 
            +
                rolling_file:
         | 
| 18 | 
            +
                  level: all
         | 
| 19 | 
            +
                  log_dir: /var/tmp
         | 
| 20 | 
            +
                  # max 50mb of each log file
         | 
| 21 | 
            +
                  size: 52428800
         | 
| 22 | 
            +
                  # keep a 5 logs in total
         | 
| 23 | 
            +
                  keep: 5
         | 
| 24 | 
            +
                  date_pattern: "%F %T %z"
         | 
| 25 | 
            +
                  pattern: "[%d] %-5l %c: %m\n"
         | 
| 26 | 
            +
                # To OML is enabled by default when oml_uri option is SET
         | 
| 27 | 
            +
                # Uncomment this if you need to change the default
         | 
| 28 | 
            +
                #
         | 
| 29 | 
            +
                # oml4r:
         | 
| 30 | 
            +
                #   level: info
         | 
| 31 | 
            +
                #   appName: 'omf_ec'
         | 
| 32 | 
            +
                #   domain: '<%= OmfEc.experiment.id %>'
         | 
| 33 | 
            +
                #   collect: tcp:some_other_oml_server:3003
         | 
| 34 | 
            +
             | 
| 35 | 
            +
            # Use OML server located at localhost port 3003
         | 
| 36 | 
            +
            oml_uri: tcp:localhost:3003
         | 
    
        data/lib/omf_ec/runner.rb
    CHANGED
    
    | @@ -40,7 +40,7 @@ module OmfEc | |
| 40 40 | 
             
                          keep: 5, # keep a 5 logs in total
         | 
| 41 41 | 
             
                          date_pattern: '%F %T %z',
         | 
| 42 42 | 
             
                          pattern: '[%d] %-5l %c: %m\n'
         | 
| 43 | 
            -
                        } | 
| 43 | 
            +
                        }
         | 
| 44 44 | 
             
                      }
         | 
| 45 45 | 
             
                    }
         | 
| 46 46 | 
             
                  )
         | 
| @@ -93,6 +93,7 @@ module OmfEc | |
| 93 93 |  | 
| 94 94 | 
             
                      op.on("--name", "--experiment EXPERIMENT_NAME", "Experiment name") do |e_name|
         | 
| 95 95 | 
             
                        @cmd_opts[:experiment_name] = e_name
         | 
| 96 | 
            +
                        OmfEc.experiment.name = e_name
         | 
| 96 97 | 
             
                        remove_cmd_opts_from_argv("--name", "--experiment", e_name)
         | 
| 97 98 | 
             
                      end
         | 
| 98 99 |  | 
| @@ -157,13 +158,25 @@ module OmfEc | |
| 157 158 | 
             
                  uri = @cmd_opts.delete(:uri)
         | 
| 158 159 | 
             
                  @config_opts[:communication][:url] = uri if uri
         | 
| 159 160 | 
             
                  @config_opts[:communication][:auth] = { authenticate: true } if @cmd_opts[:cert]
         | 
| 161 | 
            +
             | 
| 162 | 
            +
             | 
| 160 163 | 
             
                  @config_opts.merge!(@cmd_opts)
         | 
| 164 | 
            +
             | 
| 165 | 
            +
                  if @config_opts[:oml_uri]
         | 
| 166 | 
            +
                    # Only change default if they are not set in config file
         | 
| 167 | 
            +
                    @config_opts[:logging][:appenders][:oml4r] ||= {
         | 
| 168 | 
            +
                      level: :info,
         | 
| 169 | 
            +
                      appName: 'omf_ec',
         | 
| 170 | 
            +
                      domain: OmfEc.experiment.id,
         | 
| 171 | 
            +
                      collect: @config_opts[:oml_uri]
         | 
| 172 | 
            +
                    }
         | 
| 173 | 
            +
                  end
         | 
| 161 174 | 
             
                end
         | 
| 162 175 |  | 
| 163 176 | 
             
                def parse_config_file
         | 
| 164 177 | 
             
                  if (config_file = @cmd_opts.delete(:config_file))
         | 
| 165 178 | 
             
                    if File.exist?(config_file)
         | 
| 166 | 
            -
                      @config_opts.merge!(OmfCommon.load_yaml(config_file))
         | 
| 179 | 
            +
                      @config_opts.merge!(OmfCommon.load_yaml(config_file, erb_process: true))
         | 
| 167 180 | 
             
                    else
         | 
| 168 181 | 
             
                      puts "Config file '#{config_file}' doesn't exist"
         | 
| 169 182 | 
             
                      exit(1)
         | 
| @@ -176,7 +189,6 @@ module OmfEc | |
| 176 189 | 
             
                end
         | 
| 177 190 |  | 
| 178 191 | 
             
                def setup_experiment
         | 
| 179 | 
            -
                  OmfEc.experiment.name = @config_opts[:experiment_name] if @config_opts[:experiment_name]
         | 
| 180 192 | 
             
                  OmfEc.experiment.oml_uri = @config_opts[:oml_uri] if @config_opts[:oml_uri]
         | 
| 181 193 | 
             
                  OmfEc.experiment.show_graph = @config_opts['show-graph']
         | 
| 182 194 |  | 
| @@ -242,11 +254,6 @@ module OmfEc | |
| 242 254 | 
             
                  else
         | 
| 243 255 | 
             
                    Logging.consolidate 'OmfCommon', 'OmfRc'
         | 
| 244 256 | 
             
                  end
         | 
| 245 | 
            -
             | 
| 246 | 
            -
                  if OmfEc.experiment.oml_uri
         | 
| 247 | 
            -
                    require 'oml4r/logging/oml4r_appender'
         | 
| 248 | 
            -
                    Logging.logger.root.add_appenders(Logging.appenders.oml4r('oml4r', :appName => 'omf_ec', :domain => "#{OmfEc.experiment.id}", :collect => "#{OmfEc.experiment.oml_uri}"))
         | 
| 249 | 
            -
                  end
         | 
| 250 257 | 
             
                end
         | 
| 251 258 |  | 
| 252 259 | 
             
                def load_experiment
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: omf_ec
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 6.1.3.pre. | 
| 4 | 
            +
              version: 6.1.3.pre.2
         | 
| 5 5 | 
             
              prerelease: 6
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2014-07- | 
| 12 | 
            +
            date: 2014-07-08 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: minitest
         | 
| @@ -98,7 +98,7 @@ dependencies: | |
| 98 98 | 
             
                requirements:
         | 
| 99 99 | 
             
                - - '='
         | 
| 100 100 | 
             
                  - !ruby/object:Gem::Version
         | 
| 101 | 
            -
                    version: 6.1.3.pre. | 
| 101 | 
            +
                    version: 6.1.3.pre.2
         | 
| 102 102 | 
             
              type: :runtime
         | 
| 103 103 | 
             
              prerelease: false
         | 
| 104 104 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| @@ -106,7 +106,7 @@ dependencies: | |
| 106 106 | 
             
                requirements:
         | 
| 107 107 | 
             
                - - '='
         | 
| 108 108 | 
             
                  - !ruby/object:Gem::Version
         | 
| 109 | 
            -
                    version: 6.1.3.pre. | 
| 109 | 
            +
                    version: 6.1.3.pre.2
         | 
| 110 110 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 111 111 | 
             
              name: sequel
         | 
| 112 112 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -137,6 +137,7 @@ files: | |
| 137 137 | 
             
            - Rakefile
         | 
| 138 138 | 
             
            - bin/omf_ec
         | 
| 139 139 | 
             
            - example/config/default.yml
         | 
| 140 | 
            +
            - example/config/logging_to_oml.yml
         | 
| 140 141 | 
             
            - example/config/with_custom_logging.yml
         | 
| 141 142 | 
             
            - example/engine_oedl.rb
         | 
| 142 143 | 
             
            - example/engine_test.rb
         |