cuboid 0.1.9.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +13 -40
- data/lib/cuboid/processes/agents.rb +2 -1
- data/lib/cuboid/processes/instances.rb +2 -1
- data/lib/cuboid/processes/manager.rb +3 -0
- data/lib/cuboid/processes/schedulers.rb +2 -1
- data/lib/cuboid/rest/server/instance_helpers.rb +1 -1
- data/lib/cuboid/rest/server.rb +3 -3
- data/lib/cuboid/rpc/server/agent.rb +2 -1
- data/lib/cuboid/rpc/server/scheduler.rb +1 -0
- data/lib/version +1 -1
- data/spec/cuboid/rest/server_spec.rb +7 -7
- data/spec/cuboid/rpc/client/dispatcher_spec.rb +1 -1
- data/spec/cuboid/rpc/client/instance_spec.rb +1 -1
- data/spec/cuboid/rpc/server/active_options_spec.rb +2 -2
- data/spec/cuboid/rpc/server/agent/node_spec.rb +1 -1
- data/spec/cuboid/rpc/server/agent/service_spec.rb +1 -1
- data/spec/cuboid/rpc/server/agent_spec.rb +36 -24
- data/spec/cuboid/rpc/server/instance_spec.rb +4 -3
- data/spec/cuboid/rpc/server/scheduler_spec.rb +5 -5
- metadata +76 -76
- /data/lib/cuboid/rest/server/routes/{dispatcher.rb → agent.rb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d452104d0d455211aced569b7a63544d2484ce6173afc1e0d8a71b6ac24f2a9
|
4
|
+
data.tar.gz: 47e043271597349e69ace3af0f8b7a1da1087ab42ff36ec857a761f22bea656e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ee8ac9a121c0b8fc4e95b26e353d315c643e7a76887253036072635a43135bd000e8f3a399eff1d6c52f239ca50aacd6d4ac99c05a0df92e1ef7b0655859f31
|
7
|
+
data.tar.gz: abd3dbe0dbec5384877559317889f1203fc42ed38ae3e65d268b785b52bb6c7a6ea6f037a69a7f0c20e355cffeb09fc3fa83d8de9a9804682c69dbf5c3490150
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -23,7 +23,7 @@ It offers:
|
|
23
23
|
* Suspend to disk is a cinch by automatically creating a _**snapshot**_
|
24
24
|
of the runtime environment of the application and storing it to disk
|
25
25
|
for later restoration of state and data.
|
26
|
-
* Also allows for running job transfers
|
26
|
+
* **Also allows for running job transfers.**
|
27
27
|
* Management of Instances via RPC or REST APIs.
|
28
28
|
* Aside from what **Cuboid** uses, custom serializers can be specified for
|
29
29
|
application related objects.
|
@@ -174,6 +174,7 @@ See `examples/my_app`.
|
|
174
174
|
To run code in parallel on the same machine utilising multiple cores, with each
|
175
175
|
instance isolated to its own process, you can use something like the following:
|
176
176
|
|
177
|
+
`sleeper.rb`:
|
177
178
|
```ruby
|
178
179
|
require 'cuboid'
|
179
180
|
|
@@ -184,13 +185,15 @@ class Sleeper < Cuboid::Application
|
|
184
185
|
end
|
185
186
|
|
186
187
|
end
|
188
|
+
```
|
187
189
|
|
188
|
-
|
190
|
+
```ruby
|
191
|
+
require_relative 'sleeper'
|
189
192
|
|
190
193
|
sleepers = []
|
191
|
-
sleepers << Sleeper.spawn( :instance )
|
192
|
-
sleepers << Sleeper.spawn( :instance )
|
193
|
-
sleepers << Sleeper.spawn( :instance )
|
194
|
+
sleepers << Sleeper.spawn( :instance, daemonize: true )
|
195
|
+
sleepers << Sleeper.spawn( :instance, daemonize: true )
|
196
|
+
sleepers << Sleeper.spawn( :instance, daemonize: true )
|
194
197
|
|
195
198
|
sleepers.each do |sleeper|
|
196
199
|
sleeper.run( time: 5 )
|
@@ -212,17 +215,7 @@ In this example we'll be using `Agents` to spawn instances from 3 different host
|
|
212
215
|
#### Host 1
|
213
216
|
|
214
217
|
```ruby
|
215
|
-
|
216
|
-
|
217
|
-
class Sleeper < Cuboid::Application
|
218
|
-
|
219
|
-
def run
|
220
|
-
sleep options['time']
|
221
|
-
end
|
222
|
-
|
223
|
-
end
|
224
|
-
|
225
|
-
return if $0 != __FILE__
|
218
|
+
require_relative 'sleeper'
|
226
219
|
|
227
220
|
Sleeper.spawn( :agent, port: 7331 )
|
228
221
|
```
|
@@ -232,17 +225,7 @@ Sleeper.spawn( :agent, port: 7331 )
|
|
232
225
|
#### Host 2
|
233
226
|
|
234
227
|
```ruby
|
235
|
-
|
236
|
-
|
237
|
-
class Sleeper < Cuboid::Application
|
238
|
-
|
239
|
-
def run
|
240
|
-
sleep options['time']
|
241
|
-
end
|
242
|
-
|
243
|
-
end
|
244
|
-
|
245
|
-
return if $0 != __FILE__
|
228
|
+
require_relative 'sleeper'
|
246
229
|
|
247
230
|
Sleeper.spawn( :agent, port: 7332, peer: 'host1:7331' )
|
248
231
|
```
|
@@ -252,19 +235,9 @@ Sleeper.spawn( :agent, port: 7332, peer: 'host1:7331' )
|
|
252
235
|
#### Host 3
|
253
236
|
|
254
237
|
```ruby
|
255
|
-
|
256
|
-
|
257
|
-
class Sleeper < Cuboid::Application
|
258
|
-
|
259
|
-
def run
|
260
|
-
sleep options['time']
|
261
|
-
end
|
262
|
-
|
263
|
-
end
|
264
|
-
|
265
|
-
return if $0 != __FILE__
|
238
|
+
require_relative 'sleeper'
|
266
239
|
|
267
|
-
grid_agent = Sleeper.spawn( :agent, port: 7333, peer: 'host1:7331' )
|
240
|
+
grid_agent = Sleeper.spawn( :agent, port: 7333, peer: 'host1:7331', daemonize: true )
|
268
241
|
|
269
242
|
sleepers = []
|
270
243
|
3.times do
|
@@ -285,7 +258,7 @@ sleep 0.1 while sleepers.map(&:busy?).include?( true )
|
|
285
258
|
sys 0m0,091s
|
286
259
|
|
287
260
|
|
288
|
-
_You can replace `host1` with `localhost` and run all examples on the same
|
261
|
+
_You can replace `host1` with `localhost` and run all examples on the same machine._
|
289
262
|
|
290
263
|
## License
|
291
264
|
|
@@ -56,6 +56,7 @@ class Agents
|
|
56
56
|
def spawn( options = {} )
|
57
57
|
options = options.dup
|
58
58
|
fork = options.delete(:fork)
|
59
|
+
daemonize = options.delete(:daemonize)
|
59
60
|
|
60
61
|
options[:ssl] ||= {
|
61
62
|
server: {},
|
@@ -92,7 +93,7 @@ class Agents
|
|
92
93
|
options[:agent].delete :peer
|
93
94
|
end
|
94
95
|
|
95
|
-
pid = Manager.spawn( :agent, options: options, fork: fork )
|
96
|
+
pid = Manager.spawn( :agent, options: options, fork: fork, daemonize: daemonize )
|
96
97
|
|
97
98
|
url = "#{options[:rpc][:server_address]}:#{options[:rpc][:server_port]}"
|
98
99
|
while sleep( 0.1 )
|
@@ -65,6 +65,7 @@ class Instances
|
|
65
65
|
token = options.delete(:token) || Utilities.generate_token
|
66
66
|
fork = options.delete(:fork)
|
67
67
|
|
68
|
+
daemonize = options.delete(:daemonize)
|
68
69
|
port_range = options.delete( :port_range )
|
69
70
|
|
70
71
|
options[:ssl] ||= {
|
@@ -99,7 +100,7 @@ class Instances
|
|
99
100
|
url = "#{options[:rpc][:server_address]}:#{options[:rpc][:server_port]}"
|
100
101
|
end
|
101
102
|
|
102
|
-
pid = Manager.spawn( :instance, options: options, token: token, fork: fork )
|
103
|
+
pid = Manager.spawn( :instance, options: options, token: token, fork: fork, daemonize: daemonize )
|
103
104
|
|
104
105
|
System.slots.use pid
|
105
106
|
|
@@ -195,6 +195,7 @@ class Manager
|
|
195
195
|
stdout = options.delete(:stdout)
|
196
196
|
stderr = options.delete(:stderr)
|
197
197
|
new_pgroup = options.delete(:new_pgroup)
|
198
|
+
daemonize = options.delete(:daemonize)
|
198
199
|
|
199
200
|
spawn_options = {}
|
200
201
|
|
@@ -225,6 +226,7 @@ class Manager
|
|
225
226
|
encoded_options = Base64.strict_encode64( Marshal.dump( options ) )
|
226
227
|
argv = [executable, encoded_options]
|
227
228
|
|
229
|
+
|
228
230
|
# It's very, **VERY** important that we use this argument format as
|
229
231
|
# it bypasses the OS shell and we can thus count on a 1-to-1 process
|
230
232
|
# creation and that the PID we get will be for the actual process.
|
@@ -238,6 +240,7 @@ class Manager
|
|
238
240
|
)
|
239
241
|
|
240
242
|
self << pid
|
243
|
+
Process.waitpid( pid ) if !daemonize
|
241
244
|
pid
|
242
245
|
end
|
243
246
|
|
@@ -54,6 +54,7 @@ class Schedulers
|
|
54
54
|
def spawn( options = {} )
|
55
55
|
options = options.dup
|
56
56
|
fork = options.delete(:fork)
|
57
|
+
daemonize = options.delete(:daemonize)
|
57
58
|
|
58
59
|
options[:ssl] ||= {
|
59
60
|
server: {},
|
@@ -81,7 +82,7 @@ class Schedulers
|
|
81
82
|
}
|
82
83
|
}
|
83
84
|
|
84
|
-
pid = Manager.spawn( :scheduler, options: options, fork: fork )
|
85
|
+
pid = Manager.spawn( :scheduler, options: options, fork: fork, daemonize: daemonize )
|
85
86
|
|
86
87
|
url = "#{options[:rpc][:server_address]}:#{options[:rpc][:server_port]}"
|
87
88
|
while sleep( 0.1 )
|
@@ -22,7 +22,7 @@ module InstanceHelpers
|
|
22
22
|
connect_to_instance( info['url'], info['token'] )
|
23
23
|
end
|
24
24
|
else
|
25
|
-
Processes::Instances.spawn( application: Options.paths.application )
|
25
|
+
Processes::Instances.spawn( application: Options.paths.application, daemonize: true )
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
data/lib/cuboid/rest/server.rb
CHANGED
@@ -133,13 +133,13 @@ class Server < Sinatra::Base
|
|
133
133
|
ctx.cert = options[:ssl_certificate]
|
134
134
|
|
135
135
|
if options[:ssl_ca]
|
136
|
-
|
136
|
+
puts 'CA provided, peer verification has been enabled.'
|
137
137
|
|
138
138
|
ctx.ca = options[:ssl_ca]
|
139
139
|
ctx.verify_mode = Puma::MiniSSL::VERIFY_PEER |
|
140
140
|
Puma::MiniSSL::VERIFY_FAIL_IF_NO_PEER_CERT
|
141
141
|
else
|
142
|
-
|
142
|
+
puts 'CA missing, peer verification has been disabled.'
|
143
143
|
end
|
144
144
|
|
145
145
|
ssl = true
|
@@ -149,7 +149,7 @@ class Server < Sinatra::Base
|
|
149
149
|
server.add_tcp_listener( options[:bind], options[:port] )
|
150
150
|
end
|
151
151
|
|
152
|
-
|
152
|
+
puts "Listening on http#{'s' if ssl}://#{options[:bind]}:#{options[:port]}"
|
153
153
|
|
154
154
|
begin
|
155
155
|
server.run.join
|
@@ -323,7 +323,8 @@ class Agent
|
|
323
323
|
address: @server.address,
|
324
324
|
port_range: Options.agent.instance_port_range,
|
325
325
|
token: Utilities.generate_token,
|
326
|
-
application: Options.paths.application
|
326
|
+
application: Options.paths.application,
|
327
|
+
daemonize: true
|
327
328
|
)) do |client|
|
328
329
|
block.call(
|
329
330
|
'token' => client.token,
|
data/lib/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2
|
@@ -15,8 +15,8 @@ describe Cuboid::Rest::Server do
|
|
15
15
|
let(:id) { @id }
|
16
16
|
let(:non_existent_id) { 'stuff' }
|
17
17
|
|
18
|
-
let(:agent) { Cuboid::Processes::Agents.spawn }
|
19
|
-
let(:scheduler) { Cuboid::Processes::Schedulers.spawn }
|
18
|
+
let(:agent) { Cuboid::Processes::Agents.spawn daemonize: true }
|
19
|
+
let(:scheduler) { Cuboid::Processes::Schedulers.spawn daemonize: true }
|
20
20
|
|
21
21
|
def create_instance
|
22
22
|
post '/instances', options
|
@@ -52,7 +52,7 @@ describe Cuboid::Rest::Server do
|
|
52
52
|
Cuboid::Options.datastore['password'] = password
|
53
53
|
|
54
54
|
Cuboid::Options.rpc.server_port = Cuboid::Utilities.available_port
|
55
|
-
Cuboid::Processes::Manager.spawn( :rest_service )
|
55
|
+
Cuboid::Processes::Manager.spawn( :rest_service, daemonize: true )
|
56
56
|
|
57
57
|
sleep 0.1 while Typhoeus.get( url ).code == 0
|
58
58
|
end
|
@@ -97,7 +97,7 @@ describe Cuboid::Rest::Server do
|
|
97
97
|
Cuboid::Options.rpc.server_ssl_certificate = ssl_cert
|
98
98
|
|
99
99
|
Cuboid::Options.rpc.server_port = Cuboid::Utilities.available_port
|
100
|
-
Cuboid::Processes::Manager.spawn( :rest_service )
|
100
|
+
Cuboid::Processes::Manager.spawn( :rest_service, daemonize: true )
|
101
101
|
|
102
102
|
sleep 0.1 while Typhoeus.get( url ).return_code == :couldnt_connect
|
103
103
|
end
|
@@ -687,7 +687,7 @@ describe Cuboid::Rest::Server do
|
|
687
687
|
end
|
688
688
|
|
689
689
|
describe 'GET /grid' do
|
690
|
-
let(:agent) { Cuboid::Processes::Agents.grid_spawn }
|
690
|
+
let(:agent) { Cuboid::Processes::Agents.grid_spawn daemonize: true }
|
691
691
|
let(:tpl_url) { '/grid' }
|
692
692
|
|
693
693
|
it 'returns Grid info' do
|
@@ -709,7 +709,7 @@ describe Cuboid::Rest::Server do
|
|
709
709
|
end
|
710
710
|
|
711
711
|
describe 'GET /grid/:agent' do
|
712
|
-
let(:agent) { Cuboid::Processes::Agents.grid_spawn }
|
712
|
+
let(:agent) { Cuboid::Processes::Agents.grid_spawn daemonize: true }
|
713
713
|
let(:tpl_url) { '/grid/%s' }
|
714
714
|
|
715
715
|
it 'returns Agent info' do
|
@@ -735,7 +735,7 @@ describe Cuboid::Rest::Server do
|
|
735
735
|
end
|
736
736
|
|
737
737
|
describe 'DELETE /grid/:agent' do
|
738
|
-
let(:agent) { Cuboid::Processes::Agents.grid_spawn }
|
738
|
+
let(:agent) { Cuboid::Processes::Agents.grid_spawn daemonize: true }
|
739
739
|
let(:tpl_url) { '/grid/%s' }
|
740
740
|
|
741
741
|
it 'unplugs the Agent from the Grid' do
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
require 'fileutils'
|
3
3
|
|
4
4
|
describe Cuboid::RPC::Client::Agent do
|
5
|
-
subject { agent_spawn application: "#{fixtures_path}/mock_app.rb" }
|
5
|
+
subject { agent_spawn application: "#{fixtures_path}/mock_app.rb", daemonize: true }
|
6
6
|
|
7
7
|
describe '#node' do
|
8
8
|
it 'provides access to the node data' do
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Cuboid::RPC::Client::Instance do
|
4
4
|
|
5
|
-
let(:subject) { instance_spawn application: "#{fixtures_path}/mock_app.rb" }
|
5
|
+
let(:subject) { instance_spawn application: "#{fixtures_path}/mock_app.rb", daemonize: true }
|
6
6
|
|
7
7
|
context 'when connecting to an instance' do
|
8
8
|
context 'which requires a token' do
|
@@ -4,8 +4,8 @@ require Cuboid::Options.paths.lib + 'rpc/client/instance'
|
|
4
4
|
require Cuboid::Options.paths.lib + 'rpc/server/instance'
|
5
5
|
|
6
6
|
describe Cuboid::RPC::Server::ActiveOptions do
|
7
|
-
let(:instance) { instance_spawn application: "#{fixtures_path}/mock_app.rb" }
|
8
|
-
|
7
|
+
let(:instance) { instance_spawn application: "#{fixtures_path}/mock_app.rb", daemonize: true }
|
8
|
+
|
9
9
|
describe '#set' do
|
10
10
|
it 'sets options by hash' do
|
11
11
|
opts = {
|
@@ -6,7 +6,7 @@ describe Cuboid::RPC::Server::Agent::Node do
|
|
6
6
|
def get_node( port = available_port )
|
7
7
|
Cuboid::Options.rpc.server_port = port
|
8
8
|
|
9
|
-
Cuboid::Processes::Manager.spawn( :node )
|
9
|
+
Cuboid::Processes::Manager.spawn( :node, daemonize: true )
|
10
10
|
|
11
11
|
c = Cuboid::RPC::Client::Base.new(
|
12
12
|
"#{Cuboid::Options.rpc.server_address}:#{port}"
|
@@ -7,7 +7,7 @@ describe Cuboid::RPC::Server::Agent::Service do
|
|
7
7
|
Cuboid::Options.system.max_slots = 10
|
8
8
|
end
|
9
9
|
let(:instance_count) { 3 }
|
10
|
-
let(:agent) { agent_spawn application: "#{fixtures_path}/mock_app.rb" }
|
10
|
+
let(:agent) { agent_spawn application: "#{fixtures_path}/mock_app.rb", daemonize: true }
|
11
11
|
let(:subject) { agent.test_service }
|
12
12
|
|
13
13
|
describe '#agent' do
|
@@ -10,7 +10,7 @@ describe Cuboid::RPC::Server::Agent do
|
|
10
10
|
|
11
11
|
let(:instance_info_keys) { %w(token application pid url owner birthdate helpers now age) }
|
12
12
|
let(:slots) { 3 }
|
13
|
-
let(:subject) { agent_spawn( application: "#{fixtures_path}/mock_app.rb" ) }
|
13
|
+
let(:subject) { agent_spawn( application: "#{fixtures_path}/mock_app.rb", daemonize: true ) }
|
14
14
|
|
15
15
|
describe '#alive?' do
|
16
16
|
it 'returns true' do
|
@@ -23,8 +23,8 @@ describe Cuboid::RPC::Server::Agent do
|
|
23
23
|
context 'and strategy is' do
|
24
24
|
context :horizontal do
|
25
25
|
it 'returns the URL of least burdened Agent' do
|
26
|
-
agent_spawn( peer: subject.url ).spawn( strategy: :direct )
|
27
|
-
agent_spawn( peer: subject.url ).spawn( strategy: :direct )
|
26
|
+
agent_spawn( peer: subject.url, daemonize: true ).spawn( strategy: :direct )
|
27
|
+
agent_spawn( peer: subject.url, daemonize: true ).spawn( strategy: :direct )
|
28
28
|
|
29
29
|
expect(subject.preferred( :horizontal )).to eq(subject.url)
|
30
30
|
end
|
@@ -32,8 +32,8 @@ describe Cuboid::RPC::Server::Agent do
|
|
32
32
|
|
33
33
|
context :vertical do
|
34
34
|
it 'returns the URL of most burdened Agent' do
|
35
|
-
agent_spawn( peer: subject.url ).spawn( strategy: :direct )
|
36
|
-
d = agent_spawn( peer: subject.url )
|
35
|
+
agent_spawn( peer: subject.url, daemonize: true ).spawn( strategy: :direct )
|
36
|
+
d = agent_spawn( peer: subject.url, daemonize: true )
|
37
37
|
d.spawn( strategy: :direct )
|
38
38
|
d.spawn( strategy: :direct )
|
39
39
|
|
@@ -47,8 +47,8 @@ describe Cuboid::RPC::Server::Agent do
|
|
47
47
|
|
48
48
|
context 'default' do
|
49
49
|
it 'returns the URL of least burdened Agent' do
|
50
|
-
agent_spawn( peer: subject.url ).spawn( strategy: :direct )
|
51
|
-
agent_spawn( peer: subject.url ).spawn( strategy: :direct )
|
50
|
+
agent_spawn( peer: subject.url, daemonize: true ).spawn( strategy: :direct )
|
51
|
+
agent_spawn( peer: subject.url, daemonize: true ).spawn( strategy: :direct )
|
52
52
|
|
53
53
|
expect(subject.preferred).to eq(subject.url)
|
54
54
|
end
|
@@ -56,8 +56,8 @@ describe Cuboid::RPC::Server::Agent do
|
|
56
56
|
|
57
57
|
context 'other' do
|
58
58
|
it 'returns :error_unknown_strategy' do
|
59
|
-
agent_spawn( peer: subject.url ).spawn( strategy: :direct )
|
60
|
-
agent_spawn( peer: subject.url ).spawn( strategy: :direct )
|
59
|
+
agent_spawn( peer: subject.url, daemonize: true ).spawn( strategy: :direct )
|
60
|
+
agent_spawn( peer: subject.url, daemonize: true ).spawn( strategy: :direct )
|
61
61
|
|
62
62
|
expect(subject.preferred( :blah )).to eq('error_unknown_strategy')
|
63
63
|
end
|
@@ -72,8 +72,8 @@ describe Cuboid::RPC::Server::Agent do
|
|
72
72
|
let(:slots) { 1 }
|
73
73
|
|
74
74
|
it 'returns nil' do
|
75
|
-
agent_spawn( peer: subject.url ).spawn( strategy: :direct )
|
76
|
-
agent_spawn( peer: subject.url ).spawn( strategy: :direct )
|
75
|
+
agent_spawn( peer: subject.url, daemonize: true ).spawn( strategy: :direct )
|
76
|
+
agent_spawn( peer: subject.url, daemonize: true ).spawn( strategy: :direct )
|
77
77
|
|
78
78
|
expect(subject.preferred).to be_nil
|
79
79
|
end
|
@@ -200,7 +200,8 @@ describe Cuboid::RPC::Server::Agent do
|
|
200
200
|
it 'provides Instances from the least burdened Agent' do
|
201
201
|
d1 = agent_spawn(
|
202
202
|
address: '127.0.0.1',
|
203
|
-
application: "#{fixtures_path}/mock_app.rb"
|
203
|
+
application: "#{fixtures_path}/mock_app.rb",
|
204
|
+
daemonize: true
|
204
205
|
)
|
205
206
|
|
206
207
|
3.times do
|
@@ -210,7 +211,8 @@ describe Cuboid::RPC::Server::Agent do
|
|
210
211
|
d2 = agent_spawn(
|
211
212
|
address: '127.0.0.2',
|
212
213
|
peer: d1.url,
|
213
|
-
application: "#{fixtures_path}/mock_app.rb"
|
214
|
+
application: "#{fixtures_path}/mock_app.rb",
|
215
|
+
daemonize: true
|
214
216
|
)
|
215
217
|
|
216
218
|
2.times do
|
@@ -220,7 +222,8 @@ describe Cuboid::RPC::Server::Agent do
|
|
220
222
|
d3 = agent_spawn(
|
221
223
|
address: '127.0.0.3',
|
222
224
|
peer: d1.url,
|
223
|
-
application: "#{fixtures_path}/mock_app.rb"
|
225
|
+
application: "#{fixtures_path}/mock_app.rb",
|
226
|
+
daemonize: true
|
224
227
|
)
|
225
228
|
d3.spawn( strategy: :direct )
|
226
229
|
preferred = d3.url.split( ':' ).first
|
@@ -238,7 +241,8 @@ describe Cuboid::RPC::Server::Agent do
|
|
238
241
|
it 'provides Instances from the most burdened Agent' do
|
239
242
|
d1 = agent_spawn(
|
240
243
|
address: '127.0.0.1',
|
241
|
-
application: "#{fixtures_path}/mock_app.rb"
|
244
|
+
application: "#{fixtures_path}/mock_app.rb",
|
245
|
+
daemonize: true
|
242
246
|
)
|
243
247
|
|
244
248
|
3.times do
|
@@ -248,7 +252,8 @@ describe Cuboid::RPC::Server::Agent do
|
|
248
252
|
d2 = agent_spawn(
|
249
253
|
address: '127.0.0.2',
|
250
254
|
peer: d1.url,
|
251
|
-
application: "#{fixtures_path}/mock_app.rb"
|
255
|
+
application: "#{fixtures_path}/mock_app.rb",
|
256
|
+
daemonize: true
|
252
257
|
)
|
253
258
|
|
254
259
|
2.times do
|
@@ -258,7 +263,8 @@ describe Cuboid::RPC::Server::Agent do
|
|
258
263
|
d3 = agent_spawn(
|
259
264
|
address: '127.0.0.3',
|
260
265
|
peer: d1.url,
|
261
|
-
application: "#{fixtures_path}/mock_app.rb"
|
266
|
+
application: "#{fixtures_path}/mock_app.rb",
|
267
|
+
daemonize: true
|
262
268
|
)
|
263
269
|
d3.spawn( strategy: :direct )
|
264
270
|
|
@@ -271,7 +277,8 @@ describe Cuboid::RPC::Server::Agent do
|
|
271
277
|
it 'provides Instances from the least burdened Agent' do
|
272
278
|
d1 = agent_spawn(
|
273
279
|
address: '127.0.0.1',
|
274
|
-
application: "#{fixtures_path}/mock_app.rb"
|
280
|
+
application: "#{fixtures_path}/mock_app.rb",
|
281
|
+
daemonize: true
|
275
282
|
)
|
276
283
|
|
277
284
|
3.times do
|
@@ -281,7 +288,8 @@ describe Cuboid::RPC::Server::Agent do
|
|
281
288
|
d2 = agent_spawn(
|
282
289
|
address: '127.0.0.2',
|
283
290
|
peer: d1.url,
|
284
|
-
application: "#{fixtures_path}/mock_app.rb"
|
291
|
+
application: "#{fixtures_path}/mock_app.rb",
|
292
|
+
daemonize: true
|
285
293
|
)
|
286
294
|
|
287
295
|
2.times do
|
@@ -291,7 +299,8 @@ describe Cuboid::RPC::Server::Agent do
|
|
291
299
|
d3 = agent_spawn(
|
292
300
|
address: '127.0.0.3',
|
293
301
|
peer: d1.url,
|
294
|
-
application: "#{fixtures_path}/mock_app.rb"
|
302
|
+
application: "#{fixtures_path}/mock_app.rb",
|
303
|
+
daemonize: true
|
295
304
|
)
|
296
305
|
d3.spawn( strategy: :direct )
|
297
306
|
preferred = d3.url.split( ':' ).first
|
@@ -307,7 +316,7 @@ describe Cuboid::RPC::Server::Agent do
|
|
307
316
|
|
308
317
|
context 'other' do
|
309
318
|
it 'returns :error_unknown_strategy' do
|
310
|
-
expect(agent_spawn( peer: subject.url ).
|
319
|
+
expect(agent_spawn( peer: subject.url, daemonize: true ).
|
311
320
|
spawn( strategy: 'blah' )).to eq('error_unknown_strategy')
|
312
321
|
end
|
313
322
|
end
|
@@ -317,7 +326,8 @@ describe Cuboid::RPC::Server::Agent do
|
|
317
326
|
it 'returns an Instance from the requested Agent' do
|
318
327
|
d1 = agent_spawn(
|
319
328
|
address: '127.0.0.1',
|
320
|
-
application: "#{fixtures_path}/mock_app.rb"
|
329
|
+
application: "#{fixtures_path}/mock_app.rb",
|
330
|
+
daemonize: true
|
321
331
|
)
|
322
332
|
|
323
333
|
d1.spawn( strategy: :direct )
|
@@ -325,14 +335,16 @@ describe Cuboid::RPC::Server::Agent do
|
|
325
335
|
d2 = agent_spawn(
|
326
336
|
address: '127.0.0.2',
|
327
337
|
peer: d1.url,
|
328
|
-
application: "#{fixtures_path}/mock_app.rb"
|
338
|
+
application: "#{fixtures_path}/mock_app.rb",
|
339
|
+
daemonize: true
|
329
340
|
)
|
330
341
|
d2.spawn( strategy: :direct )
|
331
342
|
|
332
343
|
d3 = agent_spawn(
|
333
344
|
address: '127.0.0.3',
|
334
345
|
peer: d1.url,
|
335
|
-
application: "#{fixtures_path}/mock_app.rb"
|
346
|
+
application: "#{fixtures_path}/mock_app.rb",
|
347
|
+
daemonize: true
|
336
348
|
)
|
337
349
|
2.times do
|
338
350
|
d3.spawn( strategy: :direct )
|
@@ -3,13 +3,14 @@ require 'spec_helper'
|
|
3
3
|
require "#{fixtures_path}/mock_app"
|
4
4
|
|
5
5
|
describe 'Cuboid::RPC::Server::Instance' do
|
6
|
-
let(:subject) { instance_spawn( application: "#{fixtures_path}/mock_app.rb" ) }
|
6
|
+
let(:subject) { instance_spawn( application: "#{fixtures_path}/mock_app.rb", daemonize: true ) }
|
7
7
|
|
8
8
|
it 'supports UNIX sockets', if: Raktr.supports_unix_sockets? do
|
9
9
|
socket = "#{Dir.tmpdir}/cuboid-instance-#{Cuboid::Utilities.generate_token}"
|
10
10
|
subject = instance_spawn(
|
11
11
|
socket: socket,
|
12
|
-
application: "#{fixtures_path}/mock_app.rb"
|
12
|
+
application: "#{fixtures_path}/mock_app.rb",
|
13
|
+
daemonize: true
|
13
14
|
)
|
14
15
|
|
15
16
|
expect(subject.url).to eq(socket)
|
@@ -108,7 +109,7 @@ describe 'Cuboid::RPC::Server::Instance' do
|
|
108
109
|
snapshot_path = subject.snapshot_path
|
109
110
|
subject.shutdown
|
110
111
|
|
111
|
-
subject = instance_spawn
|
112
|
+
subject = instance_spawn( daemonize: true )
|
112
113
|
subject.restore! snapshot_path
|
113
114
|
|
114
115
|
sleep 1 while subject.status != :done
|
@@ -8,7 +8,7 @@ describe Cuboid::RPC::Server::Scheduler do
|
|
8
8
|
Cuboid::Options.scheduler.ping_interval = 0.5
|
9
9
|
end
|
10
10
|
|
11
|
-
subject { scheduler_spawn( application: "#{fixtures_path}/mock_app.rb" ) }
|
11
|
+
subject { scheduler_spawn( application: "#{fixtures_path}/mock_app.rb", daemonize: true ) }
|
12
12
|
let(:options) { {} }
|
13
13
|
|
14
14
|
context 'when there are queued scans' do
|
@@ -53,9 +53,9 @@ describe Cuboid::RPC::Server::Scheduler do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
context 'when a Agent has been set' do
|
56
|
-
subject { Cuboid::Processes::Schedulers.spawn agent: agent.url }
|
56
|
+
subject { Cuboid::Processes::Schedulers.spawn agent: agent.url, daemonize: true }
|
57
57
|
let(:agent) do
|
58
|
-
Cuboid::Processes::Agents.spawn( application: "#{fixtures_path}/mock_app.rb" )
|
58
|
+
Cuboid::Processes::Agents.spawn( application: "#{fixtures_path}/mock_app.rb", daemonize: true )
|
59
59
|
end
|
60
60
|
|
61
61
|
it 'gets Instances from it' do
|
@@ -211,7 +211,7 @@ describe Cuboid::RPC::Server::Scheduler do
|
|
211
211
|
end
|
212
212
|
|
213
213
|
describe '#attach' do
|
214
|
-
let(:client) { instance_spawn( application: "#{fixtures_path}/mock_app.rb" ) }
|
214
|
+
let(:client) { instance_spawn( application: "#{fixtures_path}/mock_app.rb", daemonize: true ) }
|
215
215
|
|
216
216
|
it 'attaches a running Instance to the queue' do
|
217
217
|
expect(subject.attach( client.url, client.token )).to eq client.token
|
@@ -249,7 +249,7 @@ describe Cuboid::RPC::Server::Scheduler do
|
|
249
249
|
subject.attach( client.url, client.token )
|
250
250
|
expect(client.scheduler_url).to eq subject.url
|
251
251
|
|
252
|
-
q = scheduler_spawn
|
252
|
+
q = scheduler_spawn( daemonize: true )
|
253
253
|
|
254
254
|
expect(q.attach( client.url, client.token )).to be_falsey
|
255
255
|
expect(client.scheduler_url).to eq subject.url
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cuboid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tasos Laskos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -222,7 +222,7 @@ dependencies:
|
|
222
222
|
version: 1.1.5
|
223
223
|
description: 'An application-centric, decentralised and distributed computing solution.
|
224
224
|
|
225
|
-
|
225
|
+
'
|
226
226
|
email: tasos.laskos@gmail.com
|
227
227
|
executables: []
|
228
228
|
extensions: []
|
@@ -278,7 +278,7 @@ files:
|
|
278
278
|
- lib/cuboid/report.rb
|
279
279
|
- lib/cuboid/rest/server.rb
|
280
280
|
- lib/cuboid/rest/server/instance_helpers.rb
|
281
|
-
- lib/cuboid/rest/server/routes/
|
281
|
+
- lib/cuboid/rest/server/routes/agent.rb
|
282
282
|
- lib/cuboid/rest/server/routes/grid.rb
|
283
283
|
- lib/cuboid/rest/server/routes/instances.rb
|
284
284
|
- lib/cuboid/rest/server/routes/scheduler.rb
|
@@ -467,103 +467,103 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
467
467
|
- !ruby/object:Gem::Version
|
468
468
|
version: '0'
|
469
469
|
requirements: []
|
470
|
-
rubygems_version: 3.
|
470
|
+
rubygems_version: 3.4.13
|
471
471
|
signing_key:
|
472
472
|
specification_version: 4
|
473
473
|
summary: An application-centric, decentralised and distributed computing solution.
|
474
474
|
test_files:
|
475
|
+
- spec/spec_helper.rb
|
476
|
+
- spec/support/snapshots/placeholder
|
477
|
+
- spec/support/helpers/misc.rb
|
478
|
+
- spec/support/helpers/framework.rb
|
479
|
+
- spec/support/helpers/matchers.rb
|
480
|
+
- spec/support/helpers/requires.rb
|
481
|
+
- spec/support/helpers/resets.rb
|
482
|
+
- spec/support/helpers/request_helpers.rb
|
483
|
+
- spec/support/helpers/web_server.rb
|
484
|
+
- spec/support/helpers/paths.rb
|
485
|
+
- spec/support/fixtures/services/echo.rb
|
486
|
+
- spec/support/fixtures/mock_app/test_service.rb
|
487
|
+
- spec/support/fixtures/executables/node.rb
|
488
|
+
- spec/support/fixtures/empty/placeholder
|
489
|
+
- spec/support/fixtures/mock_app.rb
|
475
490
|
- spec/support/shared/application.rb
|
476
|
-
- spec/support/shared/support/cache.rb
|
477
|
-
- spec/support/shared/support/filter.rb
|
478
491
|
- spec/support/shared/component/options/base.rb
|
479
492
|
- spec/support/shared/component.rb
|
480
|
-
- spec/support/shared/
|
493
|
+
- spec/support/shared/support/filter.rb
|
494
|
+
- spec/support/shared/support/cache.rb
|
481
495
|
- spec/support/shared/system/platforms/base.rb
|
482
496
|
- spec/support/shared/system/platforms/mixins/unix.rb
|
483
|
-
- spec/support/
|
497
|
+
- spec/support/shared/option_group.rb
|
498
|
+
- spec/support/factories/scan_report.rb
|
499
|
+
- spec/support/factories/placeholder
|
484
500
|
- spec/support/lib/web_server_dispatcher.rb
|
485
|
-
- spec/support/lib/factory.rb
|
486
501
|
- spec/support/lib/web_server_client.rb
|
502
|
+
- spec/support/lib/factory.rb
|
503
|
+
- spec/support/lib/web_server_manager.rb
|
504
|
+
- spec/support/logs/placeholder
|
505
|
+
- spec/support/reports/placeholder
|
487
506
|
- spec/support/pems/cacert.pem
|
488
507
|
- spec/support/pems/server/cert.pem
|
489
508
|
- spec/support/pems/server/key.pem
|
509
|
+
- spec/support/pems/client/foo-key.pem
|
490
510
|
- spec/support/pems/client/foo-cert.pem
|
491
511
|
- spec/support/pems/client/cert.pem
|
492
|
-
- spec/support/pems/client/foo-key.pem
|
493
512
|
- spec/support/pems/client/key.pem
|
494
|
-
- spec/
|
495
|
-
- spec/
|
496
|
-
- spec/
|
497
|
-
- spec/
|
498
|
-
- spec/
|
499
|
-
- spec/
|
500
|
-
- spec/support/fixtures/services/echo.rb
|
501
|
-
- spec/support/reports/placeholder
|
502
|
-
- spec/support/logs/placeholder
|
503
|
-
- spec/support/helpers/matchers.rb
|
504
|
-
- spec/support/helpers/framework.rb
|
505
|
-
- spec/support/helpers/paths.rb
|
506
|
-
- spec/support/helpers/requires.rb
|
507
|
-
- spec/support/helpers/resets.rb
|
508
|
-
- spec/support/helpers/request_helpers.rb
|
509
|
-
- spec/support/helpers/misc.rb
|
510
|
-
- spec/support/helpers/web_server.rb
|
511
|
-
- spec/support/snapshots/placeholder
|
512
|
-
- spec/spec_helper.rb
|
513
|
+
- spec/cuboid/ruby/array_spec.rb
|
514
|
+
- spec/cuboid/ruby/hash_spec.rb
|
515
|
+
- spec/cuboid/ruby/object_spec.rb
|
516
|
+
- spec/cuboid/snapshot_spec.rb
|
517
|
+
- spec/cuboid/rest/server_spec.rb
|
518
|
+
- spec/cuboid/data_spec.rb
|
513
519
|
- spec/cuboid/data/application_spec.rb
|
514
|
-
- spec/cuboid/error_spec.rb
|
515
|
-
- spec/cuboid/option_groups/snapshot_spec.rb
|
516
|
-
- spec/cuboid/option_groups/report_spec.rb
|
517
|
-
- spec/cuboid/option_groups/datastore_spec.rb
|
518
|
-
- spec/cuboid/option_groups/output_spec.rb
|
519
|
-
- spec/cuboid/option_groups/paths_spec.rb
|
520
|
-
- spec/cuboid/option_groups/rpc_spec.rb
|
521
|
-
- spec/cuboid/option_groups/dispatcher_spec.rb
|
522
|
-
- spec/cuboid/option_groups/system.rb
|
523
520
|
- spec/cuboid/state_spec.rb
|
524
|
-
- spec/cuboid/
|
525
|
-
- spec/cuboid/
|
526
|
-
- spec/cuboid/
|
527
|
-
- spec/cuboid/
|
528
|
-
- spec/cuboid/support/cache/preference_spec.rb
|
529
|
-
- spec/cuboid/support/cache/least_recently_used_spec.rb
|
530
|
-
- spec/cuboid/support/cache/random_replacement_spec.rb
|
531
|
-
- spec/cuboid/support/cache/least_cost_replacement_spec.rb
|
532
|
-
- spec/cuboid/support/buffer/base_spec.rb
|
533
|
-
- spec/cuboid/support/buffer/autoflush_spec.rb
|
534
|
-
- spec/cuboid/support/mixins/observable_spec.rb
|
535
|
-
- spec/cuboid/support/filter/set_spec.rb
|
536
|
-
- spec/cuboid/support/glob_spec.rb
|
537
|
-
- spec/cuboid/support/crypto/rsa_aes_cbc_spec.rb
|
521
|
+
- spec/cuboid/options_spec.rb
|
522
|
+
- spec/cuboid/report_spec.rb
|
523
|
+
- spec/cuboid/state/options_spec.rb
|
524
|
+
- spec/cuboid/state/application_spec.rb
|
538
525
|
- spec/cuboid/application_spec.rb
|
539
|
-
- spec/cuboid/application/parts/state_spec.rb
|
540
|
-
- spec/cuboid/application/parts/data_spec.rb
|
541
|
-
- spec/cuboid/application/parts/report_spec.rb
|
542
|
-
- spec/cuboid/application/runtime_spec.rb
|
543
|
-
- spec/cuboid/rpc/server/scheduler_spec.rb
|
544
|
-
- spec/cuboid/rpc/server/active_options_spec.rb
|
545
526
|
- spec/cuboid/rpc/server/output_spec.rb
|
546
|
-
- spec/cuboid/rpc/server/
|
527
|
+
- spec/cuboid/rpc/server/agent/node_spec.rb
|
528
|
+
- spec/cuboid/rpc/server/agent/service_spec.rb
|
547
529
|
- spec/cuboid/rpc/server/agent_spec.rb
|
548
530
|
- spec/cuboid/rpc/server/instance_spec.rb
|
549
|
-
- spec/cuboid/rpc/server/
|
550
|
-
- spec/cuboid/rpc/server/
|
551
|
-
- spec/cuboid/rpc/
|
531
|
+
- spec/cuboid/rpc/server/scheduler_spec.rb
|
532
|
+
- spec/cuboid/rpc/server/active_options_spec.rb
|
533
|
+
- spec/cuboid/rpc/server/base_spec.rb
|
552
534
|
- spec/cuboid/rpc/client/instance_spec.rb
|
553
535
|
- spec/cuboid/rpc/client/dispatcher_spec.rb
|
554
|
-
- spec/cuboid/
|
555
|
-
- spec/cuboid/
|
556
|
-
- spec/cuboid/
|
557
|
-
- spec/cuboid/
|
536
|
+
- spec/cuboid/rpc/client/base_spec.rb
|
537
|
+
- spec/cuboid/error_spec.rb
|
538
|
+
- spec/cuboid/utilities_spec.rb
|
539
|
+
- spec/cuboid/application/parts/data_spec.rb
|
540
|
+
- spec/cuboid/application/parts/state_spec.rb
|
541
|
+
- spec/cuboid/application/parts/report_spec.rb
|
542
|
+
- spec/cuboid/application/runtime_spec.rb
|
543
|
+
- spec/cuboid/support/cache/random_replacement_spec.rb
|
544
|
+
- spec/cuboid/support/cache/least_cost_replacement_spec.rb
|
545
|
+
- spec/cuboid/support/cache/least_recently_pushed_spec.rb
|
546
|
+
- spec/cuboid/support/cache/preference_spec.rb
|
547
|
+
- spec/cuboid/support/cache/least_recently_used_spec.rb
|
548
|
+
- spec/cuboid/support/glob_spec.rb
|
549
|
+
- spec/cuboid/support/database/scheduler_spec.rb
|
550
|
+
- spec/cuboid/support/database/hash_spec.rb
|
551
|
+
- spec/cuboid/support/database/categorized_queue_spec.rb
|
552
|
+
- spec/cuboid/support/mixins/observable_spec.rb
|
553
|
+
- spec/cuboid/support/buffer/autoflush_spec.rb
|
554
|
+
- spec/cuboid/support/buffer/base_spec.rb
|
555
|
+
- spec/cuboid/support/filter/set_spec.rb
|
556
|
+
- spec/cuboid/support/crypto/rsa_aes_cbc_spec.rb
|
558
557
|
- spec/cuboid/system_spec.rb
|
559
|
-
- spec/cuboid/
|
560
|
-
- spec/cuboid/
|
561
|
-
- spec/cuboid/
|
562
|
-
- spec/cuboid/
|
563
|
-
- spec/cuboid/
|
564
|
-
- spec/cuboid/
|
565
|
-
- spec/cuboid/
|
558
|
+
- spec/cuboid/option_groups/output_spec.rb
|
559
|
+
- spec/cuboid/option_groups/snapshot_spec.rb
|
560
|
+
- spec/cuboid/option_groups/datastore_spec.rb
|
561
|
+
- spec/cuboid/option_groups/system.rb
|
562
|
+
- spec/cuboid/option_groups/report_spec.rb
|
563
|
+
- spec/cuboid/option_groups/rpc_spec.rb
|
564
|
+
- spec/cuboid/option_groups/dispatcher_spec.rb
|
565
|
+
- spec/cuboid/option_groups/paths_spec.rb
|
566
566
|
- spec/cuboid/system/platforms/osx_spec.rb
|
567
|
+
- spec/cuboid/system/platforms/linux_spec.rb
|
567
568
|
- spec/cuboid/system/platforms/windows_spec.rb
|
568
|
-
- spec/cuboid/
|
569
|
-
- spec/cuboid/utilities_spec.rb
|
569
|
+
- spec/cuboid/system/slots_spec.rb
|
File without changes
|