isono 0.2.20 → 0.2.21

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -19,7 +19,7 @@ task :gem do
19
19
  s.required_ruby_version = '>= 1.9.2'
20
20
  s.rubyforge_project = 'isono'
21
21
 
22
- s.files = `git ls-files -c`.split("\n")
22
+ s.files = [%q{LICENSE}, %q{NOTICE}, %q{Rakefile}, %q{isono.gemspec}] + Dir['lib/**/*.rb', 'spec/*.rb', 'tasks/*.rake', 'bin/cli']
23
23
 
24
24
  s.bindir='bin'
25
25
  s.executables = %w(cli)
@@ -2,23 +2,23 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "isono"
5
- s.version = "0.2.20"
5
+ s.version = "0.2.21"
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 = "2013-06-20"
9
+ s.date = "2018-02-05"
10
10
  s.email = ["dev@axsh.net", "m-fujiwara@axsh.net"]
11
11
  s.executables = ["cli"]
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"]
12
+ s.files = ["LICENSE", "NOTICE", "Rakefile", "isono.gemspec", "lib/isono/manifest.rb", "lib/isono/node_modules/job_channel.rb", "lib/isono/node_modules/node_collector.rb", "lib/isono/node_modules/event_channel.rb", "lib/isono/node_modules/data_store.rb", "lib/isono/node_modules/job_collector.rb", "lib/isono/node_modules/base.rb", "lib/isono/node_modules/rpc_channel.rb", "lib/isono/node_modules/job_worker.rb", "lib/isono/node_modules/node_heartbeat.rb", "lib/isono/node_modules/event_logger.rb", "lib/isono/models/resource_instance.rb", "lib/isono/models/job_state.rb", "lib/isono/models/node_state.rb", "lib/isono/models/event_log.rb", "lib/isono/rack.rb", "lib/isono/logger.rb", "lib/isono/resource_manifest.rb", "lib/isono/util.rb", "lib/isono/daemonize.rb", "lib/isono/runner/rpc_server.rb", "lib/isono/runner/base.rb", "lib/isono/runner/cli.rb", "lib/isono/node.rb", "lib/isono/amqp_client.rb", "lib/isono/version.rb", "lib/isono/event_observable.rb", "lib/isono/rack/thread_pass.rb", "lib/isono/rack/data_store.rb", "lib/isono/rack/builder.rb", "lib/isono/rack/object_method.rb", "lib/isono/rack/map.rb", "lib/isono/rack/proc.rb", "lib/isono/rack/job.rb", "lib/isono/rack/sequel.rb", "lib/isono/messaging_client.rb", "lib/isono/thread_pool.rb", "lib/isono/event_delegate_context.rb", "lib/isono/serializer.rb", "lib/isono.rb", "lib/ext/shellwords.rb", "spec/event_observable_spec.rb", "spec/amqp_client_spec.rb", "spec/manifest_spec.rb", "spec/logger_spec.rb", "spec/file_channel_spec.rb", "spec/spec_helper.rb", "spec/job_channel_spec.rb", "spec/rpc_channel_spec.rb", "spec/node_spec.rb", "spec/resource_loader_spec.rb", "spec/util_spec.rb", "spec/thread_pool_spec.rb", "tasks/load_resource_manifest.rake", "bin/cli"]
13
13
  s.homepage = "http://github.com/axsh/isono"
14
14
  s.require_paths = ["lib"]
15
15
  s.required_ruby_version = Gem::Requirement.new(">= 1.9.2")
16
16
  s.rubyforge_project = "isono"
17
- s.rubygems_version = "2.0.3"
17
+ s.rubygems_version = "1.8.23"
18
18
  s.summary = "Messaging and agent fabric"
19
19
 
20
20
  if s.respond_to? :specification_version then
21
- s.specification_version = 4
21
+ s.specification_version = 3
22
22
 
23
23
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
24
24
  s.add_runtime_dependency(%q<amqp>, ["= 0.7.4"])
@@ -26,7 +26,7 @@ module Isono
26
26
 
27
27
  def process_event(ev, *args)
28
28
  case [ev, self.state.to_sym]
29
- when [:on_ping, :online], [:on_ping, :init], [:on_ping, :timeout]
29
+ when [:on_ping, :online], [:on_ping, :init], [:on_ping, :timeout], [:on_ping, :offline]
30
30
  self.state = :online
31
31
  self.last_ping_at = Time.now
32
32
  when [:on_unmonitor, :online]
@@ -26,6 +26,9 @@ module Isono
26
26
  DataStore.logger.info("disconnected database connection: #{v}")
27
27
  }
28
28
  }
