代码覆盖率¶
要检查分支稳定性,请按如下方式运行健全性套件¶
安装依赖项(如果尚未安装)对于 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
执行健全性套件
python ./torchserve_sanity.py
要运行前端构建套件,请运行以下命令¶
frontend/gradlew -p frontend clean build
TorchServe 前端构建套件包含
checkstyle
findbugs
PMD
UT
报告在以下路径生成: frontend/server/build/reports
要运行后端 pytest 套件,请运行以下命令¶
python -m pytest --cov-report html:htmlcov --cov=ts/ ts/tests/unit_tests/
报告在以下路径生成: htmlcov/
要在 ts 包上运行 python linting,请运行以下命令¶
pylint -rn --rcfile=./ts/tests/pylintrc ts/.
要在 model-archiver 上运行 pytest 套件,请运行以下命令¶
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 主目录执行
要运行 markdown 链接检查,请运行以下命令¶
安装 markdown 链接检查器依赖项¶
运行以下命令以安装 node 和 markdown-link-check
npm 包。
安装 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;