omf_ec 6.1.9 → 6.1.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/omf_ec/backward/dsl.rb +1 -0
- data/lib/omf_ec/dsl.rb +29 -7
- data/lib/omf_ec/experiment.rb +2 -1
- data/lib/omf_ec/runner.rb +5 -0
- metadata +4 -4
data/lib/omf_ec/backward/dsl.rb
CHANGED
data/lib/omf_ec/dsl.rb
CHANGED
@@ -10,6 +10,8 @@ require 'eventmachine'
|
|
10
10
|
require 'uri'
|
11
11
|
require 'open-uri'
|
12
12
|
require 'tempfile'
|
13
|
+
require 'json'
|
14
|
+
require 'net/http'
|
13
15
|
|
14
16
|
module OmfEc
|
15
17
|
# DSL methods to be used for OEDL scripts
|
@@ -338,8 +340,6 @@ module OmfEc
|
|
338
340
|
#
|
339
341
|
def def_query(query)
|
340
342
|
raise "No valid URL to connect to the Job Service!" if OmfEc.experiment.job_url.nil?
|
341
|
-
require 'json'
|
342
|
-
require 'net/http'
|
343
343
|
begin
|
344
344
|
query = query.sql if query.kind_of? OmfEc::Graph::MSBuilder
|
345
345
|
# Create a Measurement Point for that Job item
|
@@ -359,11 +359,11 @@ module OmfEc
|
|
359
359
|
u = URI.parse(OmfEc.experiment.job_mps[query]+'/data')
|
360
360
|
res = Net::HTTP.get(u)
|
361
361
|
raise "No valid data from the service providing measurements" if res.nil? || res.empty? || !(res.kind_of? String)
|
362
|
-
|
363
|
-
metrics =
|
362
|
+
resjson = JSON.parse(res)
|
363
|
+
metrics = resjson['schema'].map { |e| e[0] }
|
364
364
|
data = []
|
365
|
-
|
366
|
-
row =
|
365
|
+
resjson['data'].each do |a|
|
366
|
+
row = Hashie::Mash.new
|
367
367
|
a.each_index { |i| row[metrics[i].downcase.to_sym] = a[i] }
|
368
368
|
data << row
|
369
369
|
end
|
@@ -371,7 +371,7 @@ module OmfEc
|
|
371
371
|
rescue Exception => ex
|
372
372
|
return nil if ex.kind_of? EOFError
|
373
373
|
error "def_query - #{ex} (#{ex.class})"
|
374
|
-
error "def_query - #{ex.backtrace.join("\n\t")}"
|
374
|
+
#error "def_query - #{ex.backtrace.join("\n\t")}"
|
375
375
|
return nil
|
376
376
|
end
|
377
377
|
end
|
@@ -396,5 +396,27 @@ module OmfEc
|
|
396
396
|
msb
|
397
397
|
end
|
398
398
|
|
399
|
+
# Query a Slice Service to get back the list of resources which were
|
400
|
+
# previously provisioned for the slice within which this EC is operating.
|
401
|
+
# Return either an empty array or an array of Hash (actually Hashie::Mash)
|
402
|
+
# Require that the EC was provided an URL to a slice service (option
|
403
|
+
# --slice-service) and the name of the slice (option --slice).
|
404
|
+
#
|
405
|
+
def get_resources
|
406
|
+
begin
|
407
|
+
#slice_url = "http://bleeding.mytestbed.net:8006/slices/"
|
408
|
+
raise "No slice service URL, use '--slice-service' option" if OmfEc.experiment.ss_url.nil?
|
409
|
+
raise "No slice name, use '--slice' option" if OmfEc.experiment.sliceID.nil?
|
410
|
+
u = URI.parse(OmfEc.experiment.ss_url+'/'+OmfEc.experiment.sliceID+'/resources')
|
411
|
+
res = Net::HTTP.get(u)
|
412
|
+
raise "Could not retrieve a valid list of resources from '#{u}'" if res.nil? || res.empty? || !(res.kind_of? String)
|
413
|
+
Hashie::Mash.new(JSON.parse(res)).values
|
414
|
+
rescue Exception => ex
|
415
|
+
error "get_resources - #{ex} (#{ex.class}) - URI: '#{u}'"
|
416
|
+
#error "get_resources - #{ex.backtrace.join("\n\t")}"
|
417
|
+
return []
|
418
|
+
end
|
419
|
+
end
|
420
|
+
|
399
421
|
end
|
400
422
|
end
|
data/lib/omf_ec/experiment.rb
CHANGED
@@ -16,7 +16,7 @@ module OmfEc
|
|
16
16
|
|
17
17
|
include MonitorMixin
|
18
18
|
|
19
|
-
attr_accessor :name, :sliceID, :oml_uri, :js_url, :job_url, :job_mps, :app_definitions, :property, :cmdline_properties, :show_graph, :nodes
|
19
|
+
attr_accessor :name, :sliceID, :oml_uri, :js_url, :ss_url, :job_url, :job_mps, :app_definitions, :property, :cmdline_properties, :show_graph, :nodes
|
20
20
|
attr_reader :groups, :sub_groups, :state
|
21
21
|
|
22
22
|
# MP only used for injecting metadata
|
@@ -44,6 +44,7 @@ module OmfEc
|
|
44
44
|
@js_url = nil
|
45
45
|
@job_url = nil
|
46
46
|
@job_mps = {}
|
47
|
+
@ss_url = nil
|
47
48
|
end
|
48
49
|
|
49
50
|
def property
|
data/lib/omf_ec/runner.rb
CHANGED
@@ -113,6 +113,11 @@ module OmfEc
|
|
113
113
|
remove_cmd_opts_from_argv("--job-url", url)
|
114
114
|
end
|
115
115
|
|
116
|
+
op.on("--slice-service URL", "URL to the SliceService [optional]") do |url|
|
117
|
+
OmfEc.experiment.ss_url = url
|
118
|
+
remove_cmd_opts_from_argv("--slice-service", url)
|
119
|
+
end
|
120
|
+
|
116
121
|
op.on("--oml_uri URI", "URI for the OML data collection of experiment applications") do |uri|
|
117
122
|
@cmd_opts[:oml_uri] = uri
|
118
123
|
remove_cmd_opts_from_argv("--oml_uri", uri)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omf_ec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.1.
|
4
|
+
version: 6.1.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
requirements:
|
99
99
|
- - '='
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: 6.1.
|
101
|
+
version: 6.1.10
|
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.1.
|
109
|
+
version: 6.1.10
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
111
|
name: sequel
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -204,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
204
204
|
version: '0'
|
205
205
|
segments:
|
206
206
|
- 0
|
207
|
-
hash:
|
207
|
+
hash: -2796515617465100587
|
208
208
|
requirements: []
|
209
209
|
rubyforge_project: omf_ec
|
210
210
|
rubygems_version: 1.8.23
|