omf_ec 6.1.14.pre.2 → 6.2.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzhmY2EwMWI2NzVmM2E2ODY4Njc1YmNjMjViNTJhMWFhZjAwZDZlZg==
4
+ NzI2OTEzMjIyZDBiODExNzIwNDQzYjAyOThjZjlkODU0YjY0ZDIzNg==
5
5
  data.tar.gz: !binary |-
6
- M2EwN2I5ZmNmZWI0ZGM2YThkMGJjYjk5OTNkYThkODdkMTIxNzJmZQ==
6
+ MzQ4ZDNmYzkwYzM1NjJiOGQwZTE4YTM0NmY2ZmIwYjAwZTljYTdjNg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MWUzMWRhNTBkMjJhMTAyNzBhNjVkNjExOWUzMzA1ZmE0NDgzY2YwMjY1NTEy
10
- NWMwMGRhOTk3YTBmN2M2NWQ3NmNiYjg3YzQ1OWRjNDQ4YTQ3OTkxZjJkYTYx
11
- YmNlM2FmODU0MDIyYjUxMDRhYzQ2YjkyY2NjMTVkY2ZlNzEyOWY=
9
+ MmI2MDA2ZDJjMDkzNDU5MGE2NjdlZDkxMTI5MTliZmI2OWZiNTUyZTZkZWNk
10
+ YzE3MzI2NGU4MTkwMDhkMjVkZmUzZjZlMjUxN2VhZDk2YzRkNzc3MDgwMmQ5
11
+ MmYzOGY2YzgxNmQzMGY5NmU0YzVlZjVmYTU2MTNkNTg1ZmU0NzY=
12
12
  data.tar.gz: !binary |-
13
- MzE5NjRiNmQxMjRjMjI3NGY3NDAzNDQ2YWFhZGJhNjA0NGI4Njk5YTJmNTRk
14
- ZmY3ZmRhOGYwMmU4MTU2MjMzODMyYjgyY2MyMjQxOGFmMjk5ZmQ3MjFmZjU3
15
- NjIwMGU2NmE2N2Q3MDcyOTkxZDZjZmEyNzY1N2FlNmEyY2JkYjE=
13
+ Y2E3ZjcwMWI3N2Y3YjViNTVlMmVkY2JkOGE3MzQ4NzRhNGFiODdmM2Y4ZTM5
14
+ M2E2YTg0ZjA3YmE0NTFkZThiMjQ4OTEwZWNkNmY2MzgwY2Q0ZmY3YWRlYzcy
15
+ NTE0Mzk5OGZlNDE3NjViNWYxNzJkODllNTlmNzQ1YTg4NjQ1ZDI=
data/bin/omf_ec CHANGED
@@ -4,6 +4,9 @@ require 'omf_ec'
4
4
  require 'omf_ec/runner'
5
5
  $stdout.sync = true
6
6
 
7
+ require 'eventmachine'
8
+ EventMachine.threadpool_size = 60
9
+
7
10
  runner = OmfEc::Runner.new
8
11
  runner.init
9
12
  runner.run
@@ -17,7 +17,7 @@ module OmfEc
17
17
  include MonitorMixin
18
18
 
19
19
  attr_accessor :name, :sliceID, :oml_uri, :js_url, :ss_url, :job_url, :job_mps, :app_definitions, :property, :cmdline_properties, :show_graph, :nodes, :assertion
20
- attr_reader :groups, :sub_groups, :state
20
+ attr_reader :groups, :sub_groups
21
21
 
22
22
  # MP only used for injecting metadata
23
23
  class MetaData < OML4R::MPBase
@@ -33,7 +33,7 @@ module OmfEc
33
33
  super
34
34
  @id = Time.now.utc.iso8601(3)
35
35
  @sliceID = nil
36
- @state ||= [] #TODO: we need to keep history of all the events and not ovewrite them
36
+ @state ||= Hashie::Mash.new #TODO: we need to keep history of all the events and not ovewrite them
37
37
  @groups ||= []
38
38
  @nodes ||= []
39
39
  @events ||= []
@@ -47,6 +47,10 @@ module OmfEc
47
47
  @ss_url = nil
48
48
  end
49
49
 
50
+ def state
51
+ @state.values
52
+ end
53
+
50
54
  def property
51
55
  return ExperimentProperty
52
56
  end
@@ -58,13 +62,13 @@ module OmfEc
58
62
  end
59
63
 
60
64
  def resource_state(address)
61
- @state.find { |v| v[:address].to_s == address.to_s }
65
+ @state[address]
62
66
  end
