X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_policy_module%2Fcore%2Fagent.py;fp=osm_policy_module%2Fcore%2Fagent.py;h=3f87d168cb47c8e4cb507694ea47921361d466ea;hb=946821f0dcc61f0bf0fe6d78bc2dc7db2636296c;hp=34b852aed996f4816446c8c8c9da2a0b8f8a4b6e;hpb=585eb0cc31cd389b17f4e50d261efdd9cdc00506;p=osm%2FPOL.git diff --git a/osm_policy_module/core/agent.py b/osm_policy_module/core/agent.py index 34b852a..3f87d16 100644 --- a/osm_policy_module/core/agent.py +++ b/osm_policy_module/core/agent.py @@ -23,6 +23,8 @@ ## import asyncio import logging +from pathlib import Path +import os import peewee @@ -52,14 +54,18 @@ class PolicyModuleAgent: self.loop.run_until_complete(self.start()) async def start(self): + Path('/tmp/osm_pol_agent_health_flag').touch() topics = [ "ns", "alarm_response" ] await self.msg_bus.aioread(topics, self._process_msg) log.critical("Exiting...") + if os.path.exists('/tmp/osm_pol_agent_health_flag'): + os.remove('/tmp/osm_pol_agent_health_flag') async def _process_msg(self, topic, key, msg): + Path('/tmp/osm_pol_agent_health_flag').touch() log.debug("_process_msg topic=%s key=%s msg=%s", topic, key, msg) try: if key in ALLOWED_KAFKA_KEYS: