judges 0.57.3 → 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/bin/judges +5 -3
- data/judges.gemspec +1 -1
- data/lib/judges/commands/update.rb +8 -3
- data/lib/judges/judges.rb +21 -6
- data/lib/judges.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: 2c056c0de03fb4bdfd31ab41881fd2a45df0dce3eab4cae835cb460f54fefc51
|
|
4
|
+
data.tar.gz: 9297963335726bbcab1e7f5551eaff4ec04130b72622e902e334fed5795f598b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 734372c730e0f4fe9f8e350dce2cb550f1cdde850934394a880ed1fd0682897da74659e8ed53799a0f28b6256e1ff7fb666daeb68b3f980711f727c09d18a977
|
|
7
|
+
data.tar.gz: 28be015f363aa13e9365e22e24100b5178125a727c7907c2a2bc32c378d87b70dc7faf08fd1248156fdc3c7999166c4807c9619603ea19463cfc19eb79034cea
|
data/bin/judges
CHANGED
|
@@ -118,11 +118,11 @@ class JudgesGLI extend GLI::App
|
|
|
118
118
|
c.flag([:lib])
|
|
119
119
|
c.desc 'Shuffle judges, except those starting with the specified prefix'
|
|
120
120
|
c.flag([:shuffle], default_value: '')
|
|
121
|
-
c.desc 'Random seed for judge ordering
|
|
121
|
+
c.desc 'Random seed for judge ordering'
|
|
122
122
|
c.flag([:seed], default_value: 0, type: Integer)
|
|
123
|
-
c.desc 'Prioritize a judge to run before all others'
|
|
123
|
+
c.desc 'Prioritize a judge to run before all others (supports wildcards with *)'
|
|
124
124
|
c.flag([:boost], multiple: true)
|
|
125
|
-
c.desc 'Demote a judge to run after all others'
|
|
125
|
+
c.desc 'Demote a judge to run after all others (supports wildcards with *)'
|
|
126
126
|
c.flag([:demote], multiple: true)
|
|
127
127
|
c.desc 'Maximum time in seconds for the entire update cycle'
|
|
128
128
|
c.flag([:lifetime], default_value: 300, type: Integer)
|
|
@@ -142,6 +142,8 @@ class JudgesGLI extend GLI::App
|
|
|
142
142
|
c.switch([:statistics], default_value: false)
|
|
143
143
|
c.desc 'Expect at least one judge to be used (fail if none are used)'
|
|
144
144
|
c.switch([:'expect-judges'], default_value: true)
|
|
145
|
+
c.desc 'File to write churn information to (e.g., /tmp/churn.txt)'
|
|
146
|
+
c.flag([:churn])
|
|
145
147
|
run_it(c, 'update')
|
|
146
148
|
end
|
|
147
149
|
|
data/judges.gemspec
CHANGED
|
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
|
9
9
|
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
|
10
10
|
s.required_ruby_version = '>=3.2'
|
|
11
11
|
s.name = 'judges'
|
|
12
|
-
s.version = '0.
|
|
12
|
+
s.version = '0.58.0'
|
|
13
13
|
s.license = 'MIT'
|
|
14
14
|
s.summary = 'Command-Line Tool for a Factbase'
|
|
15
15
|
s.description =
|
|
@@ -70,9 +70,10 @@ class Judges::Update
|
|
|
70
70
|
epoch: @epoch, shuffle: opts['shuffle'], boost: opts['boost'],
|
|
71
71
|
demote: opts['demote'], seed: opts['seed']
|
|
72
72
|
)
|
|
73
|
+
churn = nil
|
|
73
74
|
begin
|
|
74
75
|
Timeout.timeout(opts['lifetime']) do
|
|
75
|
-
loop_them(judges, fb, opts, options)
|
|
76
|
+
churn = loop_them(judges, fb, opts, options)
|
|
76
77
|
end
|
|
77
78
|
rescue Timeout::Error, Timeout::ExitException => e
|
|
78
79
|
@loog.error("Terminated due to --lifetime=#{opts['lifetime']}")
|
|
@@ -80,6 +81,10 @@ class Judges::Update
|
|
|
80
81
|
@loog.info("Had to stop due to the --lifetime=#{opts['lifetime']}")
|
|
81
82
|
ensure
|
|
82
83
|
impex.export(fb)
|
|
84
|
+
if opts['churn'] && churn
|
|
85
|
+
File.write(opts['churn'], churn.to_s)
|
|
86
|
+
@loog.info("Churn written to #{opts['churn']}: #{churn}")
|
|
87
|
+
end
|
|
83
88
|
end
|
|
84
89
|
end
|
|
85
90
|
|
|
@@ -129,8 +134,8 @@ class Judges::Update
|
|
|
129
134
|
throw :"👍 Update completed in #{c} cycle(s), did #{churn}"
|
|
130
135
|
end
|
|
131
136
|
statistics&.report(@loog)
|
|
132
|
-
|
|
133
|
-
|
|
137
|
+
summarize(fb, churn, errors, c) if %w[add append].include?(opts['summary'])
|
|
138
|
+
churn
|
|
134
139
|
end
|
|
135
140
|
|
|
136
141
|
# Update the summary.
|
data/lib/judges/judges.rb
CHANGED
|
@@ -32,8 +32,8 @@ class Judges::Judges
|
|
|
32
32
|
# @param [Loog] loog Logging facility
|
|
33
33
|
# @param [Time] epoch Start time
|
|
34
34
|
# @param [String] shuffle Prefix for names of judges to shuffle
|
|
35
|
-
# @param [Array<String>] boost Names of judges to boost in priority
|
|
36
|
-
# @param [Array<String>] demote Names of judges to demote in priority
|
|
35
|
+
# @param [Array<String>] boost Names/patterns of judges to boost in priority (supports '*' wildcards)
|
|
36
|
+
# @param [Array<String>] demote Names/patterns of judges to demote in priority (supports '*' wildcards)
|
|
37
37
|
# @param [Integer] seed Random seed for judge ordering (default: 0)
|
|
38
38
|
def initialize(dir, lib, loog, epoch: Time.now, shuffle: '', boost: [], demote: [], seed: 0)
|
|
39
39
|
@dir = dir
|
|
@@ -66,8 +66,8 @@ class Judges::Judges
|
|
|
66
66
|
# determined by:
|
|
67
67
|
# 1. Randomly reorder judges (if shuffle prefix is empty, shuffle all judges;
|
|
68
68
|
# if prefix is not empty, shuffle only those NOT starting with the prefix)
|
|
69
|
-
# 2. Judges whose names match the boost
|
|
70
|
-
# 3. Judges whose names match the demote
|
|
69
|
+
# 2. Judges whose names match the boost patterns are placed first (supports '*' wildcards)
|
|
70
|
+
# 3. Judges whose names match the demote patterns are placed last (supports '*' wildcards)
|
|
71
71
|
#
|
|
72
72
|
# @yield [Judges::Judge] Yields each valid judge object
|
|
73
73
|
# @return [Enumerator] Returns an enumerator if no block is given
|
|
@@ -96,9 +96,9 @@ class Judges::Judges
|
|
|
96
96
|
demoted = []
|
|
97
97
|
normal = []
|
|
98
98
|
good.map { |a| a[0] }.each do |j|
|
|
99
|
-
if
|
|
99
|
+
if fits?(j.name, @boost)
|
|
100
100
|
boosted.append(j)
|
|
101
|
-
elsif
|
|
101
|
+
elsif fits?(j.name, @demote)
|
|
102
102
|
demoted.append(j)
|
|
103
103
|
else
|
|
104
104
|
normal.append(j)
|
|
@@ -124,4 +124,19 @@ class Judges::Judges
|
|
|
124
124
|
end
|
|
125
125
|
idx
|
|
126
126
|
end
|
|
127
|
+
|
|
128
|
+
private
|
|
129
|
+
|
|
130
|
+
# Checks if a judge name matches any of the given patterns.
|
|
131
|
+
# Patterns can contain '*' wildcards which are converted to '.*' regex patterns.
|
|
132
|
+
#
|
|
133
|
+
# @param [String] name The judge name to check
|
|
134
|
+
# @param [Array<String>, String, nil] patterns Array of patterns, or single pattern string, may contain '*' wildcards
|
|
135
|
+
# @return [Boolean] true if name matches any pattern, false otherwise
|
|
136
|
+
def fits?(name, patterns)
|
|
137
|
+
return false if patterns.nil? || patterns.empty?
|
|
138
|
+
Array(patterns).any? do |pattern|
|
|
139
|
+
name.match?("\\A#{pattern.gsub('*', '.*')}\\z")
|
|
140
|
+
end
|
|
141
|
+
end
|
|
127
142
|
end
|
data/lib/judges.rb
CHANGED