63
67
 
64
68
  alias_method :resource, :resource_state
65
69
 
66
70
  def resource_by_hrn(hrn)
67
- @state.find { |v| v[:hrn].to_s == hrn.to_s }
71
+ @state[hrn]
68
72
  end
69
73
 
70
74
  def add_or_update_resource_state(name, opts = {})
@@ -79,7 +83,7 @@ module OmfEc
79
83
  res[key].uniq!
80
84
  elsif value.kind_of? Hash
81
85
  # Merge hash values
82
- res[key] ||= Hashie::Mash.new
86
+ res[key] ||= {}
83
87
  res[key].merge!(value)
84
88
  else
85
89
  # Overwrite otherwise
@@ -88,18 +92,19 @@ module OmfEc
88
92
  end
89
93
  else
90
94
  info "Newly discovered resource >> #{name}"
91
- res = Hashie::Mash.new({ address: name }).merge(opts)
92
- @state << res
95
+ #res = Hashie::Mash.new({ address: name }).merge(opts)
96
+ opts[:address] = name
97
+ @state[name] = opts
93
98
 
94
99
  # Re send membership configure
95
- planned_groups = groups_by_res(res[:address])
96
-
97
- unless planned_groups.empty?
98
- OmfEc.subscribe_and_monitor(name) do |res|
99
- info "Config #{name} to join #{planned_groups.map(&:name).join(', ')}"
100
- res.configure({ membership: planned_groups.map(&:address) }, { assert: OmfEc.experiment.assertion } )
101
- end
102
- end
100
+ #planned_groups = groups_by_res(name)
101
+
102
+ #unless planned_groups.empty?
103
+ # OmfEc.subscribe_and_monitor(name) do |res|
104
+ # info "Config #{name} to join #{planned_groups.map(&:name).join(', ')}"
105
+ # res.configure({ membership: planned_groups.map(&:address) }, { assert: OmfEc.experiment.assertion } )
106
+ # end
107
+ #end
103
108
  end
104
109
  end
105
110
  end
@@ -200,7 +205,7 @@ module OmfEc
200
205
  end
201
206
 
202
207
  def eval_trigger(event)
203
- if event[:callbacks] && !event[:callbacks].empty? && event[:trigger].call(@state)
208
+ if event[:callbacks] && !event[:callbacks].empty? && event[:trigger].call(state)
204
209
  # Periodic check event
205
210
  event[:periodic_timer].cancel if event[:periodic_timer] && event[:consume_event]
206
211
 
data/lib/omf_ec/runner.rb CHANGED
@@ -301,6 +301,12 @@ module OmfEc
301
301
  OmfCommon.init(@config_opts.delete(:environment), @config_opts) do |el|
302
302
  setup_logging
303
303
  OmfCommon.comm.on_connected do |comm|
304
+ el.every(5) do
305
+ EM.next_tick do
306
+ OmfEc.experiment.process_events rescue nil
307
+ end
308
+ end
309
+
304
310
  info "OMF Experiment Controller #{OmfEc::VERSION} - Start"
305
311
  info "Connected using #{comm.conn_info}"
306
312
  info "Execute: #{@oedl_path}"
data/lib/omf_ec.rb CHANGED
@@ -68,14 +68,14 @@ module OmfEc
68
68
  when 'STATUS'
69
69
  props = []
70
70
  msg.each_property { |k, v| props << "#{k}: #{v}" }
71
- debug "Received INFORM via #{topic.id} >> #{props.join(", ")}", msg.src
71
+ #debug "Received INFORM via #{topic.id} >> #{props.join(", ")}", msg.src
72
72
 
73
73
  if msg[:status_type] == 'APP_EVENT'
74
74
  info "APP_EVENT #{msg[:event]} from app #{msg[:app]} - msg: #{msg[:msg]}"
75
75
  end
76
76
 
77
77
  OmfEc.experiment.add_or_update_resource_state(msg.src, msg.properties)
78
- OmfEc.experiment.process_events
78
+ #OmfEc.experiment.process_events
79
79
  end
80
80
  end
81
81
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omf_ec
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.14.pre.2
4
+ version: 6.2.0.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - NICTA
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-20 00:00:00.000000000 Z
11
+ date: 2015-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: 6.1.14.pre.2
89
+ version: 6.2.0.pre.1
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 6.1.14.pre.2
96
+ version: 6.2.0.pre.1
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: sequel
99
99
  requirement: !ruby/object:Gem::Requirement