- def health_check(self):
-
- global exit_code
- task = None
- exit_code = 1
-
- def health_check_callback(topic, command, params):
- global exit_code
- print("receiving callback {} {} {}".format(topic, command, params))
- if topic == "admin" and command == "ping" and params["to"] == "lcm" and params["from"] == "lcm":
- # print("received LCM ping")
- exit_code = 0
- task.cancel()
-
- try:
- task = asyncio.ensure_future(self.msg.aioread(("admin",), self.loop, health_check_callback))
- self.loop.run_until_complete(task)
- except Exception:
- pass
- exit(exit_code)
-