davinci_threader 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/davinci_threader/main.rb +11 -5
- data/lib/davinci_threader/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: 6860aea4e0212e000626749ce01741bb838fc906bc519ae03527ab15750ca7fc
|
4
|
+
data.tar.gz: a68a066cc391ab7f133d4bb2cacfe6e66a3e7ed045a2d172d4d8cd5977b03a35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e68d045efd1505421ea255aa60f3a90a37c60362c71187e16e201d608f5d4bb7361f21f1ee4fc41cf51e3faabc1dab376d52bb2d8f75cf25b56c3ce2e648045b
|
7
|
+
data.tar.gz: 97cf086fcaecfc891329ab9c504040105d90653f3e9c2faf5fe66d0bb7e6b8e33c5f1b0e0f7ac3df5afcfab2e112ddede5e23c3d85f45fbacc04ebe5166da163
|
@@ -35,6 +35,7 @@ module DavinciThreader
|
|
35
35
|
@show_output
|
36
36
|
end
|
37
37
|
attr_accessor :synchronous_items
|
38
|
+
attr_accessor :synchronous_completed
|
38
39
|
attr_reader :thread_count
|
39
40
|
# ======================================================
|
40
41
|
|
@@ -53,6 +54,7 @@ module DavinciThreader
|
|
53
54
|
self.asynchronous = true
|
54
55
|
self.show_output = true
|
55
56
|
self.synchronous_items = []
|
57
|
+
self.synchronous_completed = 0
|
56
58
|
@threads = []
|
57
59
|
@thread_count = 0
|
58
60
|
|
@@ -68,7 +70,10 @@ module DavinciThreader
|
|
68
70
|
@threads.each(&:join)
|
69
71
|
@threads_finished_at = Time.now
|
70
72
|
@monitor.try(:exit)
|
71
|
-
|
73
|
+
if self.show_output && @synchronous
|
74
|
+
self.printout
|
75
|
+
print "\n"
|
76
|
+
end
|
72
77
|
@synchronous.try(:join)
|
73
78
|
@synchronous.try(:exit)
|
74
79
|
puts "\n-> Done!".light_green if self.show_output && self.log
|
@@ -102,6 +107,7 @@ module DavinciThreader
|
|
102
107
|
else
|
103
108
|
yield(self.synchronous_items.first)
|
104
109
|
self.synchronous_items.shift
|
110
|
+
self.synchronous_completed += 1
|
105
111
|
self.synchronous_printout if self.show_output && @threads_finished_at
|
106
112
|
end
|
107
113
|
end
|
@@ -183,13 +189,13 @@ module DavinciThreader
|
|
183
189
|
elapsed_time = Time.now - @threads_finished_at
|
184
190
|
@synchronous_remaining = self.synchronous_items.count
|
185
191
|
@synchronous_start_count ||= @synchronous_remaining
|
186
|
-
@
|
187
|
-
if @
|
188
|
-
@synchronous_rate_per_second = @
|
192
|
+
@synchronous_completed_after_start = @synchronous_start_count - @synchronous_remaining
|
193
|
+
if @synchronous_completed_after_start > 0
|
194
|
+
@synchronous_rate_per_second = @synchronous_completed_after_start.to_f / elapsed_time
|
189
195
|
seconds_remaining = @synchronous_remaining.to_f / @synchronous_rate_per_second
|
190
196
|
@synchronous_nice_time = Time.at(seconds_remaining).utc.strftime("%H:%M:%S")
|
191
197
|
end
|
192
|
-
print "\r#{"Synchronous".purple} -> Remaining: #{"#{@synchronous_remaining}".light_yellow} :: Completed: #{"#{
|
198
|
+
print "\r#{"Synchronous".purple} -> Remaining: #{"#{@synchronous_remaining}".light_yellow} :: Completed: #{"#{self.synchronous_completed}".light_green} :: Rate: #{"#{'%.2f' % ((@synchronous_rate_per_second || 0) * 60.0)}".light_cyan} :: #{"#{@synchronous_nice_time}".light_green} "
|
193
199
|
end
|
194
200
|
# ======================================================
|
195
201
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: davinci_threader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- onlyexcellence
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|