migrate health_check.py to python3

This commit is contained in:
Harry Chen 2021-10-25 20:49:10 -07:00 committed by Beichi-CHs
parent cef608b809
commit 040fb6fbbd
No known key found for this signature in database
GPG Key ID: E46962993205150E
1 changed files with 5 additions and 5 deletions

View File

@ -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)