forked from All-Hands-AI/OpenHands
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
upd_persistent_container.py
41 lines (39 loc) · 1.4 KB
/
upd_persistent_container.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import os
from datetime import datetime
import docker
full_file_names = [
'openhands/runtime/plugins/agent_skills/agentskills.py',
'openhands/runtime/plugins/agent_skills/file_ops/file_ops.py',
'openhands/runtime/plugins/agent_skills/file_ops/cst_ops.py',
'openhands/runtime/plugins/agent_skills/file_ops/ast_ops.py',
'openhands/runtime/plugins/agent_skills/file_ops/file_utils.py',
'openhands/runtime/plugins/agent_skills/file_ops/so.py',
'openhands/runtime/plugins/jupyter/execute_server.py',
'openhands/runtime/plugins/vscode/__init__.py',
'openhands/runtime/utils/bash.py',
'openhands/runtime/action_execution_server.py',
'openhands/linter/__init__.py',
'openhands/sel/selenium_tester.py',
'openhands/sel/selenium_session_details.py',
'openhands/events/event.py',
]
client = docker.from_env()
for c in client.containers.list():
name = c.name
if not name.startswith('kevin-'):
continue
if 'persisted' in name:
print(name)
# break
# copy the file to the container
container_id = c.id
for full_file_name in full_file_names:
cmd = f'docker cp {full_file_name} {container_id}:/openhands/code/{full_file_name}'
os.system(cmd)
if 1:
if 'root' in c.name:
break
# restart the container
print('Restarting the container')
c.restart()
print(datetime.now())