cuboid 0.2.13 → 0.2.14

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ead3ec0a010bda785e92188f13865859de5804c715d6dae6f8e776128b48b6b
4
- data.tar.gz: 947a1bf5fc9e352d2ef4900d1978eced4e000da8f31d363ee84ba6583b8e6ac2
3
+ metadata.gz: 6575215f58e8b94470eaab95d1735534a47d430ef7ce3ba938351c28e2f8ba09
4
+ data.tar.gz: c36c53065a330131496c7fc70bf8c23ae0d77dd3e5f490d1110004f92aca0ac1
5
5
  SHA512:
6
- metadata.gz: e3ded914a1ba511dbde6c0bf6c1a21e02b46ccf0d06c09ed7c9c048da86a4dd1b2e0c793cc76a8c40a0293b892b2b70e8e514717520df9fb16448b5c2157caa8
7
- data.tar.gz: 575d197f5ddb1135eef2a296b316e83613d420f191630094ef15b780698d3900ac746ab1225618e7c451fe52c66fccabb2aca569238e515a8ad58594caaa30e5
6
+ metadata.gz: c58276efd55d785c296bb4349201423ae59937eed0f19d67e3542cbc162a72721bc2c8bfa36536b73ff2483b3e7148b1bd3dcc34885fd4cf04805789f7d5bfbb
7
+ data.tar.gz: 7d750cff6b3b6babae8fc3ab600206ea0f01b159f706ce99234e7b9a321f29d6502dd00202d17dd273e4b9af8e302294187509c0a635b94eff2add328013dd6e
data/Gemfile CHANGED
@@ -20,8 +20,7 @@ group :prof do
20
20
  gem 'memory_profiler'
21
21
  end
22
22
 
23
- if File.exist? '../toq'
24
- gem 'toq', path: '../toq'
25
- end
23
+ gem 'raktr', path: '../raktr'
24
+ gem 'toq', path: '../toq'
26
25
 
27
26
  gemspec
