mirror of
https://github.com/newnius/YAO-agent.git
synced 2025-12-15 05:56:43 +00:00
update status
This commit is contained in:
@@ -14,11 +14,7 @@ RUN pip3 install docker kafka psutil
|
|||||||
|
|
||||||
ADD bootstrap.sh /etc/bootstrap.sh
|
ADD bootstrap.sh /etc/bootstrap.sh
|
||||||
|
|
||||||
ADD monitor.py /root/monitor.py
|
ADD agent.py /root/agent.py
|
||||||
|
|
||||||
ADD executor.py /root/executor.py
|
|
||||||
|
|
||||||
ADD main.py /root/main.py
|
|
||||||
|
|
||||||
WORKDIR /root
|
WORKDIR /root
|
||||||
|
|
||||||
|
|||||||
@@ -94,6 +94,8 @@ class MyHandler(BaseHTTPRequestHandler):
|
|||||||
'hostname': container.attrs['Config']['Hostname'],
|
'hostname': container.attrs['Config']['Hostname'],
|
||||||
'state': container.attrs['State']
|
'state': container.attrs['State']
|
||||||
}
|
}
|
||||||
|
if container_id in pending_tasks:
|
||||||
|
status['status'] = 'Ready'
|
||||||
if status['command'] is not None:
|
if status['command'] is not None:
|
||||||
status['command'] = ' '.join(container.attrs['Config']['Cmd'])
|
status['command'] = ' '.join(container.attrs['Config']['Cmd'])
|
||||||
msg = {'code': 0, 'status': status}
|
msg = {'code': 0, 'status': status}
|
||||||
@@ -311,18 +313,13 @@ def listener():
|
|||||||
server.socket.close()
|
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__':
|
if __name__ == '__main__':
|
||||||
os.environ["TZ"] = 'Asia/Shanghai'
|
os.environ["TZ"] = 'Asia/Shanghai'
|
||||||
if hasattr(time, 'tzset'):
|
if hasattr(time, 'tzset'):
|
||||||
time.tzset()
|
time.tzset()
|
||||||
main()
|
t1 = Thread(target=report)
|
||||||
|
t2 = Thread(target=listener)
|
||||||
|
t1.start()
|
||||||
|
t2.start()
|
||||||
|
while True:
|
||||||
|
pass
|
||||||
10
bootstrap.sh
10
bootstrap.sh
@@ -1,14 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# TODO: monitor the processes
|
|
||||||
|
|
||||||
# run nvidia-smi in background to speed up the query and reduce CPU load (why?)
|
# run nvidia-smi in background to speed up the query and reduce CPU load (why?)
|
||||||
nvidia-smi daemon
|
nvidia-smi daemon
|
||||||
|
|
||||||
#python3 /root/monitor.py &
|
python3 /root/agent.py
|
||||||
|
|
||||||
#python3 /root/executor.py &
|
|
||||||
|
|
||||||
#sleep infinity
|
|
||||||
|
|
||||||
python3 /root/main.py
|
|
||||||
Reference in New Issue
Block a user