mirror of
https://github.com/newnius/YAO-agent.git
synced 2025-06-07 13:51:56 +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 executor.py /root/executor.py
|
||||||
|
|
||||||
|
ADD main.py /root/main.py
|
||||||
|
|
||||||
WORKDIR /root
|
WORKDIR /root
|
||||||
|
|
||||||
CMD ["/etc/bootstrap.sh"]
|
CMD ["/etc/bootstrap.sh"]
|
@ -5,8 +5,10 @@
|
|||||||
# 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/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
|
docker_cmd
|
||||||
])
|
])
|
||||||
|
|
||||||
print(script)
|
|
||||||
|
|
||||||
client = docker.from_env()
|
client = docker.from_env()
|
||||||
container = client.containers.get('yao-agent-helper')
|
container = client.containers.get('yao-agent-helper')
|
||||||
exit_code, output = container.exec_run(['sh', '-c', script])
|
exit_code, output = container.exec_run(['sh', '-c', script])
|
||||||
msg = {"code": 0, "id": output.decode('utf-8').rstrip('\n')}
|
msg = {"code": 0, "id": output.decode('utf-8').rstrip('\n')}
|
||||||
|
|
||||||
print(msg)
|
|
||||||
lock.acquire()
|
lock.acquire()
|
||||||
pending_tasks[msg['id']] = {'gpus': str(docker_gpus).split(',')}
|
pending_tasks[msg['id']] = {'gpus': str(docker_gpus).split(',')}
|
||||||
lock.release()
|
lock.release()
|
||||||
print(msg)
|
|
||||||
if exit_code != 0:
|
if exit_code != 0:
|
||||||
msg["code"] = 1
|
msg["code"] = 1
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user