Module: Readorder
- Defined in:
- lib/readorder.rb,
lib/readorder/cli.rb,
lib/readorder/log.rb,
lib/readorder/datum.rb,
lib/readorder/paths.rb,
lib/readorder/runner.rb,
lib/readorder/command.rb,
lib/readorder/results.rb,
lib/readorder/version.rb,
lib/readorder/analyzer.rb,
lib/readorder/filelist.rb,
lib/readorder/commands/sort.rb,
lib/readorder/commands/test.rb,
lib/readorder/commands/analyze.rb
Overview
– Copyright © 2009 Jeremy Hinegardner All rights reserved. See LICENSE and/or COPYING for details ++
Defined Under Namespace
Modules: Commands, Log, Paths, Version Classes: Analyzer, Command, Datum, Error, Filelist, Results, Runner
Constant Summary collapse
- Cli =
Main.create { "Copyright 2009 (c) Jeremy Hinegardner" version ::Readorder::VERSION description " Readorder orders a list of files into a more efficient read order.\n\n Given a list of filenames, either on the command line or via stdin,\n output the filenames in an order that should increase the I/O \n throughput when the contents files are read from disc.\n txt\n\n run { help! }\n\n ## --- Modes -- \n ## Default mode is sort, which is when no mode is given\n\n mode( :sort ) {\n description <<-txt\n Given a list of filenames, either on the command line or via stdin,\n output the filenames in an order that should increase the I/O \n throughput when the contents files are read from disc.\n txt\n\n option( 'inode' ) {\n description \"Only use inode order do not attempt physical block order\"\n cast :boolean\n }\n\n mixin :option_log_level\n mixin :option_log_file\n mixin :argument_filelist\n mixin :option_output\n mixin :option_error_filelist\n mixin :option_batch_size\n\n run { Cli.run_command_with_params( 'sort', params ) }\n }\n\n mode( :analyze ) {\n description <<-txt\n Take the list of filenames and output an analysis of the volume of\n data in those files.\n txt\n\n mixin :option_log_level\n mixin :option_log_file\n mixin :argument_filelist\n mixin :option_output\n mixin :option_error_filelist\n mixin :option_batch_size\n\n option( 'data-csv' ) {\n description \"Write the raw data collected to this csv file\"\n argument :required\n validate { |f| File.directory?( File.dirname(File.expand_path( f ) ) ) }\n }\n \n run { Cli.run_command_with_params( 'analyze', params ) }\n }\n\n mode( :test ) {\n description <<-txt\n Give a list of filenames, either on the commandline or via stdin, \n take a random subsample of them and read all the contents of those\n files in different orders.\n\n 1) in initial given order\n 2) in inode order\n 3) in physical block order\n\n Output a report of the various times take to read the files.\n\n This command requires elevated priveleges to run and will spike the \n I/O of your machine. Run with care.\n txt\n option( :percentage ) {\n description \"What random percentage of input files to select\"\n argument :required\n default \"10\"\n validate { |p| \n pi = Float(p)\n (pi > 0) and (pi <= 100)\n }\n cast :float\n }\n mixin :option_log_level\n mixin :option_log_file\n mixin :option_output\n mixin :argument_filelist\n mixin :option_error_filelist\n mixin :option_batch_size\n\n run { Cli.run_command_with_params( 'test', params ) }\n }\n\n ## --- Mixins --- \n mixin :argument_filelist do\n argument('filelist') {\n description \"The files containing filenames\"\n arity '*'\n default [ $stdin ]\n required false\n }\n end\n\n mixin :option_log_level do\n option( 'log-level' ) do\n description \"The verbosity of logging, one of [ \#{::Logging::LNAMES.map {|l| l.downcase }.join(', ')} ]\"\n argument :required\n default 'info'\n validate { |l| %w[ debug info warn error fatal off ].include?( l.downcase ) }\n end\n end\n\n mixin :option_log_file do\n option( 'log-file' ) do\n description \"Log to this file instead of stderr\"\n argument :required\n validate { |f| File.directory?( File.dirname(File.expand_path( f ) ) ) }\n end\n end\n\n mixin :option_output do\n option( 'output' ) do\n description \"Where to write the output\"\n argument :required\n validate { |f| File.directory?( File.dirname(File.expand_path( f ) ) ) }\n end\n end\n\n mixin :option_error_filelist do\n option('error-filelist') do\n description \"Write all the files from the filelist that had errors to this file\"\n argument :required\n validate { |f| File.directory?( File.dirname(File.expand_path( f ) ) ) }\n end\n end\n\n mixin :option_batch_size do\n option('batch-size' ) do\n description \"The number of files to queue before writing them to the db for storage\"\n argument :required\n default 10_000\n cast :integer\n end\n end\n}\n"
- VERSION =
Version.to_s
Constants included from Version
Version::BUILD, Version::MAJOR, Version::MINOR, Version::STRING
Class Method Summary collapse
Methods included from Paths
bin_path, config_path, data_path, home_dir, home_dir=, home_path, lib_path, log_path, root_dir, root_path, spec_path, sub_path, tmp_path
Methods included from Version
Class Method Details
.logger ⇒ Object
7 8 9 |
# File 'lib/readorder/log.rb', line 7 def self.logger ::Logging::Logger[self] end |