Class: Ktl::ReassignmentProgress
- Inherits:
-
Object
- Object
- Ktl::ReassignmentProgress
- Defined in:
- lib/ktl/reassignment_progress.rb
Instance Method Summary collapse
- #display(shell) ⇒ Object
-
#initialize(zk_client, options = {}) ⇒ ReassignmentProgress
constructor
A new instance of ReassignmentProgress.
Constructor Details
#initialize(zk_client, options = {}) ⇒ ReassignmentProgress
Returns a new instance of ReassignmentProgress.
5 6 7 8 9 10 11 |
# File 'lib/ktl/reassignment_progress.rb', line 5 def initialize(zk_client, ={}) @zk_client = zk_client @utils = [:utils] || Kafka::Utils::ZkUtils @logger = [:logger] || NullLogger.new @state_path = '/ktl/reassign' = end |
Instance Method Details
#display(shell) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ktl/reassignment_progress.rb', line 13 def display(shell) in_progress = reassignment_in_progress original = original_reassignment if in_progress && !in_progress.empty? original_size, remaining_size = original.size, in_progress.size done_percentage = (original_size - remaining_size).fdiv(original_size) * 100 @logger.info 'remaining partitions to reassign: %d (%.2f%% done)' % [remaining_size, done_percentage] if [:verbose] shell.print_table(table_data(in_progress), indent: 2 + 6) end else @logger.info 'no partitions remaining to reassign' end end |