omf_ec 6.0.8.pre.5 → 6.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/omf_ec +7 -3
- data/lib/omf_ec/dsl.rb +2 -1
- data/lib/omf_ec/experiment.rb +23 -3
- data/lib/omf_ec/experiment_property.rb +5 -0
- data/lib/omf_ec/graph/graph_description.rb +21 -0
- data/omf_ec.gemspec +1 -0
- metadata +8 -8
data/bin/omf_ec
CHANGED
@@ -295,7 +295,7 @@ def setup_logging(global_options = {})
|
|
295
295
|
|
296
296
|
if OmfEc.experiment.oml_uri
|
297
297
|
require 'oml4r/logging/oml4r_appender'
|
298
|
-
Logging.logger.root.add_appenders(Logging.appenders.oml4r('oml4r', :appName => '
|
298
|
+
Logging.logger.root.add_appenders(Logging.appenders.oml4r('oml4r', :appName => 'omf_ec', :domain => "#{OmfEc.experiment.id}", :collect => "#{OmfEc.experiment.oml_uri}"))
|
299
299
|
end
|
300
300
|
|
301
301
|
OmfCommon.load_logging_config(global_options[:log_config])
|
@@ -303,7 +303,6 @@ end
|
|
303
303
|
|
304
304
|
def load_exp(exp_path, global_options = {} , options = {}, properties = {})
|
305
305
|
begin
|
306
|
-
|
307
306
|
if options[:inst_oml_uri] && options[:inst_oml_id] && options[:inst_oml_domain]
|
308
307
|
require 'oml4r'
|
309
308
|
instrument_ec = OML4R::init(nil, { collect: options[:inst_oml_uri], nodeID: options[:inst_oml_id], domain: options[:inst_oml_domain] , appName: File.basename($PROGRAM_NAME)} )
|
@@ -331,7 +330,7 @@ def load_exp(exp_path, global_options = {} , options = {}, properties = {})
|
|
331
330
|
setup_logging(global_options)
|
332
331
|
|
333
332
|
OmfCommon.comm.on_connected do |comm|
|
334
|
-
info "OMF Experiment Controller #{OmfEc::VERSION}"
|
333
|
+
info "OMF Experiment Controller #{OmfEc::VERSION} - Start"
|
335
334
|
info "Connected using #{comm.conn_info}"
|
336
335
|
info "Execute: #{exp_path}"
|
337
336
|
info "Properties: #{OmfEc.experiment.cmdline_properties}"
|
@@ -347,11 +346,16 @@ def load_exp(exp_path, global_options = {} , options = {}, properties = {})
|
|
347
346
|
OmfCommon::Auth::CertificateStore.instance.register(ec_cert)
|
348
347
|
end
|
349
348
|
|
349
|
+
OmfEc.experiment.log_metadata("ec_version", "#{OmfEc::VERSION}")
|
350
|
+
OmfEc.experiment.log_metadata("exp_path", exp_path)
|
351
|
+
OmfEc.experiment.log_metadata("ec_pid", "#{Process.pid}")
|
352
|
+
|
350
353
|
begin
|
351
354
|
include OmfEc::Backward::DefaultEvents
|
352
355
|
load exp_path
|
353
356
|
OmfEc::Experiment.start
|
354
357
|
rescue => e
|
358
|
+
OmfEc.experiment.log_metadata("state", "error")
|
355
359
|
error e.message
|
356
360
|
error e.backtrace.join("\n")
|
357
361
|
end
|
data/lib/omf_ec/dsl.rb
CHANGED
@@ -124,8 +124,9 @@ module OmfEc
|
|
124
124
|
# @param name of property
|
125
125
|
# @param default_value for this property
|
126
126
|
# @param description short text description of this property
|
127
|
+
# @param type of property
|
127
128
|
#
|
128
|
-
def def_property(name, default_value, description = nil)
|
129
|
+
def def_property(name, default_value, description = nil, type = nil)
|
129
130
|
OmfEc.experiment.add_property(name, default_value, description)
|
130
131
|
end
|
131
132
|
|
data/lib/omf_ec/experiment.rb
CHANGED
@@ -18,6 +18,16 @@ module OmfEc
|
|
18
18
|
attr_accessor :name, :oml_uri, :app_definitions, :property, :cmdline_properties, :show_graph, :nodes
|
19
19
|
attr_reader :groups, :sub_groups, :state
|
20
20
|
|
21
|
+
# MP only used for injecting metadata
|
22
|
+
class MetaData < OML4R::MPBase
|
23
|
+
name :meta_data
|
24
|
+
|
25
|
+
# TODO: Should we use the meta data functionality - not sure if it is working right now
|
26
|
+
param :domain, type: :string
|
27
|
+
param :key, type: :string
|
28
|
+
param :value, type: :string
|
29
|
+
end
|
30
|
+
|
21
31
|
def initialize
|
22
32
|
super
|
23
33
|
@id = Time.now.utc.iso8601(3)
|
@@ -171,6 +181,11 @@ module OmfEc
|
|
171
181
|
end
|
172
182
|
end
|
173
183
|
|
184
|
+
def log_metadata(key, value, domain = 'sys')
|
185
|
+
#MetaData.inject_metadata(key.to_s, value.to_s)
|
186
|
+
MetaData.inject(domain.to_s, key.to_s, value.to_s)
|
187
|
+
end
|
188
|
+
|
174
189
|
# Purely for backward compatibility
|
175
190
|
class << self
|
176
191
|
# Disconnect communicator, try to delete any XMPP affiliations
|
@@ -186,11 +201,15 @@ module OmfEc
|
|
186
201
|
g.resources[type: 'wlan'].release unless g.net_ifs.find_all { |v| v.conf[:type] == 'wlan' }.empty?
|
187
202
|
end
|
188
203
|
|
189
|
-
OmfCommon.el.after(
|
190
|
-
|
191
|
-
OmfCommon.
|
204
|
+
OmfCommon.el.after(4) do
|
205
|
+
info "OMF Experiment Controller #{OmfEc::VERSION} - Exit."
|
206
|
+
OmfCommon.el.after(1) do
|
207
|
+
OmfCommon.comm.disconnect
|
208
|
+
OmfCommon.eventloop.stop
|
209
|
+
end
|
192
210
|
end
|
193
211
|
end
|
212
|
+
OmfEc.experiment.log_metadata("state", "finished")
|
194
213
|
end
|
195
214
|
|
196
215
|
def disconnect
|
@@ -204,6 +223,7 @@ module OmfEc
|
|
204
223
|
|
205
224
|
def start
|
206
225
|
info "Experiment: #{OmfEc.experiment.id} starts"
|
226
|
+
OmfEc.experiment.log_metadata("state", "running")
|
207
227
|
|
208
228
|
allGroups do |g|
|
209
229
|
g.members.each do |key, value|
|
@@ -160,11 +160,16 @@ module OmfEc
|
|
160
160
|
@value = value
|
161
161
|
info "#{name} = #{value.inspect} (#{value.class})"
|
162
162
|
@change_observers.each { |proc| proc.call(value) }
|
163
|
+
OmfEc.experiment.log_metadata(name, value, :prop)
|
163
164
|
end
|
164
165
|
|
165
166
|
# Implicit conversion to String (required for + operator)
|
166
167
|
def to_str() @value.to_s end
|
167
168
|
|
169
|
+
# More convenient conversion
|
170
|
+
def to_f() @value.to_f end
|
171
|
+
def to_i() @value.to_i end
|
172
|
+
|
168
173
|
# Explicit conversion to String
|
169
174
|
alias_method :to_s, :to_str
|
170
175
|
|
@@ -70,6 +70,7 @@ module OmfEc::Graph
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def _report
|
73
|
+
_report_meta
|
73
74
|
info "REPORT:START: #{@name}"
|
74
75
|
info "REPORT:TYPE: #{@gtype}"
|
75
76
|
info "REPORT:POSTFIX: #{URI.encode(@postfix)}" if @postfix
|
@@ -86,6 +87,26 @@ module OmfEc::Graph
|
|
86
87
|
info "REPORT:STOP"
|
87
88
|
end
|
88
89
|
|
90
|
+
def _report_meta
|
91
|
+
h = {
|
92
|
+
type: @gtype,
|
93
|
+
mapping: @mapping,
|
94
|
+
caption: @caption
|
95
|
+
}
|
96
|
+
h[:postfix] = @postfix if @postfix
|
97
|
+
dss = h[:dss] = {}
|
98
|
+
@ms.each do |ctxt, a|
|
99
|
+
a.each do |ms|
|
100
|
+
dss[ctxt] = ms.sql
|
101
|
+
end
|
102
|
+
end
|
103
|
+
if @axis
|
104
|
+
h[:axis] = @axis
|
105
|
+
end
|
106
|
+
descr = h.to_json
|
107
|
+
OmfEc.experiment.log_metadata(@name, descr, :graph)
|
108
|
+
end
|
109
|
+
|
89
110
|
protected
|
90
111
|
|
91
112
|
def initialize(name)
|
data/omf_ec.gemspec
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omf_ec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0
|
5
|
-
prerelease:
|
4
|
+
version: 6.1.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- NICTA
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-02-
|
12
|
+
date: 2014-02-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
requirements:
|
99
99
|
- - '='
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: 6.0
|
101
|
+
version: 6.1.0
|
102
102
|
type: :runtime
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -106,7 +106,7 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - '='
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 6.0
|
109
|
+
version: 6.1.0
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
111
|
name: gli
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -205,12 +205,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
205
205
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
206
206
|
none: false
|
207
207
|
requirements:
|
208
|
-
- - ! '
|
208
|
+
- - ! '>='
|
209
209
|
- !ruby/object:Gem::Version
|
210
|
-
version:
|
210
|
+
version: '0'
|
211
211
|
requirements: []
|
212
212
|
rubyforge_project: omf_ec
|
213
|
-
rubygems_version: 1.8.
|
213
|
+
rubygems_version: 1.8.23
|
214
214
|
signing_key:
|
215
215
|
specification_version: 3
|
216
216
|
summary: OMF experiment controller
|