utils 0.0.64 → 0.0.65

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/VERSION +1 -1
  2. data/bin/probe +21 -8
  3. data/lib/utils/version.rb +1 -1
  4. data/utils.gemspec +1 -1
  5. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.64
1
+ 0.0.65
data/bin/probe CHANGED
@@ -48,32 +48,45 @@ $opt['h'] and usage
48
48
  uri = "druby://localhost:#{$opt['p'] || 6623}"
49
49
 
50
50
  if $opt['l']
51
- Thread.abort_on_exception = false
51
+ Thread.abort_on_exception = $DEBUG
52
52
 
53
53
  class ProbeServer
54
54
  def initialize
55
55
  @jobs = Queue.new
56
- Thread.new { loop }
56
+ Thread.new { work_loop }
57
57
  end
58
58
 
59
- def run(job)
60
- @jobs << job
59
+ def enqueue(job)
60
+ output_message "Job #{cmd(job).inspect} enqueued."
61
+ @jobs.push job
61
62
  end
63
+ alias run enqueue
62
64
 
63
65
  private
64
66
 
67
+ def output_message(msg)
68
+ STDOUT.puts msg
69
+ STDOUT.flush
70
+ end
71
+
65
72
  def run_job(job)
73
+ output_message "Job #{cmd(job)} about to run now."
66
74
  fork do
67
- exec $0, *job
75
+ exec *cmd(job)
68
76
  end
69
77
  Process.wait
70
78
  end
71
79
 
72
- def loop
73
- while job = @jobs.pop
80
+ def work_loop
81
+ loop do
82
+ job = @jobs.shift
74
83
  run_job job
75
84
  end
76
85
  end
86
+
87
+ def cmd(job)
88
+ [ $0, *job ]
89
+ end
77
90
  end
78
91
 
79
92
  puts "Starting probe server listening to #{uri.inspect}."
@@ -93,7 +106,7 @@ if $opt['c']
93
106
  DRb.start_service
94
107
  probe_server = DRbObject.new_with_uri(uri)
95
108
  opts = $opt.subhash('n', 't').map { |k, v| v.full? { "-#{k} #{v.inspect}" } }.compact
96
- probe_server.run opts + args
109
+ probe_server.enqueue opts + args
97
110
  exit
98
111
  end
99
112
 
@@ -1,6 +1,6 @@
1
1
  module Utils
2
2
  # Utils version
3
- VERSION = '0.0.64'
3
+ VERSION = '0.0.65'
4
4
  VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "utils"
5
- s.version = "0.0.64"
5
+ s.version = "0.0.65"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Florian Frank"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.64
4
+ version: 0.0.65
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -277,7 +277,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
277
277
  version: '0'
278
278
  segments:
279
279
  - 0
280
- hash: -4422613472465746799
280
+ hash: -4475408776831516196
281
281
  required_rubygems_version: !ruby/object:Gem::Requirement
282
282
  none: false
283
283
  requirements: