mirror of
https://github.com/newnius/YAO-agent.git
synced 2025-06-06 05:21:55 +00:00
all in one
This commit is contained in:
parent
6cf49f9285
commit
10f69f2ea7
@ -18,6 +18,8 @@ ADD monitor.py /root/monitor.py
|
||||
|
||||
ADD executor.py /root/executor.py
|
||||
|
||||
ADD main.py /root/main.py
|
||||
|
||||
WORKDIR /root
|
||||
|
||||
CMD ["/etc/bootstrap.sh"]
|
@ -5,8 +5,10 @@
|
||||
# run nvidia-smi in background to speed up the query and reduce CPU load (why?)
|
||||
nvidia-smi daemon
|
||||
|
||||
python3 /root/monitor.py &
|
||||
#python3 /root/monitor.py &
|
||||
|
||||
python3 /root/executor.py &
|
||||
#python3 /root/executor.py &
|
||||
|
||||
sleep infinity
|
||||
#sleep infinity
|
||||
|
||||
python3 /root/main.py
|
4
main.py
4
main.py
@ -143,18 +143,14 @@ class MyHandler(BaseHTTPRequestHandler):
|
||||
docker_cmd
|
||||
])
|
||||
|
||||
print(script)
|
||||
|
||||
client = docker.from_env()
|
||||
container = client.containers.get('yao-agent-helper')
|
||||
exit_code, output = container.exec_run(['sh', '-c', script])
|
||||
msg = {"code": 0, "id": output.decode('utf-8').rstrip('\n')}
|
||||
|
||||
print(msg)
|
||||
lock.acquire()
|
||||
pending_tasks[msg['id']] = {'gpus': str(docker_gpus).split(',')}
|
||||
lock.release()
|
||||
print(msg)
|
||||
if exit_code != 0:
|
||||
msg["code"] = 1
|
||||
except Exception as e:
|
||||
|
Loading…
Reference in New Issue
Block a user