fbe 0.37.0 → 0.38.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/fbe/conclude.rb +13 -9
- data/lib/fbe/consider.rb +4 -2
- data/lib/fbe/iterate.rb +19 -16
- data/lib/fbe/unmask_repos.rb +10 -4
- data/lib/fbe.rb +1 -1
- 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: 04d71d826c4bd4c4ee4a8b22f04561ca31cc997f4e398f129e7d792d65a898ef
|
4
|
+
data.tar.gz: 7a95d256e71402d57fcf2e5f47d77a70c1edb4112bd961344b879470ededfe77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e21419e49aeebc86275f380df70423c030fad50c83626d8b45a28716589d75047fce9e8ee0ea81b5c5b6dd6bf7324a1f0d07625d28c750bef3de1d3324a4e28
|
7
|
+
data.tar.gz: e8c45307769eea587953ecb193c2516da44020007a5b8e0c45516f8f71a78100758e38fdc3224c707f50e95459ad37695a0848b7129dae868be2989b4351a5a7
|
data/Gemfile.lock
CHANGED
data/lib/fbe/conclude.rb
CHANGED
@@ -16,17 +16,19 @@ require_relative 'octo'
|
|
16
16
|
# @param [Hash] global The hash for global caching
|
17
17
|
# @param [Judges::Options] options The options coming from the +judges+ tool
|
18
18
|
# @param [Loog] loog The logging facility
|
19
|
+
# @param [Time] epoch When the entire update started
|
20
|
+
# @param [Time] kickoff When the particular judge started
|
19
21
|
# @yield [Factbase::Fact] The fact
|
20
22
|
def Fbe.conclude(
|
21
23
|
fb: Fbe.fb, judge: $judge, loog: $loog, options: $options, global: $global,
|
22
|
-
|
24
|
+
epoch: $epoch || Time.now, kickoff: $kickoff || Time.now, &
|
23
25
|
)
|
24
26
|
raise 'The fb is nil' if fb.nil?
|
25
27
|
raise 'The $judge is not set' if judge.nil?
|
26
28
|
raise 'The $global is not set' if global.nil?
|
27
29
|
raise 'The $options is not set' if options.nil?
|
28
30
|
raise 'The $loog is not set' if loog.nil?
|
29
|
-
c = Fbe::Conclude.new(fb:, judge:, loog:, options:, global:,
|
31
|
+
c = Fbe::Conclude.new(fb:, judge:, loog:, options:, global:, epoch:, kickoff:)
|
30
32
|
c.instance_eval(&)
|
31
33
|
end
|
32
34
|
|
@@ -61,13 +63,16 @@ class Fbe::Conclude
|
|
61
63
|
# @param [Hash] global The hash for global caching
|
62
64
|
# @param [Judges::Options] options The options coming from the +judges+ tool
|
63
65
|
# @param [Loog] loog The logging facility
|
64
|
-
|
66
|
+
# @param [Time] epoch When the entire update started
|
67
|
+
# @param [Time] kickoff When the particular judge started
|
68
|
+
def initialize(fb:, judge:, global:, options:, loog:, epoch:, kickoff:)
|
65
69
|
@fb = fb
|
66
70
|
@judge = judge
|
67
71
|
@loog = loog
|
68
72
|
@options = options
|
69
73
|
@global = global
|
70
|
-
@
|
74
|
+
@epoch = epoch
|
75
|
+
@kickoff = kickoff
|
71
76
|
@query = nil
|
72
77
|
@follows = []
|
73
78
|
@lifetime_aware = true
|
@@ -192,18 +197,17 @@ class Fbe::Conclude
|
|
192
197
|
def roll(&)
|
193
198
|
passed = 0
|
194
199
|
oct = Fbe.octo(loog: @loog, options: @options, global: @global)
|
195
|
-
started = Time.now
|
196
200
|
@fb.query(@query).each do |a|
|
197
201
|
if @quota_aware && oct.off_quota?
|
198
202
|
@loog.info('We ran out of GitHub quota, must stop here')
|
199
203
|
break
|
200
204
|
end
|
201
|
-
if @lifetime_aware && @options.lifetime && Time.now - @
|
202
|
-
@loog.debug("We ran out of lifetime (#{@
|
205
|
+
if @lifetime_aware && @options.lifetime && Time.now - @epoch > @options.lifetime * 0.9
|
206
|
+
@loog.debug("We ran out of lifetime (#{@epoch.ago} already), must stop here")
|
203
207
|
break
|
204
208
|
end
|
205
|
-
if @timeout_aware && @options.timeout && Time.now -
|
206
|
-
@loog.debug("We've spent more than #{
|
209
|
+
if @timeout_aware && @options.timeout && Time.now - @kickoff > @options.timeout * 0.9
|
210
|
+
@loog.debug("We've spent more than #{kickoff.ago}, must stop here")
|
207
211
|
break
|
208
212
|
end
|
209
213
|
@fb.txn do |fbt|
|
data/lib/fbe/consider.rb
CHANGED
@@ -15,13 +15,15 @@ require_relative 'fb'
|
|
15
15
|
# @param [Hash] global The hash for global caching
|
16
16
|
# @param [Judges::Options] options The options coming from the +judges+ tool
|
17
17
|
# @param [Loog] loog The logging facility
|
18
|
+
# @param [Time] epoch When the entire update started
|
19
|
+
# @param [Time] kickoff When the particular judge started
|
18
20
|
# @yield [Factbase::Fact] The fact
|
19
21
|
def Fbe.consider(
|
20
22
|
query,
|
21
23
|
fb: Fbe.fb, judge: $judge, loog: $loog, options: $options, global: $global,
|
22
|
-
|
24
|
+
epoch: $epoch || Time.now, kickoff: $kickoff || Time.now, &
|
23
25
|
)
|
24
|
-
Fbe.conclude(fb:, judge:, loog:, options:, global:,
|
26
|
+
Fbe.conclude(fb:, judge:, loog:, options:, global:, epoch:, kickoff:) do
|
25
27
|
on query
|
26
28
|
consider(&)
|
27
29
|
end
|
data/lib/fbe/iterate.rb
CHANGED
@@ -37,12 +37,15 @@ require_relative 'unmask_repos'
|
|
37
37
|
# issue_id + 1
|
38
38
|
# end
|
39
39
|
# end
|
40
|
-
def Fbe.iterate(
|
40
|
+
def Fbe.iterate(
|
41
|
+
fb: Fbe.fb, loog: $loog, options: $options, global: $global,
|
42
|
+
epoch: $epoch || Time.now, kickoff: $kickoff || Time.now, &
|
43
|
+
)
|
41
44
|
raise 'The fb is nil' if fb.nil?
|
42
45
|
raise 'The $global is not set' if global.nil?
|
43
46
|
raise 'The $options is not set' if options.nil?
|
44
47
|
raise 'The $loog is not set' if loog.nil?
|
45
|
-
c = Fbe::Iterate.new(fb:, loog:, options:, global:,
|
48
|
+
c = Fbe::Iterate.new(fb:, loog:, options:, global:, epoch:, kickoff:)
|
46
49
|
c.instance_eval(&)
|
47
50
|
end
|
48
51
|
|
@@ -84,12 +87,13 @@ class Fbe::Iterate
|
|
84
87
|
# @param [Loog] loog The logging facility for debug output
|
85
88
|
# @param [Judges::Options] options The options containing repository configuration
|
86
89
|
# @param [Hash] global The hash for global caching of API responses
|
87
|
-
def initialize(fb:, loog:, options:, global:,
|
90
|
+
def initialize(fb:, loog:, options:, global:, epoch:, kickoff:)
|
88
91
|
@fb = fb
|
89
92
|
@loog = loog
|
90
93
|
@options = options
|
91
94
|
@global = global
|
92
|
-
@
|
95
|
+
@epoch = epoch
|
96
|
+
@kickoff = kickoff
|
93
97
|
@label = nil
|
94
98
|
@since = 0
|
95
99
|
@query = nil
|
@@ -227,7 +231,6 @@ class Fbe::Iterate
|
|
227
231
|
loog: @loog, options: @options, global: @global, quota_aware: @quota_aware
|
228
232
|
).map { |n| oct.repo_id_by_name(n) }
|
229
233
|
restarted = []
|
230
|
-
started = Time.now
|
231
234
|
before =
|
232
235
|
repos.to_h do |repo|
|
233
236
|
[
|
@@ -247,12 +250,12 @@ class Fbe::Iterate
|
|
247
250
|
@loog.info("We are off GitHub quota, time to stop after #{started.ago}")
|
248
251
|
break
|
249
252
|
end
|
250
|
-
if @lifetime_aware && @options.lifetime && Time.now - @
|
251
|
-
@loog.debug("We ran out of lifetime (#{@
|
253
|
+
if @lifetime_aware && @options.lifetime && Time.now - @epoch > @options.lifetime * 0.9
|
254
|
+
@loog.debug("We ran out of lifetime (#{@epoch.ago} already), must stop here")
|
252
255
|
break
|
253
256
|
end
|
254
|
-
if @timeout_aware && @options.timeout && Time.now -
|
255
|
-
@loog.debug("We've spent more than #{
|
257
|
+
if @timeout_aware && @options.timeout && Time.now - @kickoff > @options.timeout * 0.9
|
258
|
+
@loog.debug("We've spent more than #{@kickoff.ago}, must stop here")
|
256
259
|
break
|
257
260
|
end
|
258
261
|
repos.each do |repo|
|
@@ -260,12 +263,12 @@ class Fbe::Iterate
|
|
260
263
|
@loog.info("We are off GitHub quota, we must skip #{repo}")
|
261
264
|
break
|
262
265
|
end
|
263
|
-
if @lifetime_aware && @options.lifetime && Time.now - @
|
264
|
-
@loog.info("We are working for #{@
|
266
|
+
if @lifetime_aware && @options.lifetime && Time.now - @epoch > @options.lifetime * 0.9
|
267
|
+
@loog.info("We are working for #{@epoch.ago} already, won't check repository ##{repo}")
|
265
268
|
next
|
266
269
|
end
|
267
|
-
if @timeout_aware && @options.timeout && Time.now -
|
268
|
-
@loog.debug("We've spent more than #{
|
270
|
+
if @timeout_aware && @options.timeout && Time.now - @kickoff > @options.timeout * 0.9
|
271
|
+
@loog.debug("We've spent more than #{@kickoff.ago}, won't check repository ##{repo}")
|
269
272
|
break
|
270
273
|
end
|
271
274
|
next if restarted.include?(repo)
|
@@ -290,11 +293,11 @@ class Fbe::Iterate
|
|
290
293
|
seen[repo] += 1
|
291
294
|
end
|
292
295
|
unless seen.any? { |r, v| v < @repeats && !restarted.include?(r) }
|
293
|
-
@loog.debug("No more repos to scan (out of #{repos.size}), quitting after #{
|
296
|
+
@loog.debug("No more repos to scan (out of #{repos.size}), quitting after #{@kickoff.ago}")
|
294
297
|
break
|
295
298
|
end
|
296
299
|
if restarted.size == repos.size
|
297
|
-
@loog.debug("All #{repos.size} repos restarted, quitting after #{
|
300
|
+
@loog.debug("All #{repos.size} repos restarted, quitting after #{@kickoff.ago}")
|
298
301
|
break
|
299
302
|
end
|
300
303
|
end
|
@@ -308,6 +311,6 @@ class Fbe::Iterate
|
|
308
311
|
end
|
309
312
|
Fbe.overwrite(f, @label, before[repo], fb: @fb)
|
310
313
|
end
|
311
|
-
@loog.debug("Finished scanning #{repos.size} repos in #{
|
314
|
+
@loog.debug("Finished scanning #{repos.size} repos in #{@kickoff.ago}: #{seen.map { |k, v| "#{k}:#{v}" }.joined}")
|
312
315
|
end
|
313
316
|
end
|
data/lib/fbe/unmask_repos.rb
CHANGED
@@ -49,16 +49,18 @@ end
|
|
49
49
|
# @param [Judges::Options] options Options containing 'repositories' field with masks
|
50
50
|
# @param [Hash] global Global cache for storing API responses
|
51
51
|
# @param [Loog] loog Logger for debug output
|
52
|
-
# @param [Time]
|
52
|
+
# @param [Time] epoch When the entire update started
|
53
|
+
# @param [Time] kickoff When the particular judge started
|
53
54
|
# @param [quota_aware] Boolean Should we stop if quota is off?
|
54
55
|
# @param [lifetime_aware] Boolean Should we stop if lifetime is over?
|
56
|
+
# @param [timeout_aware] Boolean Should we stop if timeout is over?
|
55
57
|
# @return [Array<String>] Shuffled list of repository full names (e.g., 'org/repo')
|
56
58
|
# @raise [RuntimeError] If no repositories match the provided masks
|
57
59
|
# @note Exclusion patterns must start with '-' (e.g., '-org/pattern*')
|
58
60
|
# @note Results are shuffled to distribute load when processing
|
59
61
|
def Fbe.unmask_repos(
|
60
|
-
options: $options, global: $global, loog: $loog,
|
61
|
-
quota_aware: true, lifetime_aware: true
|
62
|
+
options: $options, global: $global, loog: $loog, epoch: $epoch || Time.now, kickoff: $kickoff || Time.now,
|
63
|
+
quota_aware: true, lifetime_aware: true, timeout_aware: true
|
62
64
|
)
|
63
65
|
raise 'Repositories mask is not specified' unless options.repositories
|
64
66
|
raise 'Repositories mask is empty' if options.repositories.empty?
|
@@ -90,7 +92,11 @@ def Fbe.unmask_repos(
|
|
90
92
|
loog.info("No GitHub quota left, it is time to stop at #{repo}")
|
91
93
|
break
|
92
94
|
end
|
93
|
-
if lifetime_aware && options.lifetime && Time.now -
|
95
|
+
if lifetime_aware && options.lifetime && Time.now - epoch > options.lifetime * 0.9
|
96
|
+
loog.info("No time left, it is time to stop at #{repo}")
|
97
|
+
break
|
98
|
+
end
|
99
|
+
if timeout_aware && options.timeout && Time.now - kickoff > options.timeout * 0.9
|
94
100
|
loog.info("No time left, it is time to stop at #{repo}")
|
95
101
|
break
|
96
102
|
end
|
data/lib/fbe.rb
CHANGED