29
+
30
+ desc "database thread number"
31
+ database_thread 10
29
32
  end
30
33
 
31
34
 
@@ -65,7 +68,7 @@ module Isono
65
68
  attr_reader :db_writer_thread
66
69
 
67
70
  initialize_hook do
68
- @db_writer_thread = ThreadPool.new(1, 'DataStore')
71
+ @db_writer_thread = ThreadPool.new(config_section.database_thread.to_i, 'DataStore')
69
72
  DataStore.create_instance(node)
70
73
  end
71
74
 
@@ -4,10 +4,17 @@ module Isono
4
4
  module NodeModules
5
5
  class JobCollector < Base
6
6
 
7
+ config_section do
8
+ desc "count to send sql."
9
+ retry_count 3
10
+ desc "second(s) to wait until send the next sql."
11
+ wait_time_sec 1
12
+ end
13
+
7
14
  initialize_hook do
8
15
  rpc = RpcChannel.new(node)
9
16
 
10
- app = Rack::DataStore.new(Dispatch.new)
17
+ app = Rack::DataStore.new(Dispatch.new(config_section.retry_count, config_section.wait_time_sec))
11
18
 
12
19
  rpc.register_endpoint('job-collector', app)
13
20
  end
@@ -16,10 +23,28 @@ module Isono
16
23
  end
17
24
 
18
25
  class Dispatch
26
+ def initialize(retry_count, wait_time_sec)
27
+ @retry_count = retry_count
28
+ @wait_time_sec = wait_time_sec
29
+
30
+ end
31
+
19
32
  def record
20
33
  params = @req.args[0]
21
34
  params[:node_id]=@req.sender
22
- job =Models::JobState.find_or_create(:job_id=>params[:job_id])
35
+
36
+ retry_count = 0
37
+ begin
38
+ job = Models::JobState.find_or_create(:job_id=>params[:job_id])
39
+ rescue Sequel::DatabaseError, Sequel::DatabaseConnectionError => e
40
+ if retry_count <= @retry_count.to_i
41
+ retry_count += 1
42
+ sleep @wait_time_sec.to_i
43
+ retry
44
+ else
45
+ raise e
46
+ end
47
+ end
23
48
  job.set_fields(params, [:parent_job_id, :session_id, :node_id, :state, :started_at, :finished_at, :job_name]).save_changes
24
49
  end
25
50
 
@@ -8,8 +8,10 @@ module Isono
8
8
  config_section do
9
9
  desc "time in second to recognize if the agent is timed out"
10
10
  timeout_sec (10*2).to_f
11
+ desc "time in second to recognize if the agent is offline"
12
+ offline_sec (10*2*2).to_f
11
13
  desc "the agent to be killed from the datasource after the time of second"
12
- kill_sec (10*2*2).to_f
14
+ kill_sec (10*2*2*8).to_f
13
15
  desc ""
14
16
  gc_period 20.0
15
17
  end
@@ -30,18 +32,20 @@ module Isono
30
32
  # http://www.mail-archive.com/sqlite-users@sqlite.org/msg03328.html
31
33
  # TODO: paging support for the large result set.
