代码覆盖率¶
要检查分支稳定性,请按如下方式运行 sanity 套件¶
安装依赖项(如果尚未安装) 对于 CPU:
python ts_scripts/install_dependencies.py --environment=dev
对于 GPU
安装依赖项(如果尚未安装)
python ts_scripts/install_dependencies.py --environment=dev --cuda=cu121
支持的 CUDA 版本为 cu121、cu118、cu117、cu116、cu113、cu111、cu102、cu101、cu92
执行 sanity suite
python ./torchserve_sanity.py
要运行前端构建套件,请运行以下命令¶
frontend/gradlew -p frontend clean build
TorchServe 前端构建套件包括:
checkstyle
查找错误
PMD
UT (英语)
报表在以下路径生成:frontend/server/build/reports
要运行后端 pytest 套件,请运行以下命令¶
python -m pytest --cov-report html:htmlcov --cov=ts/ ts/tests/unit_tests/
报表在以下路径生成:htmlcov/
要在包上运行 python linting,请运行以下命令ts
¶
pylint -rn --rcfile=./ts/tests/pylintrc ts/.
要在 model-archiver 上运行 pytest suite,请运行以下命令¶
cd model-archiver
python -m pytest --cov-report html:htmlcov_ut --cov=model_archiver/ model_archiver/tests/unit_tests/
报表在以下路径生成:model-archiver/htmlcov_ut/
要在 model-archiver 上运行 IT 套件,请运行以下命令¶
cd model-archiver
pip install .
python -m pytest --cov-report html:htmlcov_it --cov=model_archiver/ model_archiver/tests/integ_tests/
报表在以下路径生成:model-archiver/htmlcov_it/
注意:以上所有命令都需要从 serve home 中执行
要运行 markdown 链接检查,请运行以下命令¶
安装 Markdown 链接检查器依赖项¶
Install node (安装节点)
对于 Linux :
sudo apt-get -y install nodejs-dev
sudo apt-get -y install npm
对于 Mac :
brew install node
brew install npm
安装 Markdown
sudo npm install -g n
sudo npm install -g markdown-link-check
执行此命令以在本地运行 markdown 链接检查。它将递归检查当前目录中所有扩展名为 “.md” 的文件中的损坏链接。
for i in **/*.md; do markdown-link-check $i --config link_check_config.json; done;