data/LICENSE.md CHANGED
@@ -1,22 +1,375 @@
1
- # License
2
-
3
- Copyright (c) 2023 Ecsypno Single Member P.C. <http://ecsypno.com>.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ ```
2
+ Mozilla Public License Version 2.0
3
+ ==================================
4
+
5
+ 1. Definitions
6
+ --------------
7
+
8
+ 1.1. "Contributor"
9
+ means each individual or legal entity that creates, contributes to
10
+ the creation of, or owns Covered Software.
11
+
12
+ 1.2. "Contributor Version"
13
+ means the combination of the Contributions of others (if any) used
14
+ by a Contributor and that particular Contributor's Contribution.
15
+
16
+ 1.3. "Contribution"
17
+ means Covered Software of a particular Contributor.
18
+
19
+ 1.4. "Covered Software"
20
+ means Source Code Form to which the initial Contributor has attached
21
+ the notice in Exhibit A, the Executable Form of such Source Code
22
+ Form, and Modifications of such Source Code Form, in each case
23
+ including portions thereof.
24
+
25
+ 1.5. "Incompatible With Secondary Licenses"
26
+ means
27
+
28
+ (a) that the initial Contributor has attached the notice described
29
+ in Exhibit B to the Covered Software; or
30
+
31
+ (b) that the Covered Software was made available under the terms of
32
+ version 1.1 or earlier of the License, but not also under the
33
+ terms of a Secondary License.
34
+
35
+ 1.6. "Executable Form"
36
+ means any form of the work other than Source Code Form.
37
+
38
+ 1.7. "Larger Work"
39
+ means a work that combines Covered Software with other material, in
40
+ a separate file or files, that is not Covered Software.
41
+
42
+ 1.8. "License"
43
+ means this document.
44
+
45
+ 1.9. "Licensable"
46
+ means having the right to grant, to the maximum extent possible,
47
+ whether at the time of the initial grant or subsequently, any and
48
+ all of the rights conveyed by this License.
49
+
50
+ 1.10. "Modifications"
51
+ means any of the following:
52
+
53
+ (a) any file in Source Code Form that results from an addition to,
54
+ deletion from, or modification of the contents of Covered
55
+ Software; or
56
+
57
+ (b) any new file in Source Code Form that contains any Covered
58
+ Software.
59
+
60
+ 1.11. "Patent Claims" of a Contributor
61
+ means any patent claim(s), including without limitation, method,
62
+ process, and apparatus claims, in any patent Licensable by such
63
+ Contributor that would be infringed, but for the grant of the
64
+ License, by the making, using, selling, offering for sale, having
65
+ made, import, or transfer of either its Contributions or its
66
+ Contributor Version.
67
+
68
+ 1.12. "Secondary License"
69
+ means either the GNU General Public License, Version 2.0, the GNU
70
+ Lesser General Public License, Version 2.1, the GNU Affero General
71
+ Public License, Version 3.0, or any later versions of those
72
+ licenses.
73
+
74
+ 1.13. "Source Code Form"
75
+ means the form of the work preferred for making modifications.
76
+
77
+ 1.14. "You" (or "Your")
78
+ means an individual or a legal entity exercising rights under this
79
+ License. For legal entities, "You" includes any entity that
80
+ controls, is controlled by, or is under common control with You. For
81
+ purposes of this definition, "control" means (a) the power, direct
82
+ or indirect, to cause the direction or management of such entity,
83
+ whether by contract or otherwise, or (b) ownership of more than
84
+ fifty percent (50%) of the outstanding shares or beneficial
85
+ ownership of such entity.
86
+
87
+ 2. License Grants and Conditions
88
+ --------------------------------
89
+
90
+ 2.1. Grants
91
+
92
+ Each Contributor hereby grants You a world-wide, royalty-free,
93
+ non-exclusive license:
94
+
95
+ (a) under intellectual property rights (other than patent or trademark)
96
+ Licensable by such Contributor to use, reproduce, make available,
97
+ modify, display, perform, distribute, and otherwise exploit its
98
+ Contributions, either on an unmodified basis, with Modifications, or
99
+ as part of a Larger Work; and
100
+
101
+ (b) under Patent Claims of such Contributor to make, use, sell, offer
102
+ for sale, have made, import, and otherwise transfer either its
103
+ Contributions or its Contributor Version.
104
+
105
+ 2.2. Effective Date
106
+
107
+ The licenses granted in Section 2.1 with respect to any Contribution
108
+ become effective for each Contribution on the date the Contributor first
109
+ distributes such Contribution.
110
+
111
+ 2.3. Limitations on Grant Scope
112
+
113
+ The licenses granted in this Section 2 are the only rights granted under
114
+ this License. No additional rights or licenses will be implied from the
115
+ distribution or licensing of Covered Software under this License.
116
+ Notwithstanding Section 2.1(b) above, no patent license is granted by a
117
+ Contributor:
118
+
119
+ (a) for any code that a Contributor has removed from Covered Software;
120
+ or
121
+
122
+ (b) for infringements caused by: (i) Your and any other third party's
123
+ modifications of Covered Software, or (ii) the combination of its
124
+ Contributions with other software (except as part of its Contributor
125
+ Version); or
126
+
127
+ (c) under Patent Claims infringed by Covered Software in the absence of
128
+ its Contributions.
129
+
130
+ This License does not grant any rights in the trademarks, service marks,
131
+ or logos of any Contributor (except as may be necessary to comply with
132
+ the notice requirements in Section 3.4).
133
+
134
+ 2.4. Subsequent Licenses
135
+
136
+ No Contributor makes additional grants as a result of Your choice to
137
+ distribute the Covered Software under a subsequent version of this
138
+ License (see Section 10.2) or under the terms of a Secondary License (if
139
+ permitted under the terms of Section 3.3).
140
+
141
+ 2.5. Representation
142
+
143
+ Each Contributor represents that the Contributor believes its
144
+ Contributions are its original creation(s) or it has sufficient rights
145
+ to grant the rights to its Contributions conveyed by this License.
146
+
147
+ 2.6. Fair Use
148
+
149
+ This License is not intended to limit any rights You have under
150
+ applicable copyright doctrines of fair use, fair dealing, or other
151
+ equivalents.
152
+
153
+ 2.7. Conditions
154
+
155
+ Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
156
+ in Section 2.1.
157
+
158
+ 3. Responsibilities
159
+ -------------------
160
+
161
+ 3.1. Distribution of Source Form
162
+
163
+ All distribution of Covered Software in Source Code Form, including any
164
+ Modifications that You create or to which You contribute, must be under
165
+ the terms of this License. You must inform recipients that the Source
166
+ Code Form of the Covered Software is governed by the terms of this
167
+ License, and how they can obtain a copy of this License. You may not
168
+ attempt to alter or restrict the recipients' rights in the Source Code
169
+ Form.
170
+
171
+ 3.2. Distribution of Executable Form
172
+
173
+ If You distribute Covered Software in Executable Form then:
174
+
175
+ (a) such Covered Software must also be made available in Source Code
176
+ Form, as described in Section 3.1, and You must inform recipients of
177
+ the Executable Form how they can obtain a copy of such Source Code
178
+ Form by reasonable means in a timely manner, at a charge no more
179
+ than the cost of distribution to the recipient; and
180
+
181
+ (b) You may distribute such Executable Form under the terms of this
182
+ License, or sublicense it under different terms, provided that the
183
+ license for the Executable Form does not attempt to limit or alter
184
+ the recipients' rights in the Source Code Form under this License.
185
+
186
+ 3.3. Distribution of a Larger Work
187
+
188
+ You may create and distribute a Larger Work under terms of Your choice,
189
+ provided that You also comply with the requirements of this License for
190
+ the Covered Software. If the Larger Work is a combination of Covered
191
+ Software with a work governed by one or more Secondary Licenses, and the
192
+ Covered Software is not Incompatible With Secondary Licenses, this
193
+ License permits You to additionally distribute such Covered Software
194
+ under the terms of such Secondary License(s), so that the recipient of
195
+ the Larger Work may, at their option, further distribute the Covered
196
+ Software under the terms of either this License or such Secondary
197
+ License(s).
198
+
199
+ 3.4. Notices
200
+
201
+ You may not remove or alter the substance of any license notices
202
+ (including copyright notices, patent notices, disclaimers of warranty,
203
+ or limitations of liability) contained within the Source Code Form of
204
+ the Covered Software, except that You may alter any license notices to
205
+ the extent required to remedy known factual inaccuracies.
206
+
207
+ 3.5. Application of Additional Terms
208
+
209
+ You may choose to offer, and to charge a fee for, warranty, support,
210
+ indemnity or liability obligations to one or more recipients of Covered
211
+ Software. However, You may do so only on Your own behalf, and not on
212
+ behalf of any Contributor. You must make it absolutely clear that any
213
+ such warranty, support, indemnity, or liability obligation is offered by
214
+ You alone, and You hereby agree to indemnify every Contributor for any
215
+ liability incurred by such Contributor as a result of warranty, support,
216
+ indemnity or liability terms You offer. You may include additional
217
+ disclaimers of warranty and limitations of liability specific to any
218
+ jurisdiction.
219
+
220
+ 4. Inability to Comply Due to Statute or Regulation
221
+ ---------------------------------------------------
222
+
223
+ If it is impossible for You to comply with any of the terms of this
224
+ License with respect to some or all of the Covered Software due to
225
+ statute, judicial order, or regulation then You must: (a) comply with
226
+ the terms of this License to the maximum extent possible; and (b)
227
+ describe the limitations and the code they affect. Such description must
228
+ be placed in a text file included with all distributions of the Covered
229
+ Software under this License. Except to the extent prohibited by statute
230
+ or regulation, such description must be sufficiently detailed for a
231
+ recipient of ordinary skill to be able to understand it.
232
+
233
+ 5. Termination
234
+ --------------
235
+
236
+ 5.1. The rights granted under this License will terminate automatically
237
+ if You fail to comply with any of its terms. However, if You become
238
+ compliant, then the rights granted under this License from a particular
239
+ Contributor are reinstated (a) provisionally, unless and until such
240
+ Contributor explicitly and finally terminates Your grants, and (b) on an
241
+ ongoing basis, if such Contributor fails to notify You of the
242
+ non-compliance by some reasonable means prior to 60 days after You have
243
+ come back into compliance. Moreover, Your grants from a particular
244
+ Contributor are reinstated on an ongoing basis if such Contributor
245
+ notifies You of the non-compliance by some reasonable means, this is the
246
+ first time You have received notice of non-compliance with this License
247
+ from such Contributor, and You become compliant prior to 30 days after
248
+ Your receipt of the notice.
249
+
250
+ 5.2. If You initiate litigation against any entity by asserting a patent
251
+ infringement claim (excluding declaratory judgment actions,
252
+ counter-claims, and cross-claims) alleging that a Contributor Version
253
+ directly or indirectly infringes any patent, then the rights granted to
254
+ You by any and all Contributors for the Covered Software under Section
255
+ 2.1 of this License shall terminate.
256
+
257
+ 5.3. In the event of termination under Sections 5.1 or 5.2 above, all
258
+ end user license agreements (excluding distributors and resellers) which
259
+ have been validly granted by You or Your distributors under this License
260
+ prior to termination shall survive termination.
261
+
262
+ ************************************************************************
263
+ * *
264
+ * 6. Disclaimer of Warranty *
265
+ * ------------------------- *
266
+ * *
267
+ * Covered Software is provided under this License on an "as is" *
268
+ * basis, without warranty of any kind, either expressed, implied, or *
269
+ * statutory, including, without limitation, warranties that the *
270
+ * Covered Software is free of defects, merchantable, fit for a *
271
+ * particular purpose or non-infringing. The entire risk as to the *
272
+ * quality and performance of the Covered Software is with You. *
273
+ * Should any Covered Software prove defective in any respect, You *
274
+ * (not any Contributor) assume the cost of any necessary servicing, *
275
+ * repair, or correction. This disclaimer of warranty constitutes an *
276
+ * essential part of this License. No use of any Covered Software is *
277
+ * authorized under this License except under this disclaimer. *
278
+ * *
279
+ ************************************************************************
280
+
281
+ ************************************************************************
282
+ * *
283
+ * 7. Limitation of Liability *
284
+ * -------------------------- *
285
+ * *
286
+ * Under no circumstances and under no legal theory, whether tort *
287
+ * (including negligence), contract, or otherwise, shall any *
288
+ * Contributor, or anyone who distributes Covered Software as *
289
+ * permitted above, be liable to You for any direct, indirect, *
290
+ * special, incidental, or consequential damages of any character *
291
+ * including, without limitation, damages for lost profits, loss of *
292
+ * goodwill, work stoppage, computer failure or malfunction, or any *
293
+ * and all other commercial damages or losses, even if such party *
294
+ * shall have been informed of the possibility of such damages. This *
295
+ * limitation of liability shall not apply to liability for death or *
296
+ * personal injury resulting from such party's negligence to the *
297
+ * extent applicable law prohibits such limitation. Some *
298
+ * jurisdictions do not allow the exclusion or limitation of *
299
+ * incidental or consequential damages, so this exclusion and *
300
+ * limitation may not apply to You. *
301
+ * *
302
+ ************************************************************************
303
+
304
+ 8. Litigation
305
+ -------------
306
+
307
+ Any litigation relating to this License may be brought only in the
308
+ courts of a jurisdiction where the defendant maintains its principal
309
+ place of business and such litigation shall be governed by laws of that
310
+ jurisdiction, without reference to its conflict-of-law provisions.
311
+ Nothing in this Section shall prevent a party's ability to bring
312
+ cross-claims or counter-claims.
313
+
314
+ 9. Miscellaneous
315
+ ----------------
316
+
317
+ This License represents the complete agreement concerning the subject
318
+ matter hereof. If any provision of this License is held to be
319
+ unenforceable, such provision shall be reformed only to the extent
320
+ necessary to make it enforceable. Any law or regulation which provides
321
+ that the language of a contract shall be construed against the drafter
322
+ shall not be used to construe this License against a Contributor.
323
+
324
+ 10. Versions of the License
325
+ ---------------------------
326
+
327
+ 10.1. New Versions
328
+
329
+ Mozilla Foundation is the license steward. Except as provided in Section
330
+ 10.3, no one other than the license steward has the right to modify or
331
+ publish new versions of this License. Each version will be given a
332
+ distinguishing version number.
333
+
334
+ 10.2. Effect of New Versions
335
+
336
+ You may distribute the Covered Software under the terms of the version
337
+ of the License under which You originally received the Covered Software,
338
+ or under the terms of any subsequent version published by the license
339
+ steward.
340
+
341
+ 10.3. Modified Versions
342
+
343
+ If you create software not governed by this License, and you want to
344
+ create a new license for such software, you may create and use a
345
+ modified version of this License if you rename the license and remove
346
+ any references to the name of the license steward (except to note that
347
+ such modified license differs from this License).
348
+
349
+ 10.4. Distributing Source Code Form that is Incompatible With Secondary
350
+ Licenses
351
+
352
+ If You choose to distribute Source Code Form that is Incompatible With
353
+ Secondary Licenses under the terms of this version of the License, the
354
+ notice described in Exhibit B of this License must be attached.
355
+
356
+ Exhibit A - Source Code Form License Notice
357
+ -------------------------------------------
358
+
359
+ This Source Code Form is subject to the terms of the Mozilla Public
360
+ License, v. 2.0. If a copy of the MPL was not distributed with this
361
+ file, You can obtain one at https://mozilla.org/MPL/2.0/.
362
+
363
+ If it is not possible or desirable to put the notice in a particular
364
+ file, then You may include the notice in a location (such as a LICENSE
365
+ file in a relevant directory) where a recipient would be likely to look
366
+ for such a notice.
367
+
368
+ You may add additional accurate notices of copyright ownership.
369
+
370
+ Exhibit B - "Incompatible With Secondary Licenses" Notice
371
+ ---------------------------------------------------------
372
+
373
+ This Source Code Form is "Incompatible With Secondary Licenses", as
374
+ defined by the Mozilla Public License, v. 2.0.
375
+ ```
data/cuboid.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.homepage = 'https://github.com/qadron/cuboid'
12
12
  s.email = 'tasos.laskos@gmail.com'
13
13
  s.authors = [ 'Tasos Laskos' ]
14
- s.licenses = ['MIT']
14
+ s.licenses = ['MPL v2.0']
15
15
 
16
16
  s.files += Dir.glob( 'config/**/**' )
17
17
  s.files += Dir.glob( 'lib/**/**' )
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
25
25
 
26
26
  s.rdoc_options = [ '--charset=UTF-8' ]
27
27
 
28
- s.add_dependency 'awesome_print', '1.6.1'
28
+ s.add_dependency 'awesome_print', '1.9.2'
29
29
 
30
30
  # Don't specify version, messes with the packages since they always grab the
31
31
  # latest one.
@@ -37,23 +37,23 @@ Gem::Specification.new do |s|
37
37
  # For compressing/decompressing system state archives.
38
38
  s.add_dependency 'rubyzip', '~> 2.4.1'
39
39
 
40
- s.add_dependency 'childprocess', '~> 5.1.0'
41
-
42
40
  # RPC serialization.
43
41
  s.add_dependency 'msgpack', '~> 1.7.5'
44
42
 
45
43
  # Web server
46
- s.add_dependency 'puma', '~> 6.5.0'
44
+ s.add_dependency 'puma', '~> 5.6.2'
47
45
 
48
- s.add_dependency 'rack', '2.2.9'
49
- s.add_dependency 'rack-test'
46
+ s.add_dependency 'base64'
50
47
 
48
+ # DO NOT TOUCH THIS GROUP VERSION
49
+ s.add_dependency 'rack', '2.2.4'
50
+ s.add_dependency 'rack-test'
51
51
  # REST API
52
- s.add_dependency 'sinatra', '2.2.3'
53
- s.add_dependency 'sinatra-contrib', '2.2.3'
52
+ s.add_dependency 'sinatra', '3.2.0'
53
+ s.add_dependency 'sinatra-contrib', '3.2.0'
54
54
 
55
55
  # RPC client/server implementation.
56
- s.add_dependency 'toq', '~> 0.1.0'
56
+ s.add_dependency 'toq'
57
57
 
58
58
  s.add_dependency 'vmstat', '~> 2.3.1'
59
59
  s.add_dependency 'sys-proctable', '~> 1.3.0'
@@ -88,7 +88,7 @@ module InstanceHelpers
88
88
  end
89
89
  end
90
90
 
91
- def exist?( id )
91
+ def exists?( id )
92
92
  instances.include? id
93
93
  end
94
94
 
@@ -32,23 +32,6 @@ module Instances
32
32
  json id: instance.token
33
33
  end
34
34
 
35
- app.post '/instances/restore' do
36
- max_utilization! if !agent && System.max_utilization?
37
-
38
- options = ::JSON.load( request.body.read ) || {}
39
-
40
- instance = get_instance
41
- max_utilization! if !instance
42
-
43
- handle_error proc { instance.shutdown } do
44
- instance.restore!( options['session'] )
45
- end
46
-
47
- instances[instance.token] = instance
48
-
49
- json id: instance.token
50
- end
51
-
52
35
  # Progress
53
36
  app.get '/instances/:instance' do
54
37
  ensure_instance!
@@ -123,14 +106,6 @@ module Instances
123
106
  end
124
107
  end
125
108
 
126
- app.put '/instances/:instance/abort' do
127
- ensure_instance!
128
-
129
- instance_for( params[:instance] ) do |instance|
130
- json instance.abort!
131
- end
132
- end
133
-
134
109
  # Abort/shutdown
135
110
  app.delete '/instances/:instance' do
136
111
  ensure_instance!
@@ -76,7 +76,7 @@ class Server < Sinatra::Base
76
76
 
77
77
  id = params[:instance]
78
78
 
79
- return if exist? id
79
+ return if exists? id
80
80
 
81
81
  halt 404, json( "Scan not found for id: #{h id}." )
82
82
  end
@@ -42,6 +42,9 @@ class Base < Toq::Client
42
42
  socket: socket,
43
43
  token: token
44
44
  ))
45
+
46
+ return if @reactor.running?
47
+ @reactor.run_in_thread
45
48
  end
46
49
 
47
50
  def address
@@ -23,11 +23,14 @@ class Instance
23
23
  connection_pool_size: 1
24
24
  )
25
25
 
26
+ raktr = Raktr.new
27
+ raktr.run_in_thread
28
+
26
29
  client = new( url, token, options )
27
- Raktr.global.delay( 0.1 ) do |task|
30
+ raktr.delay( 0.1 ) do |task|
28
31
  client.alive? do |r|
29
32
  if r.rpc_exception?
30
- Raktr.global.delay( 0.1, &task )
33
+ raktr.delay( 0.1, &task )
31
34
  next
32
35
  end
33
36
 
@@ -100,12 +100,12 @@ class Agent
100
100
  end
101
101
 
102
102
  if strategy == :direct || !@node.grid_member?
103
- block.call( self.utilization == 1 ? nil : @url )
103
+ block.call( self.utilization >= 1.to_f ? nil : @url )
104
104
  return
105
105
  end
106
106
 
107
107
  pick_utilization = proc do |url, utilization|
108
- (utilization == 1 || utilization.rpc_exception?) ?
108
+ (utilization >= 1.to_f || utilization.rpc_exception?) ?
109
109
  nil : [url, utilization]
110
110
  end
111
111
 
@@ -31,6 +31,9 @@ class Base < Toq::Server
31
31
  serializer: Serializer,
32
32
  token: token
33
33
  ))
34
+
35
+ return if @reactor.running?
36
+ @reactor.run_in_thread
34
37
  end
35
38
 
36
39
  def address
@@ -75,7 +75,8 @@ class Instance
75
75
  trap( signal ){ shutdown if !@options.datastore.do_not_trap }
76
76
  end
77
77
 
78
- Raktr.global.run do
78
+ @raktr = Raktr.new
79
+ @raktr.run do
79
80
  _run
80
81
  end
81
82
  end
@@ -309,7 +310,7 @@ class Instance
309
310
 
310
311
  # Starts RPC services.
311
312
  def _run
312
- Raktr.global.on_error do |_, e|
313
+ @raktr.on_error do |_, e|
313
314
  print_error "Reactor: #{e}"
314
315
 
315
316
  e.backtrace.each do |l|
@@ -41,7 +41,7 @@ class Base
41
41
  end
42
42
 
43
43
  def disk_space_for( pid )
44
- return 0 if !Dir.exist?( Options.paths.tmp_dir_for( pid ) )
44
+ return 0 if !Dir.exists?( Options.paths.tmp_dir_for( pid ) )
45
45
 
46
46
  IO.read( disk_space_file_for( pid ) ).to_i
47
47
  end
data/lib/cuboid/system.rb CHANGED
@@ -30,7 +30,7 @@ class System
30
30
 
31
31
  # @return [Bool]
32
32
  def max_utilization?
33
- utilization == 1
33
+ utilization >= 1
34
34
  end
35
35
 
36
36
  # @return [Integer]
data/lib/version CHANGED
@@ -1 +1 @@
1
- 0.2.13
1
+ 0.2.14
@@ -20,7 +20,7 @@ describe Cuboid::OptionGroups::Paths do
20
20
 
21
21
  describe "##{method}" do
22
22
  it 'points to an existing directory' do
23
- expect(File.exist?( subject.send method )).to be_truthy
23
+ expect(File.exists?( subject.send method )).to be_truthy
24
24
  end
25
25
  end
26
26
 
@@ -251,26 +251,6 @@ describe Cuboid::Rest::Server do
251
251
  end
252
252
  end
253
253
 
254
- describe 'POST /instances/restore' do
255
- let(:tpl_url) { '/instances/restore' }
256
-
257
- it 'creates an instance from a restores session'
258
-
259
- context 'when given invalid options' do
260
- it 'returns a 500'
261
-
262
- it 'does not list the instance on the index'
263
- end
264
-
265
- context 'when the system is at max utilization' do
266
- it 'returns a 503'
267
- end
268
-
269
- context 'when a Agent has been set' do
270
- it 'uses it'
271
- end
272
- end
273
-
274
254
  describe 'GET /instances/:instance' do
275
255
  let(:tpl_url) { '/instances/%s' }
276
256
 
@@ -587,59 +567,7 @@ describe Cuboid::Rest::Server do
587
567
  end
588
568
  end
589
569
  end
590
-
591
- describe 'PUT /instances/:instance/abort' do
592
- let(:tpl_url) { '/instances/%s/abort' }
593
-
594
- before do
595
- @id = create_instance
596
- end
597
-
598
- it 'aborts the instance' do
599
- put url
600
- expect(response_code).to eq 200
601
-
602
- get "/instances/#{id}"
603
- expect(['aborting', 'aborted']).to include response_data['status']
604
- end
605
-
606
- context 'when passed a non-existent id' do
607
- let(:id) { non_existent_id }
608
-
609
- it 'returns 404' do
610
- put url
611
- expect(response_code).to eq 404
612
- end
613
- end
614
-
615
- context 'when the instance is from the Scheduler' do
616
- before do
617
- put '/scheduler/url', scheduler.url
618
- end
619
-
620
- it 'includes it' do
621
- @id = scheduler.push( options )
622
- sleep 0.1 while scheduler.running.empty?
623
-
624
- put url
625
- expect(response_code).to eq 200
626
-
627
- get "/instances/#{id}"
628
- expect(['aborting', 'aborted']).to include response_data['status']
629
- end
630
-
631
- context 'when the instance completes' do
632
- it 'is removed' do
633
- @id = scheduler.push( options )
634
- sleep 0.1 while scheduler.completed.empty?
635
-
636
- put url
637
- expect(response_code).to be 404
638
- end
639
- end
640
- end
641
- end
642
-
570
+
643
571
  describe 'DELETE /instances/:instance' do
644
572
  let(:tpl_url) { '/instances/%s' }
645
573
 
@@ -1031,7 +959,7 @@ describe Cuboid::Rest::Server do
1031
959
 
1032
960
  get url
1033
961
  expect(response_data.size).to be 1
1034
- expect(File.exist? response_data[@id]).to be true
962
+ expect(File.exists? response_data[@id]).to be true
1035
963
  end
1036
964
  end
1037
965
 
@@ -49,7 +49,7 @@ describe 'Cuboid::RPC::Server::Instance' do
49
49
  sleep 1 while !subject.suspended?
50
50
  end
51
51
 
52
- expect(File.exist?( subject.snapshot_path )).to be_truthy
52
+ expect(File.exists?( subject.snapshot_path )).to be_truthy
53
53
  end
54
54
  end
55
55
 
@@ -132,7 +132,7 @@ describe Cuboid::Support::Database::Queue do
132
132
 
133
133
  expect(subject.disk.size).to eq(2)
134
134
  subject.disk.each do |path|
135
- expect(File.exist?( path )).to be_truthy
135
+ expect(File.exists?( path )).to be_truthy
136
136
  end
137
137
  end
138
138
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuboid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.13
4
+ version: 0.2.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tasos Laskos
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-01-12 00:00:00.000000000 Z
10
+ date: 2025-12-26 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: awesome_print
@@ -16,14 +15,14 @@ dependencies:
16
15
  requirements:
17
16
  - - '='
18
17
  - !ruby/object:Gem::Version
19
- version: 1.6.1
18
+ version: 1.9.2
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - '='
25
24
  - !ruby/object:Gem::Version
26
- version: 1.6.1
25
+ version: 1.9.2
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: bundler
29
28
  requirement: !ruby/object:Gem::Requirement
@@ -81,61 +80,61 @@ dependencies:
81
80
  - !ruby/object:Gem::Version
82
81
  version: 2.4.1
83
82
  - !ruby/object:Gem::Dependency
84
- name: childprocess
83
+ name: msgpack
85
84
  requirement: !ruby/object:Gem::Requirement
86
85
  requirements:
87
86
  - - "~>"
88
87
  - !ruby/object:Gem::Version
89
- version: 5.1.0
88
+ version: 1.7.5
90
89
  type: :runtime
91
90
  prerelease: false
92
91
  version_requirements: !ruby/object:Gem::Requirement
93
92
  requirements:
94
93
  - - "~>"
95
94
  - !ruby/object:Gem::Version
96
- version: 5.1.0
95
+ version: 1.7.5
97
96
  - !ruby/object:Gem::Dependency
98
- name: msgpack
97
+ name: puma
99
98
  requirement: !ruby/object:Gem::Requirement
100
99
  requirements:
101
100
  - - "~>"
102
101
  - !ruby/object:Gem::Version
103
- version: 1.7.5
102
+ version: 5.6.2
104
103
  type: :runtime
105
104
  prerelease: false
106
105
  version_requirements: !ruby/object:Gem::Requirement
107
106
  requirements:
108
107
  - - "~>"
109
108
  - !ruby/object:Gem::Version
110
- version: 1.7.5
109
+ version: 5.6.2
111
110
  - !ruby/object:Gem::Dependency
112
- name: puma
111
+ name: base64
113
112
  requirement: !ruby/object:Gem::Requirement
114
113
  requirements:
115
- - - "~>"
114
+ - - ">="
116
115
  - !ruby/object:Gem::Version
117
- version: 6.5.0
116
+ version: '0'
118
117
  type: :runtime
119
118
  prerelease: false
120
119
  version_requirements: !ruby/object:Gem::Requirement
121
120
  requirements:
122
- - - "~>"
121
+ - - ">="
123
122
  - !ruby/object:Gem::Version
124
- version: 6.5.0
123
+ version: '0'
125
124
  - !ruby/object:Gem::Dependency
126
125
  name: rack
127
126
  requirement: !ruby/object:Gem::Requirement
128
127
  requirements:
129
128
  - - '='
130
129
  - !ruby/object:Gem::Version
131
- version: 2.2.9
130
+ version: 2.2.4
132
131
  type: :runtime
133
132
  prerelease: false
134
133
  version_requirements: !ruby/object:Gem::Requirement
135
134
  requirements:
136
135
  - - '='
137
136
  - !ruby/object:Gem::Version
138
- version: 2.2.9
137
+ version: 2.2.4
139
138
  - !ruby/object:Gem::Dependency
140
139
  name: rack-test
141
140
  requirement: !ruby/object:Gem::Requirement
@@ -156,42 +155,42 @@ dependencies:
156
155
  requirements:
157
156
  - - '='
158
157
  - !ruby/object:Gem::Version
159
- version: 2.2.3
158
+ version: 3.2.0
160
159
  type: :runtime
161
160
  prerelease: false
162
161
  version_requirements: !ruby/object:Gem::Requirement
163
162
  requirements:
164
163
  - - '='
165
164
  - !ruby/object:Gem::Version
166
- version: 2.2.3
165
+ version: 3.2.0
167
166
  - !ruby/object:Gem::Dependency
168
167
  name: sinatra-contrib
169
168
  requirement: !ruby/object:Gem::Requirement
170
169
  requirements:
171
170
  - - '='
172
171
  - !ruby/object:Gem::Version
173
- version: 2.2.3
172
+ version: 3.2.0
174
173
  type: :runtime
175
174
  prerelease: false
176
175
  version_requirements: !ruby/object:Gem::Requirement
177
176
  requirements:
178
177
  - - '='
179
178
  - !ruby/object:Gem::Version
180
- version: 2.2.3
179
+ version: 3.2.0
181
180
  - !ruby/object:Gem::Dependency
182
181
  name: toq
183
182
  requirement: !ruby/object:Gem::Requirement
184
183
  requirements:
185
- - - "~>"
184
+ - - ">="
186
185
  - !ruby/object:Gem::Version
187
- version: 0.1.0
186
+ version: '0'
188
187
  type: :runtime
189
188
  prerelease: false
190
189
  version_requirements: !ruby/object:Gem::Requirement
191
190
  requirements:
192
- - - "~>"
191
+ - - ">="
193
192
  - !ruby/object:Gem::Version
194
- version: 0.1.0
193
+ version: '0'
195
194
  - !ruby/object:Gem::Dependency
196
195
  name: vmstat
197
196
  requirement: !ruby/object:Gem::Requirement
@@ -227,9 +226,9 @@ email: tasos.laskos@gmail.com
227
226
  executables: []
228
227
  extensions: []
229
228
  extra_rdoc_files:
230
- - README.md
231
- - LICENSE.md
232
229
  - CHANGELOG.md
230
+ - LICENSE.md
231
+ - README.md
233
232
  files:
234
233
  - CHANGELOG.md
235
234
  - Gemfile
@@ -451,9 +450,8 @@ files:
451
450
  - spec/support/snapshots/placeholder
452
451
  homepage: https://github.com/qadron/cuboid
453
452
  licenses:
454
- - MIT
453
+ - MPL v2.0
455
454
  metadata: {}
456
- post_install_message:
457
455
  rdoc_options:
458
456
  - "--charset=UTF-8"
459
457
  require_paths:
@@ -469,103 +467,102 @@ required_rubygems_version: !ruby/object:Gem::Requirement
469
467
  - !ruby/object:Gem::Version
470
468
  version: '0'
471
469
  requirements: []
472
- rubygems_version: 3.4.22
473
- signing_key:
470
+ rubygems_version: 3.6.9
474
471
  specification_version: 4
475
472
  summary: An application-centric, decentralised and distributed computing solution.
476
473
  test_files:
477
- - spec/support/fixtures/mock_app/test_service.rb
478
- - spec/support/fixtures/services/echo.rb
479
- - spec/support/fixtures/empty/placeholder
480
- - spec/support/fixtures/mock_app.rb
481
- - spec/support/fixtures/executables/node.rb
482
- - spec/support/lib/web_server_client.rb
483
- - spec/support/lib/web_server_dispatcher.rb
484
- - spec/support/lib/web_server_manager.rb
485
- - spec/support/lib/factory.rb
486
- - spec/support/reports/placeholder
487
- - spec/support/shared/component.rb
488
- - spec/support/shared/system/platforms/base.rb
489
- - spec/support/shared/system/platforms/mixins/unix.rb
490
- - spec/support/shared/support/filter.rb
491
- - spec/support/shared/support/cache.rb
492
- - spec/support/shared/application.rb
493
- - spec/support/shared/option_group.rb
494
- - spec/support/shared/component/options/base.rb
495
- - spec/support/logs/placeholder
496
- - spec/support/helpers/requires.rb
497
- - spec/support/helpers/matchers.rb
498
- - spec/support/helpers/request_helpers.rb
499
- - spec/support/helpers/resets.rb
500
- - spec/support/helpers/web_server.rb
501
- - spec/support/helpers/framework.rb
502
- - spec/support/helpers/misc.rb
503
- - spec/support/helpers/paths.rb
504
- - spec/support/pems/client/cert.pem
505
- - spec/support/pems/client/key.pem
506
- - spec/support/pems/client/foo-cert.pem
507
- - spec/support/pems/client/foo-key.pem
508
- - spec/support/pems/server/cert.pem
509
- - spec/support/pems/server/key.pem
510
- - spec/support/pems/cacert.pem
511
- - spec/support/snapshots/placeholder
512
- - spec/support/factories/scan_report.rb
513
- - spec/support/factories/placeholder
514
- - spec/cuboid/rest/server_spec.rb
474
+ - spec/cuboid/application/parts/data_spec.rb
475
+ - spec/cuboid/application/parts/report_spec.rb
476
+ - spec/cuboid/application/parts/state_spec.rb
477
+ - spec/cuboid/application/runtime_spec.rb
478
+ - spec/cuboid/application_spec.rb
479
+ - spec/cuboid/data/application_spec.rb
480
+ - spec/cuboid/data_spec.rb
515
481
  - spec/cuboid/error_spec.rb
516
- - spec/cuboid/option_groups/rpc_spec.rb
517
- - spec/cuboid/option_groups/dispatcher_spec.rb
518
- - spec/cuboid/option_groups/snapshot_spec.rb
519
482
  - spec/cuboid/option_groups/datastore_spec.rb
520
- - spec/cuboid/option_groups/system.rb
483
+ - spec/cuboid/option_groups/dispatcher_spec.rb
521
484
  - spec/cuboid/option_groups/output_spec.rb
522
- - spec/cuboid/option_groups/report_spec.rb
523
485
  - spec/cuboid/option_groups/paths_spec.rb
486
+ - spec/cuboid/option_groups/report_spec.rb
487
+ - spec/cuboid/option_groups/rpc_spec.rb
488
+ - spec/cuboid/option_groups/snapshot_spec.rb
489
+ - spec/cuboid/option_groups/system.rb
490
+ - spec/cuboid/options_spec.rb
491
+ - spec/cuboid/report_spec.rb
492
+ - spec/cuboid/rest/server_spec.rb
524
493
  - spec/cuboid/rpc/client/base_spec.rb
525
494
  - spec/cuboid/rpc/client/dispatcher_spec.rb
526
495
  - spec/cuboid/rpc/client/instance_spec.rb
527
- - spec/cuboid/rpc/server/base_spec.rb
528
- - spec/cuboid/rpc/server/agent_spec.rb
529
496
  - spec/cuboid/rpc/server/active_options_spec.rb
530
- - spec/cuboid/rpc/server/scheduler_spec.rb
531
- - spec/cuboid/rpc/server/output_spec.rb
532
- - spec/cuboid/rpc/server/instance_spec.rb
533
- - spec/cuboid/rpc/server/agent/service_spec.rb
534
497
  - spec/cuboid/rpc/server/agent/node_spec.rb
535
- - spec/cuboid/snapshot_spec.rb
498
+ - spec/cuboid/rpc/server/agent/service_spec.rb
499
+ - spec/cuboid/rpc/server/agent_spec.rb
500
+ - spec/cuboid/rpc/server/base_spec.rb
501
+ - spec/cuboid/rpc/server/instance_spec.rb
502
+ - spec/cuboid/rpc/server/output_spec.rb
503
+ - spec/cuboid/rpc/server/scheduler_spec.rb
504
+ - spec/cuboid/ruby/array_spec.rb
536
505
  - spec/cuboid/ruby/hash_spec.rb
537
506
  - spec/cuboid/ruby/object_spec.rb
538
- - spec/cuboid/ruby/array_spec.rb
539
- - spec/cuboid/data_spec.rb
540
- - spec/cuboid/system/platforms/osx_spec.rb
541
- - spec/cuboid/system/platforms/linux_spec.rb
542
- - spec/cuboid/system/platforms/windows_spec.rb
543
- - spec/cuboid/system/slots_spec.rb
544
- - spec/cuboid/report_spec.rb
545
- - spec/cuboid/state/options_spec.rb
507
+ - spec/cuboid/snapshot_spec.rb
546
508
  - spec/cuboid/state/application_spec.rb
547
- - spec/cuboid/data/application_spec.rb
548
- - spec/cuboid/options_spec.rb
549
- - spec/cuboid/application_spec.rb
550
- - spec/cuboid/application/parts/data_spec.rb
551
- - spec/cuboid/application/parts/report_spec.rb
552
- - spec/cuboid/application/parts/state_spec.rb
553
- - spec/cuboid/application/runtime_spec.rb
554
- - spec/cuboid/support/cache/random_replacement_spec.rb
509
+ - spec/cuboid/state/options_spec.rb
510
+ - spec/cuboid/state_spec.rb
511
+ - spec/cuboid/support/buffer/autoflush_spec.rb
512
+ - spec/cuboid/support/buffer/base_spec.rb
513
+ - spec/cuboid/support/cache/least_cost_replacement_spec.rb
555
514
  - spec/cuboid/support/cache/least_recently_pushed_spec.rb
556
515
  - spec/cuboid/support/cache/least_recently_used_spec.rb
557
- - spec/cuboid/support/cache/least_cost_replacement_spec.rb
558
516
  - spec/cuboid/support/cache/preference_spec.rb
559
- - spec/cuboid/support/buffer/base_spec.rb
560
- - spec/cuboid/support/buffer/autoflush_spec.rb
561
- - spec/cuboid/support/glob_spec.rb
517
+ - spec/cuboid/support/cache/random_replacement_spec.rb
518
+ - spec/cuboid/support/crypto/rsa_aes_cbc_spec.rb
519
+ - spec/cuboid/support/database/categorized_queue_spec.rb
562
520
  - spec/cuboid/support/database/hash_spec.rb
563
521
  - spec/cuboid/support/database/scheduler_spec.rb
564
- - spec/cuboid/support/database/categorized_queue_spec.rb
565
522
  - spec/cuboid/support/filter/set_spec.rb
523
+ - spec/cuboid/support/glob_spec.rb
566
524
  - spec/cuboid/support/mixins/observable_spec.rb
567
- - spec/cuboid/support/crypto/rsa_aes_cbc_spec.rb
568
- - spec/cuboid/state_spec.rb
525
+ - spec/cuboid/system/platforms/linux_spec.rb
526
+ - spec/cuboid/system/platforms/osx_spec.rb
527
+ - spec/cuboid/system/platforms/windows_spec.rb
528
+ - spec/cuboid/system/slots_spec.rb
569
529
  - spec/cuboid/system_spec.rb
570
530
  - spec/cuboid/utilities_spec.rb
571
531
  - spec/spec_helper.rb
532
+ - spec/support/factories/placeholder
533
+ - spec/support/factories/scan_report.rb
534
+ - spec/support/fixtures/empty/placeholder
535
+ - spec/support/fixtures/executables/node.rb
536
+ - spec/support/fixtures/mock_app.rb
537
+ - spec/support/fixtures/mock_app/test_service.rb
538
+ - spec/support/fixtures/services/echo.rb
539
+ - spec/support/helpers/framework.rb
540
+ - spec/support/helpers/matchers.rb
541
+ - spec/support/helpers/misc.rb
542
+ - spec/support/helpers/paths.rb
543
+ - spec/support/helpers/request_helpers.rb
544
+ - spec/support/helpers/requires.rb
545
+ - spec/support/helpers/resets.rb
546
+ - spec/support/helpers/web_server.rb
547
+ - spec/support/lib/factory.rb
548
+ - spec/support/lib/web_server_client.rb
549
+ - spec/support/lib/web_server_dispatcher.rb
550
+ - spec/support/lib/web_server_manager.rb
551
+ - spec/support/logs/placeholder
552
+ - spec/support/pems/cacert.pem
553
+ - spec/support/pems/client/cert.pem
554
+ - spec/support/pems/client/foo-cert.pem
555
+ - spec/support/pems/client/foo-key.pem
556
+ - spec/support/pems/client/key.pem
557
+ - spec/support/pems/server/cert.pem
558
+ - spec/support/pems/server/key.pem
559
+ - spec/support/reports/placeholder
560
+ - spec/support/shared/application.rb
561
+ - spec/support/shared/component.rb
562
+ - spec/support/shared/component/options/base.rb
563
+ - spec/support/shared/option_group.rb
564
+ - spec/support/shared/support/cache.rb
565
+ - spec/support/shared/support/filter.rb
566
+ - spec/support/shared/system/platforms/base.rb
567
+ - spec/support/shared/system/platforms/mixins/unix.rb
568
+ - spec/support/snapshots/placeholder