omf_ec 6.0.8.pre.4 → 6.0.8.pre.5

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/bin/omf_ec CHANGED
@@ -53,8 +53,18 @@ flag [:log_config]
53
53
  desc "Add some colours to logging"
54
54
  switch [:colour]
55
55
 
56
+ desc "EC config file"
57
+ arg_name "file"
58
+ flag [:c, :config]
59
+
60
+ $config_file = ".config/omf_ec.yml"
61
+ ARGV.each_index {|a|
62
+ if ARGV[a]=="-c" or ARGV[a]=="--config"
63
+ $config_file = ARGV[a+1] if not ARGV[a+1].nil?
64
+ end
65
+ }
56
66
  # the path given here is relative to the user's home directory
57
- config_file(".config/omf_ec.yml")
67
+ config_file($config_file)
58
68
 
59
69
  desc "Execute an experiment script"
60
70
  arg_name "path_to_script_file [-- --experiment_property value]"
@@ -184,7 +194,7 @@ desc "Return the status of the nodes"
184
194
  command :stat do |c|
185
195
  c.desc "use this testbed configuration in OMF 5 EC config file"
186
196
  c.arg_name "AGGREGATE"
187
- c.flag [:c, :config], :default_value => "default"
197
+ c.flag [:C], :default_value => "default"
188
198
 
189
199
  c.desc "comma-separated list of nodes to image"
190
200
  c.arg_name "TOPOLOGY"
@@ -194,7 +204,7 @@ command :stat do |c|
194
204
  c.switch [:s, :summary]
195
205
 
196
206
  c.action do |global_options, options, args|
197
- @cmd = "omf-5.4 stat -c #{options[:c]} -t #{options[:t]} "
207
+ @cmd = "omf-5.4 stat -c #{options[:C]} -t #{options[:t]} "
198
208
  @cmd += "-s" if options[:s]
199
209
  load_exp(@testbed_exp_path, global_options, options)
200
210
  end
@@ -283,6 +293,11 @@ def setup_logging(global_options = {})
283
293
  :pattern => '[%d] %-5l %c: %m\n')))
284
294
  end
285
295
 
296
+ if OmfEc.experiment.oml_uri
297
+ require 'oml4r/logging/oml4r_appender'
298
+ Logging.logger.root.add_appenders(Logging.appenders.oml4r('oml4r', :appName => 'omf_ec_log', :domain => "#{OmfEc.experiment.id}", :collect => "#{OmfEc.experiment.oml_uri}"))
299
+ end
300
+
286
301
  OmfCommon.load_logging_config(global_options[:log_config])
287
302
  end
288
303
 
@@ -17,7 +17,7 @@ onEvent(:ALL_UP) do
17
17
  allGroups.exec("/bin/date")
18
18
 
19
19
  info "TEST - group"
20
- group("Actor").exec("/bin/hostname -f")
20
+ group("Actor").exec("/bin/hostname -A")
21
21
 
22
22
  Experiment.done
23
23
  end
@@ -58,12 +58,20 @@ module OmfEc::Context
58
58
 
59
59
  # For now this follows v5.4 syntax...
60
60
  # We have not yet finalised an OML syntax inside OEDL for v6
61
- def measure(mp,filters)
62
- warn "No OML URI configured, don't know where to send measurements (add option 'oml_uri')" if OmfEc.experiment.oml_uri.nil?
63
- collection = {:url => OmfEc.experiment.oml_uri, :streams => [] }
64
- stream = { :mp => mp , :filters => [] }.merge(filters)
65
- collection[:streams] << stream
66
- @oml_collections << collection
61
+ # TODO: v6 currently does not support OML filters. Formerly in v5.x, these
62
+ # filters were defined in an optional block.
63
+ def measure(mp, opts, &block)
64
+ collect_point = opts.delete(:collect)
65
+ collect_point ||= OmfEc.experiment.oml_uri
66
+ if collect_point.nil?
67
+ warn "No OML URI configured for measurement collection! "+
68
+ "(see option 'oml_uri'). Disabling OML Collection for '#{mp}'."
69
+ return
70
+ end
71
+ stream = { :mp => mp , :filters => [] }.merge(opts)
72
+ index = @oml_collections.find_index { |c| c[:url] == collect_point }
73
+ @oml_collections << {:url => collect_point, :streams => [stream] } if index.nil?
74
+ @oml_collections[index][:streams] << stream unless index.nil?
67
75
  end
