MCPcopy Create free account
hub / github.com/apache/arrow / build_message

Method build_message

dev/release/binary-task.rb:138–176  ·  view source on GitHub ↗
(time_current, throughput)

Source from the content-addressed store, hash-verified

136 end
137
138 def build_message(time_current, throughput)
139 percent = (@count_current / @count_max.to_f) * 100
140 formatted_count = "[%s/%s]" % [
141 format_count(@count_current),
142 format_count(@count_max),
143 ]
144 elapsed_second = time_current - @time_start
145 if throughput.zero?
146 rest_second = 0
147 else
148 rest_second = (@count_max - @count_current) / throughput
149 end
150 separator = " - "
151 progress = "%5.1f%% %s %s %s %s" % [
152 percent,
153 formatted_count,
154 format_time_interval(elapsed_second),
155 format_time_interval(rest_second),
156 format_throughput(throughput),
157 ]
158 label = @label
159
160 width = guess_terminal_width
161 return "#{label}#{separator}#{progress}" if width.nil?
162
163 return nil if progress.size > width
164
165 label_width = width - progress.size - separator.size
166 if label.size > label_width
167 ellipsis = "..."
168 shorten_label_width = label_width - ellipsis.size
169 if shorten_label_width < 1
170 return progress
171 else
172 label = label[0, shorten_label_width] + ellipsis
173 end
174 end
175 "#{label}#{separator}#{progress}"
176 end
177
178 def format_count(count)
179 "%d" % count

Callers

nothing calls this directly

Calls 2

to_fMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected