baza.rb 0.14.1 → 0.14.2
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 +4 -4
- data/Gemfile.lock +3 -3
- data/Rakefile +1 -1
- data/lib/baza-rb/fake.rb +0 -23
- data/lib/baza-rb/version.rb +1 -1
- data/lib/baza-rb.rb +1 -42
- data/pact.json +753 -426
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 26df440ccfe84171d852206f625f5ddbe7fc531205bdc49af6478f1eac318458
|
|
4
|
+
data.tar.gz: e8758ca5b64f2fa1f255bffbb1affea6a5a74d9e647230feab19665cf11a5023
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3c3d71a4fe52587afa624f4ce4a11c48b9f64fee61ec1fa029991a9963289093f09f767ea9d6f5ae8036efeaa2f3a7f82b2b7586a015d70207bd4fc300db7104
|
|
7
|
+
data.tar.gz: 8b5e149185a5954d0457c97c002bbbb55c23a509fc01cfcc4bccf8d1a4276add1a4b7fc370cc0213a0bf529d01c5da7ced1900d4037cf91216441d28a4030de3
|
data/Gemfile.lock
CHANGED
|
@@ -49,7 +49,7 @@ GEM
|
|
|
49
49
|
diff-lcs (1.6.2)
|
|
50
50
|
docile (1.4.1)
|
|
51
51
|
drb (2.2.3)
|
|
52
|
-
elapsed (0.
|
|
52
|
+
elapsed (0.3.1)
|
|
53
53
|
loog (~> 0.6)
|
|
54
54
|
tago (~> 0.1)
|
|
55
55
|
ellipsized (0.3.0)
|
|
@@ -58,7 +58,7 @@ GEM
|
|
|
58
58
|
ffi (>= 1.15.0)
|
|
59
59
|
expgen (0.1.1)
|
|
60
60
|
parslet
|
|
61
|
-
factbase (0.19.
|
|
61
|
+
factbase (0.19.4)
|
|
62
62
|
backtrace (~> 0.4)
|
|
63
63
|
decoor (~> 0.1)
|
|
64
64
|
ellipsized (~> 0.3)
|
|
@@ -90,7 +90,7 @@ GEM
|
|
|
90
90
|
i18n (1.14.8)
|
|
91
91
|
concurrent-ruby (~> 1.0)
|
|
92
92
|
iri (0.11.8)
|
|
93
|
-
json (2.18.
|
|
93
|
+
json (2.18.1)
|
|
94
94
|
jsonpath (1.1.5)
|
|
95
95
|
multi_json
|
|
96
96
|
language_server-protocol (3.17.0.5)
|
data/Rakefile
CHANGED
|
@@ -23,7 +23,7 @@ task default: %i[clean test picks rubocop yard]
|
|
|
23
23
|
require 'rake/testtask'
|
|
24
24
|
desc 'Run all unit tests'
|
|
25
25
|
Rake::TestTask.new(:test) do |t|
|
|
26
|
-
Rake::Cleaner.cleanup_files(['coverage'])
|
|
26
|
+
Rake::Cleaner.cleanup_files(['coverage', 'BazaRb-Zerocracy.json'])
|
|
27
27
|
t.libs << 'lib' << 'test'
|
|
28
28
|
t.pattern = 'test/**/test_*.rb'
|
|
29
29
|
t.warning = true
|
data/lib/baza-rb/fake.rb
CHANGED
|
@@ -219,29 +219,6 @@ class BazaRb::Fake
|
|
|
219
219
|
42
|
|
220
220
|
end
|
|
221
221
|
|
|
222
|
-
# Pop the next available job from the server's queue.
|
|
223
|
-
#
|
|
224
|
-
# @param [String] owner Identifier of who is taking the job
|
|
225
|
-
# @param [String] zip The local file path where the job's ZIP will be saved
|
|
226
|
-
# @return [Boolean] Always returns TRUE and creates an empty file
|
|
227
|
-
# rubocop:disable Naming/PredicateMethod
|
|
228
|
-
def pop(owner, zip)
|
|
229
|
-
assert_owner(owner)
|
|
230
|
-
FileUtils.mkdir_p(File.dirname(zip))
|
|
231
|
-
FileUtils.touch(zip)
|
|
232
|
-
true
|
|
233
|
-
end
|
|
234
|
-
# rubocop:enable Naming/PredicateMethod
|
|
235
|
-
|
|
236
|
-
# Submit a ZIP archive to finish a previously popped job.
|
|
237
|
-
#
|
|
238
|
-
# @param [Integer] id The ID of the job to finish
|
|
239
|
-
# @param [String] zip The path to the ZIP file containing job results
|
|
240
|
-
def finish(id, zip)
|
|
241
|
-
assert_id(id)
|
|
242
|
-
assert_file(zip)
|
|
243
|
-
end
|
|
244
|
-
|
|
245
222
|
# Enter a valve to cache or retrieve a computation result.
|
|
246
223
|
#
|
|
247
224
|
# @param [String] name Name of the job
|
data/lib/baza-rb/version.rb
CHANGED
data/lib/baza-rb.rb
CHANGED
|
@@ -484,47 +484,6 @@ class BazaRb
|
|
|
484
484
|
id
|
|
485
485
|
end
|
|
486
486
|
|
|
487
|
-
# Pop the next available job from the server's queue.
|
|
488
|
-
#
|
|
489
|
-
# @param [String] owner Identifier of who is taking the job (any descriptive text)
|
|
490
|
-
# @param [String] zip The local file path where the job's ZIP archive will be saved
|
|
491
|
-
# @return [Boolean] TRUE if a job was successfully popped, FALSE if queue is empty
|
|
492
|
-
# @raise [ServerFailure] If the pop operation fails
|
|
493
|
-
def pop(owner, zip)
|
|
494
|
-
success = false
|
|
495
|
-
elapsed(@loog, level: Logger::INFO) do
|
|
496
|
-
uri = home.append('pop').add(owner:)
|
|
497
|
-
ret = get(uri, [204, 302])
|
|
498
|
-
if ret.code == 204
|
|
499
|
-
FileUtils.rm_f(zip)
|
|
500
|
-
throw :"Nothing to pop at #{uri}"
|
|
501
|
-
end
|
|
502
|
-
job = ret.headers['X-Zerocracy-JobId']
|
|
503
|
-
raise 'Job ID is not returned in X-Zerocracy-JobId' if job.nil?
|
|
504
|
-
raise "Job ID returned in X-Zerocracy-JobId is not valid (#{job.inspect})" unless job.match?(/^[0-9]+$/)
|
|
505
|
-
download(uri.add(job:), zip)
|
|
506
|
-
success = true
|
|
507
|
-
throw :"Popped #{File.size(zip)} bytes in ZIP archive at #{@host}"
|
|
508
|
-
end
|
|
509
|
-
success
|
|
510
|
-
end
|
|
511
|
-
|
|
512
|
-
# Submit a ZIP archive to finish a previously popped job.
|
|
513
|
-
#
|
|
514
|
-
# @param [Integer] id The ID of the job to finish
|
|
515
|
-
# @param [String] zip The path to the ZIP file containing job results
|
|
516
|
-
# @raise [ServerFailure] If the submission fails
|
|
517
|
-
def finish(id, zip)
|
|
518
|
-
raise 'The ID of the job is nil' if id.nil?
|
|
519
|
-
raise 'The ID of the job must be a positive integer' unless id.positive?
|
|
520
|
-
raise 'The "zip" of the job is nil' if zip.nil?
|
|
521
|
-
raise "The 'zip' file is absent: #{zip}" unless File.exist?(zip)
|
|
522
|
-
elapsed(@loog, level: Logger::INFO) do
|
|
523
|
-
upload(home.append('finish').add(id:), zip)
|
|
524
|
-
throw :"Pushed #{File.size(zip)} bytes to #{@host}, finished job ##{id}"
|
|
525
|
-
end
|
|
526
|
-
end
|
|
527
|
-
|
|
528
487
|
# Enter a valve to cache or retrieve a computation result.
|
|
529
488
|
#
|
|
530
489
|
# Valves prevent duplicate computations by caching results. If a result
|
|
@@ -925,7 +884,7 @@ class BazaRb
|
|
|
925
884
|
File.binread(file)
|
|
926
885
|
end
|
|
927
886
|
params[:body] = slice
|
|
928
|
-
params[:headers]['Content-Length'] = slice.bytesize
|
|
887
|
+
params[:headers]['Content-Length'] = slice.bytesize.to_s
|
|
929
888
|
params = zipped(params) if @compress
|
|
930
889
|
ret =
|
|
931
890
|
retry_it do
|