utils 0.0.64 → 0.0.65
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/probe +21 -8
- data/lib/utils/version.rb +1 -1
- data/utils.gemspec +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
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 =
|
51
|
+
Thread.abort_on_exception = $DEBUG
|
52
52
|
|
53
53
|
class ProbeServer
|
54
54
|
def initialize
|
55
55
|
@jobs = Queue.new
|
56
|
-
Thread.new {
|
56
|
+
Thread.new { work_loop }
|
57
57
|
end
|
58
58
|
|
59
|
-
def
|
60
|
-
|
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
|
75
|
+
exec *cmd(job)
|
68
76
|
end
|
69
77
|
Process.wait
|
70
78
|
end
|
71
79
|
|
72
|
-
def
|
73
|
-
|
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.
|
109
|
+
probe_server.enqueue opts + args
|
97
110
|
exit
|
98
111
|
end
|
99
112
|
|
data/lib/utils/version.rb
CHANGED
data/utils.gemspec
CHANGED
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.
|
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: -
|
280
|
+
hash: -4475408776831516196
|
281
281
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
282
282
|
none: false
|
283
283
|
requirements:
|