oml4r 2.9.0 → 2.9.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/oml4r.rb +16 -17
- metadata +2 -2
data/lib/oml4r.rb
CHANGED
@@ -40,7 +40,7 @@ require 'optparse'
|
|
40
40
|
#
|
41
41
|
module OML4R
|
42
42
|
|
43
|
-
VERSION = "2.9.0"
|
43
|
+
VERSION = "2.9.0.1"
|
44
44
|
VERSION_STRING = "OML4R Client V#{VERSION}"
|
45
45
|
COPYRIGHT = "Copyright 2009-2012, NICTA"
|
46
46
|
DEF_SERVER_PORT = 3003
|
@@ -159,7 +159,7 @@ module OML4R
|
|
159
159
|
cna = @@channels[klass] || []
|
160
160
|
$stderr.puts "DEBUG '#{cna.inspect}', '#{klass}'" if OML4R.loglevel > 0
|
161
161
|
ca = cna.collect do |cname, domain|
|
162
|
-
# return it in an array as we need to add the channel specific index
|
162
|
+
# return it in an array as we need to add the channel specific index
|
163
163
|
[Channel[cname.to_sym, domain.to_sym]]
|
164
164
|
end
|
165
165
|
$stderr.puts "DEBUG Using channels '#{ca.inspect}" if OML4R.loglevel > 0
|
@@ -230,7 +230,7 @@ module OML4R
|
|
230
230
|
#if opts[:id]
|
231
231
|
# raise 'OML4R: :id is not a valid option. Do you mean :nodeID?'
|
232
232
|
#end
|
233
|
-
nodeID = ENV['OML_NAME'] || opts[:nodeID] || opts[:id] || ENV['OML_ID']
|
233
|
+
nodeID = ENV['OML_NAME'] || opts[:nodeID] || opts[:id] || ENV['OML_ID']
|
234
234
|
#
|
235
235
|
# XXX: Same again; also, this is the responsibility of the developer, not the user
|
236
236
|
#if opts[:app]
|
@@ -256,8 +256,8 @@ module OML4R
|
|
256
256
|
op.on("--oml-id id", "Name to identify this app instance [#{nodeID || 'undefined'}]") { |name| nodeID = name }
|
257
257
|
op.on("--oml-domain domain", "Name of experimental domain [#{domain || 'undefined'}] *EXPERIMENTAL*") { |name| domain = name }
|
258
258
|
op.on("--oml-collect uri", "URI of server to send measurements to") { |u| omlCollectUri = u }
|
259
|
-
op.on("--oml-log-level l", "Log level used (info: 0 .. debug: 1)") { |l| OML4R.loglevel = l.to_i
|
260
|
-
op.on("--oml-noop", "Do not collect measurements") { noop = true }
|
259
|
+
op.on("--oml-log-level l", "Log level used (info: 0 .. debug: 1)") { |l| OML4R.loglevel = l.to_i }
|
260
|
+
op.on("--oml-noop", "Do not collect measurements") { noop = true }
|
261
261
|
op.on("--oml-exp-id domain", "Obsolescent equivalent to --oml-domain domain") { |name|
|
262
262
|
domain = name
|
263
263
|
$stderr.puts "WARN Option --oml-exp-id is getting deprecated; please use '--oml-domain #{domain}' instead"
|
@@ -299,7 +299,7 @@ module OML4R
|
|
299
299
|
|
300
300
|
#
|
301
301
|
# Close the OML collection. This will block until all outstanding data have been sent out.
|
302
|
-
#
|
302
|
+
#
|
303
303
|
def self.close()
|
304
304
|
Channel.close_all
|
305
305
|
end
|
@@ -331,7 +331,7 @@ module OML4R
|
|
331
331
|
out = _connect(url)
|
332
332
|
@@channels[key] = self.new(url, domain, out)
|
333
333
|
end
|
334
|
-
|
334
|
+
|
335
335
|
def self._connect(url)
|
336
336
|
if url.start_with? 'file:'
|
337
337
|
proto, fname = url.split(':')
|
@@ -417,7 +417,7 @@ module OML4R
|
|
417
417
|
@out = out_channel
|
418
418
|
@index = 0
|
419
419
|
@header = []
|
420
|
-
@header_sent = false
|
420
|
+
@header_sent = false
|
421
421
|
@queue = Queue.new
|
422
422
|
start_runner
|
423
423
|
end
|
@@ -448,16 +448,15 @@ module OML4R
|
|
448
448
|
msg = @queue.pop
|
449
449
|
if (active = !msg.nil?)
|
450
450
|
ma << msg
|
451
|
-
end
|
451
|
+
end
|
452
452
|
end
|
453
453
|
msg = ma.join("\n")
|
454
454
|
end
|
455
455
|
#$stderr.puts ">>>>>>#{@domain}: <#{msg}>"
|
456
456
|
unless msg.nil?
|
457
|
-
_send msg
|
457
|
+
_send msg
|
458
458
|
end
|
459
459
|
end
|
460
|
-
puts ">> CLOSE"
|
461
460
|
@out.close
|
462
461
|
@out = nil
|
463
462
|
rescue Exception => ex
|
@@ -467,31 +466,31 @@ module OML4R
|
|
467
466
|
info "Channel #{url} closed"
|
468
467
|
end
|
469
468
|
end
|
470
|
-
|
469
|
+
|
471
470
|
def info(msg)
|
472
471
|
Object.const_defined?(:MObject) ? MObject.warn(:oml4r, msg) : $stderr.puts("INFO #{msg}")
|
473
472
|
end
|
474
|
-
|
473
|
+
|
475
474
|
def _send(msg)
|
476
475
|
begin
|
477
476
|
unless @header_sent
|
478
477
|
h = "#{@header.join("\n")}\n\n"
|
479
|
-
|
478
|
+
$stderr.puts "DEBUG '#{h}'" if OML4R.loglevel > 3
|
480
479
|
@out.puts h
|
481
480
|
@header_sent = true
|
482
481
|
end
|
483
|
-
@out.puts msg
|
482
|
+
@out.puts msg
|
484
483
|
@out.flush
|
485
484
|
|
486
485
|
rescue Errno::EPIPE
|
487
486
|
# Trying to reconnect
|
488
487
|
info "Trying to reconnect to '#{@url}'"
|
489
|
-
loop do
|
488
|
+
loop do
|
490
489
|
sleep 5
|
491
490
|
begin
|
492
491
|
@out = self.class._connect(@url)
|
493
492
|
@header_sent = false
|
494
|
-
info "Reconnected to '#{@url}'"
|
493
|
+
info "Reconnected to '#{@url}'"
|
495
494
|
return _send(msg)
|
496
495
|
rescue Errno::ECONNREFUSED => ex
|
497
496
|
info "Exception while reconnect '#{@url}' (#{ex.class})"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oml4r
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.9.0
|
4
|
+
version: 2.9.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-13 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: ! '["Simple OML client library for Ruby"]'
|
15
15
|
email:
|