FastDeploy icon indicating copy to clipboard operation
FastDeploy copied to clipboard

[CI] 【Hackathon 9th Sprint No.36】NO.36 功能模块单测补充

Open xunyoyo opened this issue 1 month ago • 7 comments

Motivation

NO.36 功能模块 fastdeploy/cache_manager/prefix_cache_manager.py 单测补充

Modifications

new tests/cache_manager/prefix_cache_manager.py

Usage or Command

tests/cache_manager/prefix_cache_manager.py:

python -m coverage run -m unittest tests.cache_manager.test_prefix_cache_manager \
&& python -m coverage report -m --include='fastdeploy/cache_manager/cache_manager.py'

Accuracy Tests

原覆盖:

File	Stmts	Miss	Branch	BrPart	Cover(%)	Missing
fastdeploy/cache_manager/prefix_cache_manager.py	897	455	306	48	46

tests/cache_manager/prefix_cache_manager.py:

Name                                               Stmts   Miss  Cover   Missing
--------------------------------------------------------------------------------
fastdeploy/cache_manager/prefix_cache_manager.py     909    123    86%   252, 348, 423, 644-646, 653, 857, 863-865, 871, 874-876
, 898, 908, 917-919, 939, 949, 952-954, 1005, 1068, 1084, 1091-1094, 1099, 1112, 1119-1120, 1126-1129, 1142-1144, 1162, 1169-119
1, 1243, 1251, 1294-1295, 1303-1312, 1317-1323, 1348, 1371, 1384-1386, 1388-1390, 1396-1402, 1414, 1416, 1422, 1484, 1495-1497,
1503-1509, 1518, 1523, 1564, 1570, 1585, 1617, 1620, 1657-1660, 1670, 1694, 1697, 1699, 1710, 1732-1734, 1750, 1789-1790, 1798,
1830
--------------------------------------------------------------------------------
TOTAL                                                909    123    86%

覆盖 ++332 行

Checklist

  • [x] Add at least a tag in the PR title.
    • Tag list: [[FDConfig],[APIServer],[Engine], [Scheduler], [PD Disaggregation], [Executor], [Graph Optimization], [Speculative Decoding], [RL], [Models], [Quantization], [Loader], [OP], [KVCache], [DataProcessor], [BugFix], [Docs], [CI], [Optimization], [Feature], [Benchmark], [Others], [XPU], [HPU], [GCU], [DCU], [Iluvatar], [Metax]]
    • You can add new tags based on the PR content, but the semantics must be clear.
  • [x] Format your code, run pre-commit before commit.
  • [x] Add unit tests. Please write the reason in this PR if no unit tests.
  • [x] Provide accuracy results.
  • [x] If the current PR is submitting to the release branch, make sure the PR has been submitted to the develop branch, then cherry-pick it to the release branch with the [Cherry-Pick] PR tag.

xunyoyo avatar Nov 15 '25 10:11 xunyoyo

Thanks for your contribution!

paddle-bot[bot] avatar Nov 15 '25 10:11 paddle-bot[bot]

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :warning: Please upload report for BASE (develop@532f9ba). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #5058   +/-   ##
==========================================
  Coverage           ?   61.83%           
==========================================
  Files              ?      329           
  Lines              ?    41160           
  Branches           ?     6274           
==========================================
  Hits               ?    25453           
  Misses             ?    13781           
  Partials           ?     1926           
Flag Coverage Δ
GPU 61.83% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov-commenter avatar Nov 25 '25 16:11 codecov-commenter

@CSWYF3634076 All passed,Review required.

xunyoyo avatar Nov 26 '25 16:11 xunyoyo

@CSWYF3634076 新pr修改内容 将可见设备的配置标准化为环境变量字符串

有些调用方会修改(patch 或 override):func:get_all_visible_devices 函数,让其返回设备 ID 的列表或元组(例如 ["0"])

由于启动命令的各个部分必须是字符串,如果直接把这种列表拼接到命令中,就会导致 TypeError 错误

这个辅助函数的作用是:无论输入的是字符串还是序列(列表/元组),它都能保证最终生成一个合法的环境变量赋值字符串

xunyoyo avatar Nov 27 '25 02:11 xunyoyo

@CSWYF3634076 新pr修改内容 将可见设备的配置标准化为环境变量字符串

有些调用方会修改(patch 或 override):func:get_all_visible_devices 函数,让其返回设备 ID 的列表或元组(例如 ["0"])

由于启动命令的各个部分必须是字符串,如果直接把这种列表拼接到命令中,就会导致 TypeError 错误

这个辅助函数的作用是:无论输入的是字符串还是序列(列表/元组),它都能保证最终生成一个合法的环境变量赋值字符串

但是函数get_all_visible_devices只返回的是固定字符串 https://github.com/PaddlePaddle/FastDeploy/blob/develop/fastdeploy/cache_manager/ops.py#L84

CSWYF3634076 avatar Nov 27 '25 03:11 CSWYF3634076

@liyonghua0910 麻烦review

xunyoyo avatar Dec 15 '25 12:12 xunyoyo

LGTM

liyonghua0910 avatar Dec 16 '25 08:12 liyonghua0910

0.3⭐️ cc @luotao1

CSWYF3634076 avatar Dec 16 '25 11:12 CSWYF3634076

合入后和pr_5544存在冲突,麻烦修复后再提交一个新的PR

CSWYF3634076 avatar Dec 17 '25 04:12 CSWYF3634076

合入后和pr_5544存在冲突,麻烦修复后再提交一个新的PR

问题已在PR https://github.com/PaddlePaddle/FastDeploy/pull/5609 中修复 @luotao1

CSWYF3634076 avatar Dec 18 '25 08:12 CSWYF3634076