]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/balancer: add balancer to flake8 test
authorKefu Chai <kchai@redhat.com>
Wed, 10 Feb 2021 07:31:54 +0000 (15:31 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 10 Feb 2021 15:12:30 +0000 (23:12 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/pybind/mgr/balancer/__init__.py
src/pybind/mgr/balancer/module.py
src/pybind/mgr/tox.ini

index 8f210ac9247ea49624b20582ca8206e56055fbcd..ee85dc9d376e61235d719cf25585769bd07299a6 100644 (file)
@@ -1 +1,2 @@
+# flake8: noqa
 from .module import Module
index bdf7bd54d1c8a830768487a38ec0b6e9211025f9..ea857bac66ffc563d667864c6ab8ab30649f422a 100644 (file)
@@ -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:
index dd7e1a43d63b096b7245d88eb6965a8a77837bec..8be4bd90eccbf02fdbcdb843e84e6938303a84d5 100644 (file)
@@ -115,6 +115,7 @@ basepython = python3
 deps =
     flake8
 modules =
+    balancer
     cephadm
     crash
     devicehealth