From b1989dd8fcabfe393c559e8a2ae990a9a553bf85 Mon Sep 17 00:00:00 2001 From: Nick Gauthier Date: Fri, 5 Feb 2010 16:20:26 -0500 Subject: [PATCH] removed sleep() line. added time to trace output. sorting files by size --- lib/hydra/master.rb | 1 + lib/hydra/trace.rb | 2 +- lib/hydra/worker.rb | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/hydra/master.rb b/lib/hydra/master.rb index ec883a4..e54413f 100644 --- a/lib/hydra/master.rb +++ b/lib/hydra/master.rb @@ -23,6 +23,7 @@ module Hydra #:nodoc: opts.merge!(YAML.load_file(config_file).stringify_keys!) end @files = opts.fetch('files') { [] } + @files.sort!{|a,b| File.size(b) <=> File.size(a)} # dumb heuristic @incomplete_files = @files.dup @workers = [] @listeners = [] diff --git a/lib/hydra/trace.rb b/lib/hydra/trace.rb index 470fcb9..7b1889f 100644 --- a/lib/hydra/trace.rb +++ b/lib/hydra/trace.rb @@ -16,7 +16,7 @@ module Hydra #:nodoc: # Trace some output with the class's prefix and a newline. # Checks to ensure we're running verbosely. def trace(str) - $stdout.write "#{self.class._traceable_prefix}| #{str}\n" if @verbose + $stdout.write "#{Time.now.to_f} #{self.class._traceable_prefix}| #{str}\n" if @verbose end end end diff --git a/lib/hydra/worker.rb b/lib/hydra/worker.rb index 5e3b23e..94448c3 100644 --- a/lib/hydra/worker.rb +++ b/lib/hydra/worker.rb @@ -139,7 +139,6 @@ module Hydra #:nodoc: idle_r = nil while idle_r.nil? idle_r = @runners.detect{|runner| runner[:idle]} - sleep(1) end return idle_r end