ci-queue 0.56.0 → 0.58.0
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 +1 -1
- data/lib/ci/queue/redis/base.rb +20 -4
- data/lib/ci/queue/redis/supervisor.rb +0 -6
- data/lib/ci/queue/redis/worker.rb +28 -8
- data/lib/ci/queue/static.rb +2 -0
- data/lib/ci/queue/version.rb +1 -1
- data/lib/minitest/queue/runner.rb +3 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0302564aa747e3b115328f8e8a09ba89e319631c885eb6250236a4f53d5d4b3f
|
4
|
+
data.tar.gz: c09e4e48c6fcded24e23673d39beb5374960e95ac47a1f74805dce6e868c1ae8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d885b7fd5fbaaefb1fb3271a5364285b0b4a16a2e58449beae1e9f1a8e430f9e48554f7e707299124b4ae132e0122679b8a2c1163f4d22e2707a03fdba3f09b4
|
7
|
+
data.tar.gz: daa111f58048ce32e754698858305ed48d68f35e4d60a023b5263674d3151386cb395a36e1a40b6926ae874b1b4187567b9937632deedc77a474b63d34c5f9b2
|
data/Gemfile.lock
CHANGED
data/lib/ci/queue/redis/base.rb
CHANGED
@@ -13,16 +13,18 @@ module CI
|
|
13
13
|
|
14
14
|
module RedisInstrumentation
|
15
15
|
def call(command, redis_config)
|
16
|
-
result = super
|
17
16
|
logger = redis_config.custom[:debug_log]
|
18
|
-
logger.info("#{command}
|
17
|
+
logger.info("Running '#{command}'")
|
18
|
+
result = super
|
19
|
+
logger.info("Finished '#{command}': #{result}")
|
19
20
|
result
|
20
21
|
end
|
21
22
|
|
22
23
|
def call_pipelined(commands, redis_config)
|
23
|
-
result = super
|
24
24
|
logger = redis_config.custom[:debug_log]
|
25
|
-
logger.info("#{commands}
|
25
|
+
logger.info("Running '#{commands}'")
|
26
|
+
result = super
|
27
|
+
logger.info("Finished '#{commands}': #{result}")
|
26
28
|
result
|
27
29
|
end
|
28
30
|
end
|
@@ -185,6 +187,20 @@ module CI
|
|
185
187
|
|
186
188
|
attr_reader :redis, :redis_url
|
187
189
|
|
190
|
+
def with_redis_timeout(timeout)
|
191
|
+
prev = redis._client.timeout
|
192
|
+
redis._client.timeout = timeout
|
193
|
+
yield
|
194
|
+
ensure
|
195
|
+
redis._client.timeout = prev
|
196
|
+
end
|
197
|
+
|
198
|
+
def measure
|
199
|
+
starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
200
|
+
yield
|
201
|
+
Process.clock_gettime(Process::CLOCK_MONOTONIC) - starting
|
202
|
+
end
|
203
|
+
|
188
204
|
def key(*args)
|
189
205
|
['build', build_id, *args].join(':')
|
190
206
|
end
|
@@ -47,12 +47,6 @@ module CI
|
|
47
47
|
|
48
48
|
private
|
49
49
|
|
50
|
-
def measure
|
51
|
-
starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
52
|
-
yield
|
53
|
-
Process.clock_gettime(Process::CLOCK_MONOTONIC) - starting
|
54
|
-
end
|
55
|
-
|
56
50
|
def active_workers?
|
57
51
|
# if there are running jobs we assume there are still agents active
|
58
52
|
redis.zrangebyscore(key('running'), CI::Queue.time_now.to_f - config.timeout, "+inf", limit: [0,1]).count > 0
|
@@ -204,15 +204,35 @@ module CI
|
|
204
204
|
@total = tests.size
|
205
205
|
|
206
206
|
if @master = redis.setnx(key('master-status'), 'setup')
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
207
|
+
puts "Worker electected as leader, pushing #{@total} tests to the queue."
|
208
|
+
puts
|
209
|
+
|
210
|
+
attempts = 0
|
211
|
+
duration = measure do
|
212
|
+
with_redis_timeout(5) do
|
213
|
+
redis.without_reconnect do
|
214
|
+
redis.multi do |transaction|
|
215
|
+
transaction.lpush(key('queue'), tests) unless tests.empty?
|
216
|
+
transaction.set(key('total'), @total)
|
217
|
+
transaction.set(key('master-status'), 'ready')
|
218
|
+
|
219
|
+
transaction.expire(key('queue'), config.redis_ttl)
|
220
|
+
transaction.expire(key('total'), config.redis_ttl)
|
221
|
+
transaction.expire(key('master-status'), config.redis_ttl)
|
222
|
+
end
|
223
|
+
end
|
224
|
+
rescue ::Redis::BaseError => error
|
225
|
+
if !queue_initialized? && attempts < 3
|
226
|
+
puts "Retrying pushing #{@total} tests to the queue... (#{error})"
|
227
|
+
attempts += 1
|
228
|
+
retry
|
229
|
+
end
|
230
|
+
|
231
|
+
raise if !queue_initialized?
|
232
|
+
end
|
215
233
|
end
|
234
|
+
|
235
|
+
puts "Finished pushing #{@total} tests to the queue in #{duration.round(2)}s."
|
216
236
|
end
|
217
237
|
register
|
218
238
|
redis.expire(key('workers'), config.redis_ttl)
|
data/lib/ci/queue/static.rb
CHANGED
data/lib/ci/queue/version.rb
CHANGED
@@ -223,7 +223,7 @@ module Minitest
|
|
223
223
|
|
224
224
|
failing_order = queue.candidates
|
225
225
|
step("Final validation")
|
226
|
-
|
226
|
+
if run_tests_in_fork(failing_order)
|
227
227
|
step(yellow("The bisection was inconclusive, there might not be any leaky test here."))
|
228
228
|
File.write('log/test_order.log', "")
|
229
229
|
exit! 1
|
@@ -314,7 +314,8 @@ module Minitest
|
|
314
314
|
private
|
315
315
|
|
316
316
|
attr_reader :queue_config, :options, :command, :argv
|
317
|
-
|
317
|
+
attr_writer :queue_url
|
318
|
+
attr_accessor :queue, :grind_list, :grind_count, :load_paths, :verbose
|
318
319
|
|
319
320
|
def require_worker_id!
|
320
321
|
if queue.distributed?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ci-queue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.58.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Boussier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -242,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
242
242
|
- !ruby/object:Gem::Version
|
243
243
|
version: '0'
|
244
244
|
requirements: []
|
245
|
-
rubygems_version: 3.5.
|
245
|
+
rubygems_version: 3.5.20
|
246
246
|
signing_key:
|
247
247
|
specification_version: 4
|
248
248
|
summary: Distribute tests over many workers using a queue
|