Sha256: 987b195fb1c39558cebcb966576bf54d8ff463cb5aad896a08db13cab6c7e113

Contents?: true

Size: 787 Bytes

Versions: 44

Compression:

Stored size: 787 Bytes

Contents

module TreasureData
module Command

  def sample_apache(op)
    fname = op.cmd_parse

    require 'json'

    t = Time.now.to_i
    i = 0
    last_time = nil

    data = File.join(File.dirname(__FILE__), '../../../data/sample_apache.json')
    File.open(data) {|df|
      File.open(fname, 'w') {|of|
        df.each_line {|line|
          record = JSON.parse(line)
          record['time'] = last_time = (t - (i**1.3)).to_i
          of.puts record.to_json
          i += 1
        }
      }
    }

    $stderr.print "Created #{fname} with #{i} records whose time is "
    $stderr.puts "in the [#{Time.at(last_time)}, #{Time.at(t)}] range."

    $stderr.puts "Use '#{$prog} " + Config.cl_options_string + "table:import <db> <table> --json #{fname}' to import this file."
  end

end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
td-0.17.1 lib/td/command/sample.rb
td-0.17.0 lib/td/command/sample.rb
td-0.16.10 lib/td/command/sample.rb
td-0.16.9 lib/td/command/sample.rb
td-0.16.8 lib/td/command/sample.rb
td-0.16.7 lib/td/command/sample.rb
td-0.16.6 lib/td/command/sample.rb
td-0.16.5 lib/td/command/sample.rb
td-0.16.4 lib/td/command/sample.rb
td-0.16.3 lib/td/command/sample.rb
td-0.16.1 lib/td/command/sample.rb
td-0.16.0 lib/td/command/sample.rb
td-0.15.9 lib/td/command/sample.rb
td-0.15.8 lib/td/command/sample.rb
td-0.15.7 lib/td/command/sample.rb
td-0.15.6 lib/td/command/sample.rb
td-0.15.5 lib/td/command/sample.rb
td-0.15.4 lib/td/command/sample.rb
td-0.15.3 lib/td/command/sample.rb
td-0.15.2 lib/td/command/sample.rb