summaryrefslogtreecommitdiff
path: root/src/flufigut.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/flufigut.py')
-rwxr-xr-xsrc/flufigut.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/flufigut.py b/src/flufigut.py
index a3a8fd4..2371fb8 100755
--- a/src/flufigut.py
+++ b/src/flufigut.py
@@ -154,10 +154,30 @@ class Planet:
def __init__(self, desc):
self.atmosphere = {}
self.flow = {}
+ self.workers = {}
self._desc = desc
self._unassigned_components = []
+ #
+ # utils
+ def __add_worker(self, worker):
+ if worker.name in self.workers:
+ if worker.subname:
+ if not isinstance(self.workers[worker.name], dict):
+ raise Excepteption("worker '%s' seems to have entries with and without subnames" % worker.name)
+ if worker.subname not in self.workers[worker.name]:
+ self.workers[worker.name][worker.subname] = 1
+ else:
+ self.workers[worker.name][worker.subname] += 1
+ else:
+ self.workers[worker.name] += 1
+ else:
+ if worker.subname:
+ self.workers[worker.name] = {worker.subname: 1}
+ else:
+ self.workers[worker.name] = 1
+
def __get_worker(self, comp_name):
match_prefix_len = 0
match = None
@@ -179,6 +199,7 @@ class Planet:
self._unassigned_components.append(comp_name)
return None
+ self.__add_worker(match.worker)
return match.worker
#
@@ -625,6 +646,11 @@ if __name__ == '__main__':
# print("**")
# __pp.pprint(p.flow)
# print("**")
+ # print("**************************")
+ # print("** _workers_ **")
+ # print("**")
+ # __pp.pprint(p.workers)
+ # print("**")
# print("****************************************************")
k8s = K8sDeployment(d, p)