-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Verify python source files with flake8.
Fixes #994 Signed-off-by: Gil Bregman <[email protected]>
- Loading branch information
Showing
18 changed files
with
570 additions
and
585 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,14 +7,8 @@ | |
# Authors: [email protected] | ||
# | ||
|
||
#import uuid | ||
import errno | ||
import threading | ||
import time | ||
import json | ||
import re | ||
from .utils import GatewayLogger | ||
from .config import GatewayConfig | ||
from .proto import gateway_pb2 as pb2 | ||
|
||
class Rebalance: | ||
|
@@ -51,8 +45,8 @@ def auto_rebalance_task(self, death_event): | |
def find_min_loaded_group(self, grp_list)->int: | ||
min_load = 2000 | ||
chosen_ana_group = 0 | ||
for ana_grp in self.gw_srv.ana_grp_ns_load : | ||
if ana_grp in grp_list : | ||
for ana_grp in self.gw_srv.ana_grp_ns_load: | ||
if ana_grp in grp_list: | ||
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 | ||
|
@@ -66,12 +60,12 @@ def find_min_loaded_group(self, grp_list)->int: | |
def find_min_loaded_group_in_subsys(self, nqn, grp_list)->int: | ||
min_load = 2000 | ||
chosen_ana_group = 0 | ||
for ana_grp in grp_list : | ||
if self.gw_srv.ana_grp_ns_load[ana_grp] == 0: | ||
self.gw_srv.ana_grp_subs_load[ana_grp][nqn] = 0 | ||
return 0, ana_grp | ||
for ana_grp in grp_list: | ||
if self.gw_srv.ana_grp_ns_load[ana_grp] == 0: | ||
self.gw_srv.ana_grp_subs_load[ana_grp][nqn] = 0 | ||
return 0, ana_grp | ||
for ana_grp in self.gw_srv.ana_grp_subs_load : | ||
if ana_grp in grp_list : | ||
if ana_grp in grp_list: | ||
if nqn in self.gw_srv.ana_grp_subs_load[ana_grp]: | ||
if self.gw_srv.ana_grp_subs_load[ana_grp][nqn] <= min_load: | ||
min_load = self.gw_srv.ana_grp_subs_load[ana_grp][nqn] | ||
|
@@ -119,8 +113,8 @@ def rebalance_logic(self, request, context)->int: | |
self.logger.info(f"warning: empty group {ana_grp} of Deleting GW still appears Optimized") | ||
return 1 | ||
else : | ||
if not ongoing_scale_down_rebalance and (self.gw_srv.ana_grp_state[worker_ana_group] == pb2.ana_state.OPTIMIZED) : | ||
# if my optimized ana group == worker-ana-group or worker-ana-group is also in optimized state on this GW machine | ||
if not ongoing_scale_down_rebalance and (self.gw_srv.ana_grp_state[worker_ana_group] == pb2.ana_state.OPTIMIZED) : | ||
# if my optimized ana group == worker-ana-group or worker-ana-group is also in optimized state on this GW machine | ||
for nqn in self.gw_srv.ana_grp_subs_load[ana_grp] : #need to search all nqns not only inside the current load | ||
num_ns_in_nqn = self.gw_srv.subsystem_nsid_bdev_and_uuid.get_namespace_count(nqn, None, 0) | ||
target_subs_per_ana = num_ns_in_nqn/num_active_ana_groups | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.