OnlineJudge/deploy/health_check.py

12 lines
382 B
Python
Raw Permalink Normal View History

2021-10-26 03:49:10 +00:00
import xmlrpc.client
2017-12-01 11:03:30 +00:00
if __name__ == "__main__":
try:
2021-10-26 03:49:10 +00:00
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))
2017-12-01 11:03:30 +00:00
except Exception as e:
print(e.with_traceback())
exit(1)