Exemplo n.º 1
0
 def __init__(self, zk: BukuExhibitor, broker_ids: list, empty_brokers: list, exclude_topics: list,
              parallelism: int = 1):
     self.zk = zk
     self.all_broker_ids = sorted(int(id_) for id_ in broker_ids)
     self.broker_ids = sorted(int(id_) for id_ in broker_ids if id_ not in empty_brokers)
     self.broker_racks = zk.get_broker_racks()
     self.exclude_topics = exclude_topics
     self.broker_distribution = None
     self.source_distribution = None
     self.action_queue = []
     self.state = OptimizedRebalanceChange._LOAD_STATE
     self.parallelism = parallelism
Exemplo n.º 2
0
 def __init__(self, zk: BukuExhibitor, broker_ids: list, empty_brokers: list, exclude_topics: list,
              throttle: int = 100000000, parallelism: int = 1):
     self.zk = zk
     self.all_broker_ids = sorted(int(id_) for id_ in broker_ids)
     self.broker_ids = sorted(int(id_) for id_ in broker_ids if id_ not in empty_brokers)
     self.broker_racks = zk.get_broker_racks()
     self.exclude_topics = exclude_topics
     self.broker_distribution = None
     self.source_distribution = None
     self.action_queue = []
     self.state = OptimizedRebalanceChange._LOAD_STATE
     self.parallelism = parallelism
     self.throttle_manager = RebalanceThrottleManager(self.zk, throttle)
Exemplo n.º 3
0
def select_fat_slim_brokers(zk: BukuExhibitor, sorted_stats: list):
    racks = zk.get_broker_racks()
    if any([rack is None for rack in racks.values()]):
        return sorted_stats[0], sorted_stats[-1]
    for i in range(len(sorted_stats) - 1):
        fat_broker = sorted_stats[i]
        fat_rack = racks[int(fat_broker[0])]
        for j in range(len(sorted_stats) -1, i, -1):
            slim_broker = sorted_stats[j]
            slim_rack = racks[int(slim_broker[0])]
            if slim_rack == fat_rack:
                return fat_broker, slim_broker

    return None, None
Exemplo n.º 4
0
def select_fat_slim_brokers(zk: BukuExhibitor, sorted_stats: list):
    racks = zk.get_broker_racks()
    if any([rack is None for rack in racks.values()]):
        return sorted_stats[0], sorted_stats[-1]
    for i in range(len(sorted_stats) - 1):
        fat_broker = sorted_stats[i]
        fat_rack = racks[int(fat_broker[0])]
        for j in range(len(sorted_stats) - 1, i, -1):
            slim_broker = sorted_stats[j]
            slim_rack = racks[int(slim_broker[0])]
            if slim_rack == fat_rack:
                return fat_broker, slim_broker

    return None, None