68
76
 
69
77
  def properties
data/lib/omf_ec.rb CHANGED
@@ -47,7 +47,7 @@ end
47
47
 
48
48
  def register_default_callback(topic)
49
49
  topic.on_inform do |msg|
50
- OmfEc::MPReceived.inject(Time.now.to_f, topic.id, msg.mid) if OmfCommon::Measure.enabled?
50
+ OmfEc::MPReceived.inject(Time.now.to_f, topic.id, msg.mid) if OmfCommon::Measure.enabled?
51
51
  case msg.itype.upcase
52
52
  when 'CREATION.FAILED'
53
53
  warn "RC reports creation.failed: '#{msg[:reason]}'", msg.src
@@ -0,0 +1,41 @@
1
+ # Copyright (c) 2014 National ICT Australia Limited (NICTA).
2
+ # This software may be used and distributed solely under the terms of the MIT license (License).
3
+ # You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
4
+ # By downloading or using this software you accept the terms and the liability disclaimer in the License.
5
+
6
+ require 'test_helper'
7
+ require 'omf_ec/context/app_context'
8
+
9
+ describe OmfEc::Context::AppContext do
10
+ before do
11
+ OmfEc.experiment.stubs(:app_definitions).returns({'foo_app' => 'foo_def'})
12
+ @app_context = OmfEc::Context::AppContext.new('foo_app', 'foo_group')
13
+ end
14
+
15
+ describe "when defined with an associated application definition" do
16
+ it "must be able to create valid configuration hash for OML Collection Measurement Points" do
17
+ @app_context.measure('ms1', :samples => 1)
18
+ @app_context.oml_collections.must_equal []
19
+ @app_context.measure('ms1', :samples => 1, :collect => "foo1")
20
+ @app_context.oml_collections.must_equal [{:url=>"foo1", :streams=>[{:mp=>"ms1", :filters=>[], :samples=>1}]}]
21
+ @app_context.oml_collections = []
22
+ @app_context.measure('ms1', :samples => 1, :collect => "foo1")
23
+ @app_context.measure('ms2', :interval => 1, :collect => "foo1")
24
+ @app_context.oml_collections.must_equal [{:url=>"foo1", :streams=>[{:mp=>"ms1", :filters=>[], :samples=>1}, {:mp=>"ms2", :filters=>[], :interval=>1}]}]
25
+ @app_context.oml_collections = []
26
+ @app_context.measure('ms1', :samples => 1, :collect => "foo1")
27
+ @app_context.measure('ms2', :interval => 1, :collect => "foo2")
28
+ @app_context.oml_collections.must_equal [{:url=>"foo1", :streams=>[{:mp=>"ms1", :filters=>[], :samples=>1}]}, {:url=>"foo2", :streams=>[{:mp=>"ms2", :filters=>[], :interval=>1}]}]
29
+ OmfEc.experiment.stubs(:oml_uri).returns('foo_url')
30
+ @app_context.oml_collections = []
31
+ @app_context.measure('ms1', :samples => 1)
32
+ @app_context.measure('ms2', :interval => 1)
33
+ @app_context.oml_collections.must_equal [{:url=>"foo_url", :streams=>[{:mp=>"ms1", :filters=>[], :samples=>1}, {:mp=>"ms2", :filters=>[], :interval=>1}]}]
34
+ @app_context.oml_collections = []
35
+ @app_context.measure('ms1', :samples => 1)
36
+ @app_context.measure('ms2', :interval => 1, :collect => "foo2")
37
+ @app_context.oml_collections.must_equal [{:url=>"foo_url", :streams=>[{:mp=>"ms1", :filters=>[], :samples=>1}]}, {:url=>"foo2", :streams=>[{:mp=>"ms2", :filters=>[], :interval=>1}]}]
38
+ end
39
+
40
+ end
41
+ end
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omf_ec
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.8.pre.4
4
+ version: 6.0.8.pre.5
5
+ prerelease: 6
5
6
  platform: ruby
6
7
  authors:
7
8
  - NICTA
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-01-06 00:00:00.000000000 Z
12
+ date: 2014-02-05 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: minitest
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ~>
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :development
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ~>
25
28
  - !ruby/object:Gem::Version
@@ -27,6 +30,7 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: em-minitest-spec
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - ~>
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :development
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - ~>
39
44
  - !ruby/object:Gem::Version
@@ -41,85 +46,97 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: simplecov
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - '>='
51
+ - - ! '>='
46
52
  - !ruby/object:Gem::Version
