参考代码
https://github.com/hongzimao/pensieve.git
运行环境
Ubuntu虚拟机
tensorflow-gpu==2.6.0
python=3.8
代码修改
全局修改
把所有
print xxx
for i in xrange
with open('xxx', 'wb/ab')
改为
print(xxx)
for i in range
with open('xxx', 'w/a')
不同模块的具体修改
/rl_server下
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import SocketServer
改为
from http.verver import BaseHTTPRequestHandler, HTTPServer
import SocketServer
/run_exp下
- 删除abr_browser_dir下的chromedriver安装自己浏览器对应版本的,记得测试是否可用
- 安装mahimahi,参考网络仿真工具Mahimahi的安装和基础用法
run_traces.py
sleep_vec = range(1, 10)
改为
sleep_vec = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
log.write(out + '\n')
改为
log.write(str(out) + '\n')
记得把command里的python路径换成自己的
if abr_algo == 'RL':
command = 'exec /home/zx/miniconda3/envs/tf/bin/python ../rl_server/rl_server_no_training.py ' + trace_file
elif abr_algo == 'fastMPC':
command = 'exec /home/zx/miniconda3/envs/tf/bin/python ../rl_server/mpc_server.py ' + trace_file
elif abr_algo == 'robustMPC':
command = 'exec /home/zx/miniconda3/envs/tf/bin/python ../rl_server/robust_mpc_server.py ' + trace_file
else:
command = 'exec /home/zx/miniconda3/envs/tf/bin/python ../rl_server/simple_server.py ' + abr_algo + ' ' + trace_file
driver=webdriver.Chrome(service=Service(chrome_driver), options=options)
代码启动后的问题
因为代码中的多线程执行的命令行不会在控制台输出错误,调试及其麻烦,所以我打印出命令手动一句一句调试,然后发现个大问题
run_traces.py会执行一句命令
os.system('mm-delay 40 mm-link 12mbps ../cooked_traces/ATT-LTE-driving.down /home/zx/miniconda3/envs/tf/bin/python run_video.py 223.72.43.65 RL 320 0 ATT-LTE-driving.down 8
然后selenium就会报错
Message: unknown error: Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/goole-chrome is no longer running, so Chromelriver is assuming that Chrome has crashed.
但是如果我不执行
mm-delay 40 mm-link 12mbps ../cooked_traces/ATT-LTE-driving.down
直接执行
/home/zx/miniconda3/envs/tf/bin/python run_video.py 223.72.43.65 RL 320 0 ATT-LTE-driving.down 8
则selenium正常运行,目前没找到解决办法