From 040fb6fbbdce0c8607a9247e0bfc561cb0929f14 Mon Sep 17 00:00:00 2001 From: Harry Chen Date: Mon, 25 Oct 2021 20:49:10 -0700 Subject: [PATCH] migrate health_check.py to python3 --- deploy/health_check.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/deploy/health_check.py b/deploy/health_check.py index f5065a2..472d9e8 100644 --- a/deploy/health_check.py +++ b/deploy/health_check.py @@ -1,11 +1,11 @@ -import xmlrpclib +import xmlrpc.client if __name__ == "__main__": try: - server = xmlrpclib.Server("http://localhost:9005/RPC2") - info = server.supervisor.getAllProcessInfo() - error_states = list(filter(lambda x: x["state"] != 20, info)) - exit(len(error_states)) + with xmlrpc.client.ServerProxy("http://localhost:9005/RPC2") as server: + info = server.supervisor.getAllProcessInfo() + error_states = list(filter(lambda x: x["state"] != 20, info)) + exit(len(error_states)) except Exception as e: print(e.with_traceback()) exit(1)