fasten 0.12.6 → 0.12.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/fasten/support/fork_worker.rb +7 -15
- data/lib/fasten/support/state.rb +31 -5
- data/lib/fasten/support/stats.rb +10 -9
- data/lib/fasten/task_manager.rb +1 -1
- data/lib/fasten/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9dd4cb73dcf32492c0e11fac100e3726acdff174e0233e41728459f226a7cec1
|
4
|
+
data.tar.gz: 7d4981e1ee8793750cedf2bb153fc60b4a27c5f0802db03a9c02f4202205bc07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b856359819576b19d03223a8d7c927b4f6698aa51e4fb7c4baf97b83566db6762c9f42f7242a055c5830af23a1af1e612db1a6b6cc227264b20c571718020980
|
7
|
+
data.tar.gz: 7311a2544fe423929c45c3ce82dd61ebdfdd2e1c310d1cee3096b154571f67858d71f4b450c74dec94ff292ce77d4cd5e5b4469a4f32590a381e0cedd71cb1e0
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -40,7 +40,7 @@ It has been released so people can try it and make feature requests, comments an
|
|
40
40
|
- [x] Press ⬅️ or ➡️ keys to dynamically increase/decrease number of jobs
|
41
41
|
- [ ] Use ⬆️ and ⬇️ to select tasks
|
42
42
|
- [ ] Calculate ETA, assuming all tasks take same time
|
43
|
-
- [
|
43
|
+
- [x] Calculate ETA, based on saved tasks statistics
|
44
44
|
- [ ] Live tail -f of selected tasks
|
45
45
|
|
46
46
|
### UI/Console
|
@@ -75,10 +75,6 @@ module Fasten
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def redirect_std(path)
|
78
|
-
logger.reopen($stdout)
|
79
|
-
|
80
|
-
@saved_stdout_instance = $stdout.clone
|
81
|
-
@saved_stderr_instance = $stderr.clone
|
82
78
|
@saved_stdout_constant = STDOUT.clone
|
83
79
|
@saved_stderr_constant = STDERR.clone
|
84
80
|
|
@@ -86,24 +82,20 @@ module Fasten
|
|
86
82
|
@redirect_log = File.new path, 'a'
|
87
83
|
@redirect_log.sync = true
|
88
84
|
|
89
|
-
$stdout.reopen @redirect_log
|
90
|
-
$stderr.reopen @redirect_log
|
91
85
|
STDOUT.reopen @redirect_log
|
92
86
|
STDERR.reopen @redirect_log
|
87
|
+
|
88
|
+
logger.reopen($stdout)
|
93
89
|
end
|
94
90
|
|
95
91
|
def restore_std
|
96
|
-
|
97
|
-
$VERBOSE = nil
|
92
|
+
@redirect_log.close
|
98
93
|
|
99
|
-
|
100
|
-
|
101
|
-
Object.const_set :STDOUT, @saved_stdout_constant
|
102
|
-
Object.const_set :STDERR, @saved_stderr_constant
|
94
|
+
STDOUT.reopen @saved_stdout_constant
|
95
|
+
STDERR.reopen @saved_stderr_constant
|
103
96
|
|
104
|
-
@
|
105
|
-
|
106
|
-
$VERBOSE = oldverbose
|
97
|
+
@saved_stdout_constant = nil
|
98
|
+
@saved_stderr_constant = nil
|
107
99
|
end
|
108
100
|
end
|
109
101
|
end
|
data/lib/fasten/support/state.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'digest'
|
2
|
+
|
1
3
|
module Fasten
|
2
4
|
module Support
|
3
5
|
module State
|
@@ -28,20 +30,44 @@ module Fasten
|
|
28
30
|
state == :QUITTING
|
29
31
|
end
|
30
32
|
|
31
|
-
def
|
32
|
-
return @
|
33
|
+
def last_stat
|
34
|
+
return @last_stat if defined? @last_stat
|
33
35
|
|
34
36
|
return {} unless @runner
|
35
37
|
|
36
|
-
@
|
38
|
+
@last_stat = runner.stats_last(self)
|
37
39
|
end
|
38
40
|
|
39
41
|
def last_avg
|
40
|
-
@last_avg ||=
|
42
|
+
@last_avg ||= last_stat['avg']
|
41
43
|
end
|
42
44
|
|
43
45
|
def last_err
|
44
|
-
@last_err ||=
|
46
|
+
@last_err ||= last_stat['err']
|
47
|
+
end
|
48
|
+
|
49
|
+
def deps
|
50
|
+
return @deps if defined? @deps
|
51
|
+
|
52
|
+
str = deps_str
|
53
|
+
|
54
|
+
@deps = str && Digest::SHA1.hexdigest(str)
|
55
|
+
end
|
56
|
+
|
57
|
+
def deps_str
|
58
|
+
if is_a? Fasten::Task
|
59
|
+
if after.is_a? Array
|
60
|
+
after.sort_by do |task|
|
61
|
+
task.is_a?(Fasten::Task) ? task.name : task
|
62
|
+
end&.join(', ')
|
63
|
+
else
|
64
|
+
after
|
65
|
+
end
|
66
|
+
elsif is_a? Fasten::Runner
|
67
|
+
tasks.sort_by(&:name).map do |task|
|
68
|
+
[task.name, task.deps_str].compact.join(': ')
|
69
|
+
end.join("\n")
|
70
|
+
end
|
45
71
|
end
|
46
72
|
end
|
47
73
|
end
|
data/lib/fasten/support/stats.rb
CHANGED
@@ -21,16 +21,16 @@ module Fasten
|
|
21
21
|
return unless @stats_path && File.exist?(@stats_path)
|
22
22
|
|
23
23
|
self.stats_data = []
|
24
|
-
CSV.foreach(@stats_path, headers: true) do |row|
|
24
|
+
CSV.foreach(@stats_path, headers: true, converters: [:all]) do |row|
|
25
25
|
stats_data << row.to_h
|
26
26
|
end
|
27
27
|
|
28
28
|
@tasks.each do |task|
|
29
29
|
task.runner = self
|
30
|
-
task.
|
30
|
+
task.last_stat
|
31
31
|
end
|
32
32
|
self.runner = self
|
33
|
-
|
33
|
+
last_stat
|
34
34
|
|
35
35
|
@tasks.waiting = nil
|
36
36
|
rescue StandardError
|
@@ -40,7 +40,7 @@ module Fasten
|
|
40
40
|
def save_stats
|
41
41
|
return unless @stats_path && stats_data
|
42
42
|
|
43
|
-
keys = %w[state kind name run cnt avg std err ini fin]
|
43
|
+
keys = %w[state kind name run cnt avg std err ini fin deps]
|
44
44
|
|
45
45
|
CSV.open(@stats_path, 'wb') do |csv|
|
46
46
|
csv << keys
|
@@ -58,6 +58,7 @@ module Fasten
|
|
58
58
|
'ini' => target.ini.to_f,
|
59
59
|
'fin' => target.fin.to_f,
|
60
60
|
'run' => target.fin - target.ini,
|
61
|
+
'deps' => target.deps,
|
61
62
|
'worker' => target.respond_to?(:worker) ? target.worker.name : nil }
|
62
63
|
end
|
63
64
|
|
@@ -76,7 +77,7 @@ module Fasten
|
|
76
77
|
stats_data << entry
|
77
78
|
stats_entries << entry
|
78
79
|
|
79
|
-
history =
|
80
|
+
history = stats_run_history(entry)
|
80
81
|
|
81
82
|
update_stats(history, entry)
|
82
83
|
end
|
@@ -123,12 +124,12 @@ module Fasten
|
|
123
124
|
task: hformat(sub), runner: hformat(tot, sub), saved: hformat(sub - tot, sub), jobs: jobs.to_s)
|
124
125
|
end
|
125
126
|
|
126
|
-
def
|
127
|
-
stats_data.select { |
|
127
|
+
def stats_run_history(entry)
|
128
|
+
stats_data.select { |item| %w[state kind name deps].all? { |key| item[key] == entry[key] } }.map { |item| item['run'] }
|
128
129
|
end
|
129
130
|
|
130
|
-
def stats_last(
|
131
|
-
stats_data.select { |
|
131
|
+
def stats_last(target)
|
132
|
+
stats_data.select { |item| %w[kind name deps].all? { |key| item[key] == target.send(key) } }.last || {}
|
132
133
|
end
|
133
134
|
|
134
135
|
def update_stats(history, entry)
|
data/lib/fasten/task_manager.rb
CHANGED
@@ -160,7 +160,7 @@ module Fasten
|
|
160
160
|
@waiting.sort_by!.with_index do |task, index|
|
161
161
|
task.state = :WAIT
|
162
162
|
last_avg = task.last_avg || 0
|
163
|
-
[-task.run_score, -last_avg
|
163
|
+
[-task.run_score, -last_avg, index]
|
164
164
|
end
|
165
165
|
else
|
166
166
|
raise "Unknown priority #{@runner.priority}"
|
data/lib/fasten/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fasten
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aldrin Martoq
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|