diff --git a/regularflow/__init__.py b/regularflow/__init__.py index 9fd2731..71b334b 100644 --- a/regularflow/__init__.py +++ b/regularflow/__init__.py @@ -8,6 +8,7 @@ """ from .apiFlow import newAgent +from .apiFlow import cycleManager diff --git a/regularflow/apiFlow.py b/regularflow/apiFlow.py index 711e3dd..afd42a4 100644 --- a/regularflow/apiFlow.py +++ b/regularflow/apiFlow.py @@ -25,6 +25,6 @@ def newAgent(myId:int, consumerConfig: dict, producerConfig: dict, clusterTopic: return agent def cycleManager(agents: list, nbs: list) : - for i in range(agents) : + for i in range(len(agents)) : agents[i].nbIteration = nbs[i] \ No newline at end of file diff --git a/regularflow/utils_regularflow/agent.py b/regularflow/utils_regularflow/agent.py index 364c27f..ec16e19 100644 --- a/regularflow/utils_regularflow/agent.py +++ b/regularflow/utils_regularflow/agent.py @@ -62,7 +62,7 @@ def _managementCycleLife(self) : jsonData = loads(msg.value().decode('utf-8')) print(jsonData) sleep(1) - self.communication._managementDataSending(jsonData) + fromWho = self.communication._managementDataSending(jsonData) if i > self.nbIteration : self.communication.consumer.close() data = {"from": -1, "close": -1} diff --git a/regularflow/utils_regularflow/communication.py b/regularflow/utils_regularflow/communication.py index 8024e85..df11d8c 100644 --- a/regularflow/utils_regularflow/communication.py +++ b/regularflow/utils_regularflow/communication.py @@ -115,7 +115,8 @@ def _managementDataSending(self, jsonData: dict) : self._sendTo(data, fromWho, self.clusterTopic) elif jsonData[key][INDEXCAR] > 0 : data = {"from": -1, "cars": jsonData[key][INDEXCAR] - 1} - self._sendTo(data, fromWho, self.clusterTopic) + self._sendTo(data, fromWho, self.clusterTopic) + return fromWho #<-------------------------------------- LISTENING --------------------------------------------------------------------------> diff --git a/regularflow/utils_regularflow/refreshTopic.py b/regularflow/utils_regularflow/refreshTopic.py index ed7f3cd..c02228d 100755 --- a/regularflow/utils_regularflow/refreshTopic.py +++ b/regularflow/utils_regularflow/refreshTopic.py @@ -21,6 +21,7 @@ adminClient.delete_topics(["__consumer_offsets"]) for i in range(len(topicList)) : newTopics.append(NewTopic(topicList[i], partitions[i] , replications[i])) + print(newTopics) adminClient.create_topics(newTopics) diff --git a/setup.py b/setup.py index 6620179..7113a05 100755 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ from setuptools import setup, find_packages -__version__ = "1.0.3" +__version__ = "1.0.6" try: # for pip >= 10