OnlineJudge/deploy/health_check.py

12 lines
350 B
Python
Raw Normal View History

2017-12-01 11:03:30 +00:00
import xmlrpclib
if __name__ == "__main__":
try:
2017-12-03 07:39:02 +00:00
server = xmlrpclib.Server("http://localhost:9005/RPC2")
2017-12-01 11:03:30 +00:00
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)