isono 0.2.16 → 0.2.17
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/isono.gemspec +2 -2
- data/lib/isono.rb +8 -0
- data/lib/isono/amqp_client.rb +12 -17
- data/lib/isono/node_modules/job_worker.rb +1 -1
- data/lib/isono/node_modules/rpc_channel.rb +7 -3
- data/lib/isono/version.rb +1 -1
- metadata +2 -2
data/isono.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "isono"
|
5
|
-
s.version = "0.2.
|
5
|
+
s.version = "0.2.17"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["axsh Ltd.", "Masahiro Fujiwara"]
|
9
|
-
s.date = "2012-10-
|
9
|
+
s.date = "2012-10-05"
|
10
10
|
s.email = ["dev@axsh.net", "m-fujiwara@axsh.net"]
|
11
11
|
s.executables = ["cli"]
|
12
12
|
s.files = [".gitignore", "LICENSE", "NOTICE", "Rakefile", "bin/cli", "isono.gemspec", "lib/ext/shellwords.rb", "lib/isono.rb", "lib/isono/amqp_client.rb", "lib/isono/daemonize.rb", "lib/isono/event_delegate_context.rb", "lib/isono/event_observable.rb", "lib/isono/logger.rb", "lib/isono/manifest.rb", "lib/isono/messaging_client.rb", "lib/isono/models/event_log.rb", "lib/isono/models/job_state.rb", "lib/isono/models/node_state.rb", "lib/isono/models/resource_instance.rb", "lib/isono/node.rb", "lib/isono/node_modules/base.rb", "lib/isono/node_modules/data_store.rb", "lib/isono/node_modules/event_channel.rb", "lib/isono/node_modules/event_logger.rb", "lib/isono/node_modules/job_channel.rb", "lib/isono/node_modules/job_collector.rb", "lib/isono/node_modules/job_worker.rb", "lib/isono/node_modules/node_collector.rb", "lib/isono/node_modules/node_heartbeat.rb", "lib/isono/node_modules/rpc_channel.rb", "lib/isono/rack.rb", "lib/isono/rack/builder.rb", "lib/isono/rack/data_store.rb", "lib/isono/rack/job.rb", "lib/isono/rack/map.rb", "lib/isono/rack/object_method.rb", "lib/isono/rack/proc.rb", "lib/isono/rack/sequel.rb", "lib/isono/rack/thread_pass.rb", "lib/isono/resource_manifest.rb", "lib/isono/runner/base.rb", "lib/isono/runner/cli.rb", "lib/isono/runner/rpc_server.rb", "lib/isono/serializer.rb", "lib/isono/thread_pool.rb", "lib/isono/util.rb", "lib/isono/version.rb", "spec/amqp_client_spec.rb", "spec/event_observable_spec.rb", "spec/file_channel_spec.rb", "spec/job_channel_spec.rb", "spec/logger_spec.rb", "spec/manifest_spec.rb", "spec/node_spec.rb", "spec/resource_loader_spec.rb", "spec/rpc_channel_spec.rb", "spec/spec_helper.rb", "spec/thread_pool_spec.rb", "spec/util_spec.rb", "tasks/load_resource_manifest.rake"]
|
data/lib/isono.rb
CHANGED
data/lib/isono/amqp_client.rb
CHANGED
@@ -77,6 +77,14 @@ module Isono
|
|
77
77
|
def settings
|
78
78
|
@settings
|
79
79
|
end
|
80
|
+
|
81
|
+
@on_disconnect = Proc.new do
|
82
|
+
# This block will be executed when you start the Agent if the AMQP server has been stopped.
|
83
|
+
Isono.at_disconnected.each do |blk|
|
84
|
+
blk.call
|
85
|
+
end
|
86
|
+
blk.call(:error)
|
87
|
+
end
|
80
88
|
}
|
81
89
|
@amqp_client.connection_status { |t|
|
82
90
|
case t
|
@@ -84,7 +92,11 @@ module Isono
|
|
84
92
|
# here is tried also when reconnected
|
85
93
|
on_connect
|
86
94
|
when :disconnected
|
95
|
+
# This block is executed if the AMQP server goes down during startup.
|
87
96
|
on_disconnected
|
97
|
+
Isono.at_disconnected.each do |blk|
|
98
|
+
blk.call
|
99
|
+
end
|
88
100
|
end
|
89
101
|
}
|
90
102
|
# the block argument is called once at the initial connection.
|
@@ -94,10 +106,6 @@ module Isono
|
|
94
106
|
blk.arity == 1 ? blk.call(self) : blk.call
|
95
107
|
end
|
96
108
|
}
|
97
|
-
@amqp_client.errback {
|
98
|
-
logger.error("Failed to connect to the broker: #{amqp_server_uri}")
|
99
|
-
blk.call(self) if blk && blk.arity == 1
|
100
|
-
}
|
101
109
|
}
|
102
110
|
self
|
103
111
|
end
|
@@ -115,19 +123,6 @@ module Isono
|
|
115
123
|
end
|
116
124
|
|
117
125
|
def on_disconnected
|
118
|
-
logger.info("AMQP connection disconnected")
|
119
|
-
prepare_close {
|
120
|
-
@amqp_client.close {
|
121
|
-
begin
|
122
|
-
on_close
|
123
|
-
after_close
|
124
|
-
ensure
|
125
|
-
@amqp_client = nil
|
126
|
-
Thread.current[:mq] = nil
|
127
|
-
EM.stop { exit }
|
128
|
-
end
|
129
|
-
}
|
130
|
-
}
|
131
126
|
end
|
132
127
|
|
133
128
|
def on_close
|
@@ -203,10 +203,14 @@ module Isono
|
|
203
203
|
}
|
204
204
|
ch.prefetch(opts[:prefetch].to_i) if opts[:prefetch].to_i > 0
|
205
205
|
# stores hash here that is for thread safety.
|
206
|
-
|
206
|
+
if !@endpoints.nil?
|
207
|
+
@endpoints[endpoint]={:app=>app, :opts=>opts, :ch=>ch}
|
207
208
|
|
208
|
-
|
209
|
-
|
209
|
+
ch.endpoint_queue.subscribe(:ack=>true, &endpoint_proc)
|
210
|
+
event.publish('rpc/register', :args=>[endpoint])
|
211
|
+
else
|
212
|
+
logger.error("No such endpoints")
|
213
|
+
end
|
210
214
|
}
|
211
215
|
end
|
212
216
|
|
data/lib/isono/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isono
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.17
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-10-
|
13
|
+
date: 2012-10-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: amqp
|