1
0
mirror of https://github.com/newnius/YAO-agent.git synced 2025-12-12 21:16:44 +00:00

update status

This commit is contained in:
2019-12-26 19:39:58 +08:00
parent 10f69f2ea7
commit 9c981a52bb
3 changed files with 10 additions and 25 deletions

View File

@@ -14,11 +14,7 @@ RUN pip3 install docker kafka psutil
ADD bootstrap.sh /etc/bootstrap.sh
ADD monitor.py /root/monitor.py
ADD executor.py /root/executor.py
ADD main.py /root/main.py
ADD agent.py /root/agent.py
WORKDIR /root

View File

@@ -94,6 +94,8 @@ class MyHandler(BaseHTTPRequestHandler):
'hostname': container.attrs['Config']['Hostname'],
'state': container.attrs['State']
}
if container_id in pending_tasks:
status['status'] = 'Ready'
if status['command'] is not None:
status['command'] = ' '.join(container.attrs['Config']['Cmd'])
msg = {'code': 0, 'status': status}
@@ -311,18 +313,13 @@ def listener():
server.socket.close()
def main():
t1 = Thread(target=report)
t2 = Thread(target=listener)
t1.start()
t2.start()
print("started")
while True:
pass
if __name__ == '__main__':
os.environ["TZ"] = 'Asia/Shanghai'
if hasattr(time, 'tzset'):
time.tzset()
main()
t1 = Thread(target=report)
t2 = Thread(target=listener)
t1.start()
t2.start()
while True:
pass

View File

@@ -1,14 +1,6 @@
#!/usr/bin/env bash
# TODO: monitor the processes
# run nvidia-smi in background to speed up the query and reduce CPU load (why?)
nvidia-smi daemon
#python3 /root/monitor.py &
#python3 /root/executor.py &
#sleep infinity
python3 /root/main.py
python3 /root/agent.py