47
53
  version: '0'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - '>='
59
+ - - ! '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: pry
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
- - - '>='
67
+ - - ! '>='
60
68
  - !ruby/object:Gem::Version
61
69
  version: '0'
62
70
  type: :development
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
- - - '>='
75
+ - - ! '>='
67
76
  - !ruby/object:Gem::Version
68
77
  version: '0'
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: mocha
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
- - - '>='
83
+ - - ! '>='
74
84
  - !ruby/object:Gem::Version
75
85
  version: '0'
76
86
  type: :development
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
- - - '>='
91
+ - - ! '>='
81
92
  - !ruby/object:Gem::Version
82
93
  version: '0'
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: omf_common
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
99
  - - '='
88
100
  - !ruby/object:Gem::Version
89
- version: 6.0.8.pre.4
101
+ version: 6.0.8.pre.5
90
102
  type: :runtime
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
107
  - - '='
95
108
  - !ruby/object:Gem::Version
96
- version: 6.0.8.pre.4
109
+ version: 6.0.8.pre.5
97
110
  - !ruby/object:Gem::Dependency
98
111
  name: gli
99
112
  requirement: !ruby/object:Gem::Requirement
113
+ none: false
100
114
  requirements:
101
- - - '>='
115
+ - - ! '>='
102
116
  - !ruby/object:Gem::Version
103
117
  version: '0'
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
107
122
  requirements:
108
- - - '>='
123
+ - - ! '>='
109
124
  - !ruby/object:Gem::Version
110
125
  version: '0'
111
126
  - !ruby/object:Gem::Dependency
112
127
  name: sequel
113
128
  requirement: !ruby/object:Gem::Requirement
129
+ none: false
114
130
  requirements:
115
- - - '>='
131
+ - - ! '>='
116
132
  - !ruby/object:Gem::Version
117
133
  version: '0'
118
134
  type: :runtime
119
135
  prerelease: false
120
136
  version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
121
138
  requirements:
122
- - - '>='
139
+ - - ! '>='
123
140
  - !ruby/object:Gem::Version
124
141
  version: '0'
125
142
  description: Experiment controller of OMF, a generic framework for controlling and
@@ -165,6 +182,7 @@ files:
165
182
  - lib/omf_ec/group.rb
166
183
  - lib/omf_ec/version.rb
167
184
  - omf_ec.gemspec
185
+ - test/omf_ec/app_context_spec.rb
168
186
  - test/omf_ec/context_spec.rb
169
187
  - test/omf_ec/dsl_spec.rb
170
188
  - test/omf_ec/experiment_property_spec.rb
@@ -174,25 +192,26 @@ files:
174
192
  homepage: http://omf.mytestbed.net
175
193
  licenses:
176
194
  - MIT
177
- metadata: {}
178
195
  post_install_message:
179
196
  rdoc_options: []
180
197
  require_paths:
181
198
  - lib
182
199
  required_ruby_version: !ruby/object:Gem::Requirement
200
+ none: false
183
201
  requirements:
184
- - - '>='
202
+ - - ! '>='
185
203
  - !ruby/object:Gem::Version
186
204
  version: 1.9.3
187
205
  required_rubygems_version: !ruby/object:Gem::Requirement
206
+ none: false
188
207
  requirements:
189
- - - '>'
208
+ - - ! '>'
190
209
  - !ruby/object:Gem::Version
191
210
  version: 1.3.1
192
211
  requirements: []
193
212
  rubyforge_project: omf_ec
194
- rubygems_version: 2.0.7
213
+ rubygems_version: 1.8.24
195
214
  signing_key:
196
- specification_version: 4
215
+ specification_version: 3
197
216
  summary: OMF experiment controller
198
217
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 0c8f0366816084708f868b39e9cf0ba8188fc311
4
- data.tar.gz: b2bf0c637089196f8996da713770d152f386d6f5
5
- SHA512:
6
- metadata.gz: 7c81d45d25d9bcd907458a7cb34ff0bb2e39ad26341aa6126b3340fc125fb59594bd3420388e670b3df608a23ae2b5297ff62276eba28dc1f3fcdf83b81ebace
7
- data.tar.gz: 1383c37c3f7b7522b12b5f57108ba78cba43b035b35e26f9ea85a09f2ee0aa332ccefb6508e9dcfaeaf0dca52218ca3324a990d20dc96932076c72750e7eed5f