From: Kefu Chai Date: Wed, 10 Feb 2021 07:31:54 +0000 (+0800) Subject: mgr/balancer: add balancer to flake8 test X-Git-Tag: v17.1.0~2944^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=47a50f24ca544567b9459f123b129e5fc2cb301f;p=ceph.git mgr/balancer: add balancer to flake8 test Signed-off-by: Kefu Chai --- diff --git a/src/pybind/mgr/balancer/__init__.py b/src/pybind/mgr/balancer/__init__.py index 8f210ac9247..ee85dc9d376 100644 --- a/src/pybind/mgr/balancer/__init__.py +++ b/src/pybind/mgr/balancer/__init__.py @@ -1 +1,2 @@ +# flake8: noqa from .module import Module diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index bdf7bd54d1c..ea857bac66f 100644 --- a/src/pybind/mgr/balancer/module.py +++ b/src/pybind/mgr/balancer/module.py @@ -210,7 +210,7 @@ class Eval: cdf of standard normal distribution: https://stackoverflow.com/a/29273201 ''' - score += target[k] * (math.erf(((adjusted - avg)/avg) / math.sqrt(2.0))) + score += target[k] * (math.erf(((adjusted - avg) / avg) / math.sqrt(2.0))) sum_weight += target[k] dev += (avg - adjusted) * (avg - adjusted) stddev = math.sqrt(dev / float(max(num - 1, 1))) @@ -1056,8 +1056,6 @@ class Module(MgrModule): # get current osd reweights orig_osd_weight = {a['osd']: a['weight'] for a in ms.osdmap_dump.get('osds', [])} - reweighted_osds = [a for a, b in orig_osd_weight.items() - if b < 1.0 and b > 0.0] # get current compat weight-set weights orig_ws = self.get_compat_weight_set_weights(ms) @@ -1071,7 +1069,6 @@ class Module(MgrModule): self.log.debug('roots %s', roots) visited: Dict[int, str] = {} overlap: Dict[int, List[str]] = {} - root_ids: Dict[str, int] = {} for root, wm in pe.target_by_root.items(): for osd in wm: if osd in visited: diff --git a/src/pybind/mgr/tox.ini b/src/pybind/mgr/tox.ini index dd7e1a43d63..8be4bd90ecc 100644 --- a/src/pybind/mgr/tox.ini +++ b/src/pybind/mgr/tox.ini @@ -115,6 +115,7 @@ basepython = python3 deps = flake8 modules = + balancer cephadm crash devicehealth