32
34
  Models::NodeState.dataset.all.each { |row|
33
- next if row.state == :offline
34
-
35
35
  diff_time = Time.now - row[:last_ping_at]
36
- if row.state != :timeout && diff_time > config_section.timeout_sec
36
+ if row.state != "timeout" && row.state != "offline" && diff_time > config_section.timeout_sec
37
37
  row.process_event(:on_timeout)
38
38
  row.save_changes
39
39
  event.publish('node_collector/timedout', :args=>[row.values])
40
40
  end
41
-
42
- if diff_time > config_section.kill_sec
41
+
42
+ if row.state != "offline" && diff_time > config_section.offline_sec
43
43
  row.process_event(:on_unmonitor)
44
+ row.save_changes
45
+ event.publish('node_collector/offline', :args=>[row.values])
46
+ end
44
47
 
48
+ if diff_time > config_section.kill_sec
45
49
  event.publish('node_collector/killed', :args=>[row.values])
46
50
  row.destroy
47
51
  end
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  module Isono
4
- VERSION='0.2.19'
4
+ VERSION='0.2.21'
5
5
  end
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isono
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.20
4
+ version: 0.2.21
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - axsh Ltd.
@@ -9,11 +10,12 @@ authors:
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2013-06-20 00:00:00.000000000 Z
13
+ date: 2018-02-05 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: amqp
16
17
  requirement: !ruby/object:Gem::Requirement
18
+ none: false
17
19
  requirements:
18
20
  - - '='
19
21
  - !ruby/object:Gem::Version
@@ -21,6 +23,7 @@ dependencies:
21
23
  type: :runtime
22
24
  prerelease: false
23
25
  version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
24
27
  requirements:
25
28
  - - '='
26
29
  - !ruby/object:Gem::Version
@@ -28,6 +31,7 @@ dependencies:
28
31
  - !ruby/object:Gem::Dependency
29
32
  name: eventmachine
30
33
  requirement: !ruby/object:Gem::Requirement
34
+ none: false
31
35
  requirements:
32
36
  - - ~>
33
37
  - !ruby/object:Gem::Version
@@ -35,6 +39,7 @@ dependencies:
35
39
  type: :runtime
36
40
  prerelease: false
37
41
  version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
38
43
  requirements:
39
44
  - - ~>
40
45
  - !ruby/object:Gem::Version
@@ -42,43 +47,49 @@ dependencies:
42
47
  - !ruby/object:Gem::Dependency
43
48
  name: log4r
44
49
  requirement: !ruby/object:Gem::Requirement
50
+ none: false
45
51
  requirements:
46
- - - '>='
52
+ - - ! '>='
47
53
  - !ruby/object:Gem::Version
48
54
  version: '0'
49
55
  type: :runtime
50
56
  prerelease: false
51
57
  version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
52
59
  requirements:
53
- - - '>='
60
+ - - ! '>='
54
61
  - !ruby/object:Gem::Version
55
62
  version: '0'
56
63
  - !ruby/object:Gem::Dependency
57
64
  name: bacon
58
65
  requirement: !ruby/object:Gem::Requirement
66
+ none: false
59
67
  requirements:
60
- - - '>='
68
+ - - ! '>='
61
69
  - !ruby/object:Gem::Version
62
70
  version: '0'
63
71
  type: :development
64
72
  prerelease: false
65
73
  version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
66
75
  requirements:
67
- - - '>='
76
+ - - ! '>='
68
77
  - !ruby/object:Gem::Version
69
78
  version: '0'
70
79
  - !ruby/object:Gem::Dependency
71
80
  name: rake
72
81
  requirement: !ruby/object:Gem::Requirement
82
+ none: false
73
83
  requirements:
74
- - - '>='
84
+ - - ! '>='
75
85
  - !ruby/object:Gem::Version
76
86
  version: '0'
77
87
  type: :development
78
88
  prerelease: false
79
89
  version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
80
91
  requirements:
81
- - - '>='
92
+ - - ! '>='
82
93
  - !ruby/object:Gem::Version
83
94
  version: '0'
84
95
  description:
@@ -90,87 +101,87 @@ executables:
90
101
  extensions: []
91
102
  extra_rdoc_files: []
92
103
  files:
93
- - .gitignore
94
104
  - LICENSE
95
105
  - NOTICE
96
106
  - Rakefile
97
- - bin/cli
98
107
  - isono.gemspec
99
- - lib/ext/shellwords.rb
100
- - lib/isono.rb
101
- - lib/isono/amqp_client.rb
102
- - lib/isono/daemonize.rb
103
- - lib/isono/event_delegate_context.rb
104
- - lib/isono/event_observable.rb
105
- - lib/isono/logger.rb
106
108
  - lib/isono/manifest.rb
107
- - lib/isono/messaging_client.rb
108
- - lib/isono/models/event_log.rb
109
- - lib/isono/models/job_state.rb
110
- - lib/isono/models/node_state.rb
111
- - lib/isono/models/resource_instance.rb
112
- - lib/isono/node.rb
113
- - lib/isono/node_modules/base.rb
114
- - lib/isono/node_modules/data_store.rb
115
- - lib/isono/node_modules/event_channel.rb
116
- - lib/isono/node_modules/event_logger.rb
117
109
  - lib/isono/node_modules/job_channel.rb
110
+ - lib/isono/node_modules/node_collector.rb
111
+ - lib/isono/node_modules/event_channel.rb
112
+ - lib/isono/node_modules/data_store.rb
118
113
  - lib/isono/node_modules/job_collector.rb
114
+ - lib/isono/node_modules/base.rb
115
+ - lib/isono/node_modules/rpc_channel.rb
119
116
  - lib/isono/node_modules/job_worker.rb
120
- - lib/isono/node_modules/node_collector.rb
121
117
  - lib/isono/node_modules/node_heartbeat.rb
122
- - lib/isono/node_modules/rpc_channel.rb
118
+ - lib/isono/node_modules/event_logger.rb
119
+ - lib/isono/models/resource_instance.rb
120
+ - lib/isono/models/job_state.rb
121
+ - lib/isono/models/node_state.rb
122
+ - lib/isono/models/event_log.rb
123
123
  - lib/isono/rack.rb
124
- - lib/isono/rack/builder.rb
124
+ - lib/isono/logger.rb
125
+ - lib/isono/resource_manifest.rb
126
+ - lib/isono/util.rb
127
+ - lib/isono/daemonize.rb
128
+ - lib/isono/runner/rpc_server.rb
129
+ - lib/isono/runner/base.rb
130
+ - lib/isono/runner/cli.rb
131
+ - lib/isono/node.rb
132
+ - lib/isono/amqp_client.rb
133
+ - lib/isono/version.rb
134
+ - lib/isono/event_observable.rb
135
+ - lib/isono/rack/thread_pass.rb
125
136
  - lib/isono/rack/data_store.rb
126
- - lib/isono/rack/job.rb
127
- - lib/isono/rack/map.rb
137
+ - lib/isono/rack/builder.rb
128
138
  - lib/isono/rack/object_method.rb
139
+ - lib/isono/rack/map.rb
129
140
  - lib/isono/rack/proc.rb
141
+ - lib/isono/rack/job.rb
130
142
  - lib/isono/rack/sequel.rb
131
- - lib/isono/rack/thread_pass.rb
132
- - lib/isono/resource_manifest.rb
133
- - lib/isono/runner/base.rb
134
- - lib/isono/runner/cli.rb
135
- - lib/isono/runner/rpc_server.rb
136
- - lib/isono/serializer.rb
143
+ - lib/isono/messaging_client.rb
137
144
  - lib/isono/thread_pool.rb
138
- - lib/isono/util.rb
139
- - lib/isono/version.rb
140
- - spec/amqp_client_spec.rb
145
+ - lib/isono/event_delegate_context.rb
146
+ - lib/isono/serializer.rb
147
+ - lib/isono.rb
148
+ - lib/ext/shellwords.rb
141
149
  - spec/event_observable_spec.rb
150
+ - spec/amqp_client_spec.rb
151
+ - spec/manifest_spec.rb
152
+ - spec/logger_spec.rb
142
153
  - spec/file_channel_spec.rb
154
+ - spec/spec_helper.rb
143
155
  - spec/job_channel_spec.rb
144
- - spec/logger_spec.rb
145
- - spec/manifest_spec.rb
156
+ - spec/rpc_channel_spec.rb
146
157
  - spec/node_spec.rb
147
158
  - spec/resource_loader_spec.rb
148
- - spec/rpc_channel_spec.rb
149
- - spec/spec_helper.rb
150
- - spec/thread_pool_spec.rb
151
159
  - spec/util_spec.rb
160
+ - spec/thread_pool_spec.rb
152
161
  - tasks/load_resource_manifest.rake
162
+ - bin/cli
153
163
  homepage: http://github.com/axsh/isono
154
164
  licenses: []
155
- metadata: {}
156
165
  post_install_message:
157
166
  rdoc_options: []
158
167
  require_paths:
159
168
  - lib
160
169
  required_ruby_version: !ruby/object:Gem::Requirement
170
+ none: false
161
171
  requirements:
162
- - - '>='
172
+ - - ! '>='
163
173
  - !ruby/object:Gem::Version
164
174
  version: 1.9.2
165
175
  required_rubygems_version: !ruby/object:Gem::Requirement
176
+ none: false
166
177
  requirements:
167
- - - '>='
178
+ - - ! '>='
168
179
  - !ruby/object:Gem::Version
169
180
  version: '0'
170
181
  requirements: []
171
182
  rubyforge_project: isono
172
- rubygems_version: 2.0.3
183
+ rubygems_version: 1.8.23
173
184
  signing_key:
174
- specification_version: 4
185
+ specification_version: 3
175
186
  summary: Messaging and agent fabric
176
187
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 1e666f9b342338026fe08b4880bf74dfb60673f8
4
- data.tar.gz: a1127479b2ad3c83acff866011b1eaee1286907e
5
- SHA512:
6
- metadata.gz: 6271d86c5ec057bf267a3bc4322f19fdc83187d9ae1635691757a878688a66c67fa2a00d099cf9c3d7347feecd8e7ba99c3caec1d3f8522c76226a8f8af0a79c
7
- data.tar.gz: 7ce671336b7e6bb8db77aaa8782445ce15ba1920f90ece1ce7cdf5edde5374697f0080995b9df0df64756bd7b4a42f8e0351e8d40f24da87276f0f282f864461
data/.gitignore DELETED
@@ -1,2 +0,0 @@
1
- *~
2
- #*#