Skip to content

Commit

Permalink
add debug logs to rebalance
Browse files Browse the repository at this point in the history
Signed-off-by: Leonid Chernin <[email protected]>
  • Loading branch information
Leonid Chernin committed Dec 19, 2024
1 parent 719a6ee commit cbbb15f
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions control/rebalance.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from .utils import GatewayLogger
from .config import GatewayConfig
from .proto import gateway_pb2 as pb2

MIN_LOAD = 2000
class Rebalance:
"""Miscellaneous functions which do rebalance of ANA groups
"""
Expand Down Expand Up @@ -49,22 +49,27 @@ def auto_rebalance_task(self, death_event):
time.sleep(self.rebalance_period_sec)

def find_min_loaded_group(self, grp_list)->int:
min_load = 2000
min_load = MIN_LOAD
chosen_ana_group = 0
chosen_nqn = "null"
for ana_grp in self.gw_srv.ana_grp_ns_load :
if ana_grp in grp_list :
self.logger.debug(f" ana-group {ana_grp} total load {self.gw_srv.ana_grp_ns_load[ana_grp]}")
if self.gw_srv.ana_grp_ns_load[ana_grp] <= min_load:
min_load = self.gw_srv.ana_grp_ns_load[ana_grp]
chosen_ana_group = ana_grp
min_load = 2000
for nqn in self.gw_srv.ana_grp_subs_load[chosen_ana_group] :
if self.gw_srv.ana_grp_subs_load[chosen_ana_group][nqn] < min_load:
min_load = self.gw_srv.ana_grp_subs_load[chosen_ana_group][nqn]
chosen_nqn = nqn
min_load = MIN_LOAD
self.logger.debug(f"chosen ana-group {chosen_ana_group}")
if chosen_ana_group != 0 :
for nqn in self.gw_srv.ana_grp_subs_load[chosen_ana_group] :
self.logger.debug(f"chosen ana-group {chosen_ana_group} nqn {nqn} load {self.gw_srv.ana_grp_subs_load[chosen_ana_group][nqn]}")
if self.gw_srv.ana_grp_subs_load[chosen_ana_group][nqn] < min_load:
min_load = self.gw_srv.ana_grp_subs_load[chosen_ana_group][nqn]
chosen_nqn = nqn
return chosen_ana_group, chosen_nqn

def find_min_loaded_group_in_subsys(self, nqn, grp_list)->int:
min_load = 2000
min_load = MIN_LOAD
chosen_ana_group = 0
for ana_grp in grp_list :
if self.gw_srv.ana_grp_ns_load[ana_grp] == 0:
Expand Down

0 comments on commit cbbb15f

Please sign in to comment.