Commit 3fd34f79 authored by kalvin's avatar kalvin

init_container

parent b0cf1c71
FROM 192.168.4.36/baseimg/python:latest
USER root
WORKDIR /home/quant_group
COPY checker.py .
RUN chmod +x ./docker-entrypoint.sh
CMD ["python", "-c", "checker.py"]
\ No newline at end of file
import requests
import time
import json
def check():
url = "http://192.168.29.116:9001/api/etcd/get_env_job_status"
querystring = {"namespace":"0zhangbo"}
headers = {}
response = requests.request("GET", url, headers=headers, params=querystring)
return json.loads(response.text)
count = 0
all_job_is_done = False
while True:
res = check()
for instance in res["details"]["instances"]:
db_sync = instance["db_sync"]
rabbitmq_sync = instance["rabbitmq_sync"]
if db_sync == "done" and rabbitmq_sync == "done":
print "All of the sync job is done!"
all_job_is_done = True
else:
print "db_sync is:" + db_sync
print "rabbitmq_sync is:" + rabbitmq_sync
time.sleep(2)
if count == 120 or all_job_is_done:
break
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment