kafka.tools.assigner.actions.balancemodules.rackaware

kafka.tools.assigner.actions.balancemodules.rackaware.check_partition_swappable(replicas_a, replicas_b, pos)

Check if the broker at position pos in the first replica list can be swapped with the replica at position pos in the second list 1. replicas_a[pos] must not be in the replicas_b list 2. replicas_b[pos] must not be in the replicas_a list 3. replicas_a[pos] must have a different rack than the replicas in replicas_b (except for replicas_b[pos]) 4. replicas_b[pos] must have a different rack than the replicas in replicas_a (except for replicas_a[pos])

Params replicas_a:
 the first replica list
Params replicas_b:
 the second replica list
Params pos:the position in the replica list to be replaced
Returns:True if the broker can be swapped into this replica list, False otherwise
kafka.tools.assigner.actions.balancemodules.rackaware.difference_in_size_to_last_partition(partition, partitions)

Return the difference in size between the specified Partition and the last Partition in the provided list. If the list is empty, return infinity.

Params partition:
 a Partition object to use for calculating the difference
Params partitions:
 a list of Partition objects
Returns:The difference in size between partition and the last Partition in the partitions list, or infinity
kafka.tools.assigner.actions.balancemodules.rackaware.racks_for_replica_list(replicas, pos=None)

Returns a set of racks for each of the given replicas in the list Skip the replica at position pos, if specified

Params replicas:
 a list of Broker objects
Params pos:a replica position to skip, or None to not skip a replica
Returns:a list of racks