mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2025-01-16 01:13:47 +00:00
migrate health_check.py to python3
This commit is contained in:
parent
d98b71f9e8
commit
7fab75e187
@ -5,7 +5,7 @@ ENV OJ_ENV production
|
|||||||
ADD . /app
|
ADD . /app
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
HEALTHCHECK --interval=5s --retries=3 CMD python2 /app/deploy/health_check.py
|
HEALTHCHECK --interval=5s --retries=3 CMD python3 /app/deploy/health_check.py
|
||||||
|
|
||||||
RUN apk add --update --no-cache build-base nginx openssl curl unzip supervisor jpeg-dev zlib-dev postgresql-dev freetype-dev && \
|
RUN apk add --update --no-cache build-base nginx openssl curl unzip supervisor jpeg-dev zlib-dev postgresql-dev freetype-dev && \
|
||||||
pip install --no-cache-dir -r /app/deploy/requirements.txt && \
|
pip install --no-cache-dir -r /app/deploy/requirements.txt && \
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import xmlrpclib
|
import xmlrpc.client
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
try:
|
try:
|
||||||
server = xmlrpclib.Server("http://localhost:9005/RPC2")
|
with xmlrpc.client.ServerProxy("http://localhost:9005/RPC2") as server:
|
||||||
info = server.supervisor.getAllProcessInfo()
|
info = server.supervisor.getAllProcessInfo()
|
||||||
error_states = list(filter(lambda x: x["state"] != 20, info))
|
error_states = list(filter(lambda x: x["state"] != 20, info))
|
||||||
exit(len(error_states))
|
exit(len(error_states))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e.with_traceback())
|
print(e.with_traceback())
|
||||||
exit(1)
|
exit(1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user