Repository navigation
refactor: standard fastapi project structure for better main… - #217
Conversation
…tainability Signed-off-by: BrianPark314 <[email protected]>
gaocegege
left a comment
There was a problem hiding this comment.
I like this PR. Thanks for your contribution!
# Conflicts: # src/vllm_router/router.py
Signed-off-by: BrianPark314 <[email protected]>
Signed-off-by: BrianPark314 <[email protected]>
|
if this is going to be merged, it should preceed any other prs at the moment. |
Signed-off-by: BrianPark314 <[email protected]>
Signed-off-by: BrianPark314 <[email protected]>
Signed-off-by: BrianPark314 <[email protected]>
|
I checked the router's logs in GitHub Actions, and it shows the following error. Could you check if this is related to your code changes? Thanks. |
|
Hey @BrianPark314 , really appreciate the huge effort! |
|
Totally understand it takes non-trivial time to create this PR. Many thanks ❤️! |
ApostaC
left a comment
There was a problem hiding this comment.
Actually I take back my comments before. This refactoring looks clean and makes router.py much better than before! I really like this!
Just please fix the issue mentioned by @Shaoting-Feng
|
Since it introduces a lot of file changes, let's try to quickly merge it and unblock the other potential PRs? |
|
@Shaoting-Feng @ApostaC I will try to resolve the issues asap. |
Signed-off-by: BrianPark314 <[email protected]>
# Conflicts: # src/vllm_router/router.py
Signed-off-by: BrianPark314 <[email protected]>
Signed-off-by: BrianPark314 <[email protected]>
|
Looking forward to this PR being merged! I'll propose the prefix-aware routing after this. |
Signed-off-by: BrianPark314 <[email protected]>
Signed-off-by: BrianPark314 <[email protected]>
Signed-off-by: BrianPark314 <[email protected]>
Signed-off-by: BrianPark314 <[email protected]>
Signed-off-by: BrianPark314 <[email protected]>
Signed-off-by: BrianPark314 <[email protected]>
|
Thanks for your fix! The CI tests result LGTM. |
…roject#217) * refactor: maintain standard fastapi project structure for better maintainability Signed-off-by: BrianPark314 <[email protected]> * chore: merge main into branch Signed-off-by: BrianPark314 <[email protected]> * fix: run pre-commit Signed-off-by: BrianPark314 <[email protected]> * fix: setup.py Signed-off-by: BrianPark314 <[email protected]> * fix: service discovery time import Signed-off-by: BrianPark314 <[email protected]> * fix: service discovery time import Signed-off-by: BrianPark314 <[email protected]> * fix: delete unused file Signed-off-by: BrianPark314 <[email protected]> * fix: merge main and fix log_stats.py Signed-off-by: BrianPark314 <[email protected]> * chore: run pre-commit Signed-off-by: BrianPark314 <[email protected]> * fix: correct experimental imports Signed-off-by: BrianPark314 <[email protected]> * fix: parser error Signed-off-by: BrianPark314 <[email protected]> * fix: experimental feature flag Signed-off-by: BrianPark314 <[email protected]> * fix: wrapper call issue Signed-off-by: BrianPark314 <[email protected]> * fix: add missing lifespan Signed-off-by: BrianPark314 <[email protected]> * chore: add TODO comment Signed-off-by: BrianPark314 <[email protected]> --------- Signed-off-by: BrianPark314 <[email protected]> Co-authored-by: BrianPark314 <[email protected]>
…d it vllm-project#217 renamed src/vllm_router/batch/ to src/vllm_router/services/batch_service/ in 95efecc, on 2025-03-04. local_processor.py moved with it and kept importing BatchInfo and BatchStatus from the old path, at module level and again inside retrieve_batch. The module it wants is now its own sibling. app.py calls initialize_batch_processor whenever --enable-batch-api is passed, and that function imports LocalBatchProcessor, so the router aborts at startup with ModuleNotFoundError: No module named 'vllm_router.batch' rather than serving the batch endpoints. vllm-project#784 fixed the same orphaned import one layer out, in services/batch_service/__init__.py, and stopped there. aiosqlite is imported at the top of the same file and is declared in neither pyproject.toml nor src/vllm_router/requirements.txt, so on a stock install it fails one line earlier than the import above. The e2e job installs from pyproject.toml and now collects the new test, so it is added there and in requirements.txt beside the other runtime dependencies. Two regression tests cover the path app.py takes: one constructs the processor through initialize_batch_processor, one creates and retrieves a batch. Both fail with the import change reverted, and correcting only the module-level import leaves the second one failing. Signed-off-by: chrikrah <[email protected]>
…tainability
FILL IN THE PR DESCRIPTION HERE
This is a suggestion for restructuring the project into more maintainable shape. Changes include:
apply mvc pattern
isolate the entry point
separate routers
removed duplicated code (in batch router)
fix typo
Hope this gets reviewed before 0.1.0 release!
BEFORE SUBMITTING, PLEASE READ THE CHECKLIST BELOW AND FILL IN THE DESCRIPTION ABOVE
-swhen doinggit commit[Bugfix],[Feat], and[CI].Detailed Checklist (Click to Expand)
Thank you for your contribution to production-stack! Before submitting the pull request, please ensure the PR meets the following criteria. This helps us maintain the code quality and improve the efficiency of the review process.
PR Title and Classification
Please try to classify PRs for easy understanding of the type of changes. The PR title is prefixed appropriately to indicate the type of change. Please use one of the following:
[Bugfix]for bug fixes.[CI/Build]for build or continuous integration improvements.[Doc]for documentation fixes and improvements.[Feat]for new features in the cluster (e.g., autoscaling, disaggregated prefill, etc.).[Router]for changes to thevllm_router(e.g., routing algorithm, router observability, etc.).[Misc]for PRs that do not fit the above categories. Please use this sparingly.Note: If the PR spans more than one category, please include all relevant prefixes.
Code Quality
The PR need to meet the following code quality standards:
pre-committo format your code. SeeREADME.mdfor installation.DCO and Signed-off-by
When contributing changes to this project, you must agree to the DCO. Commits must include a
Signed-off-by:header which certifies agreement with the terms of the DCO.Using
-swithgit commitwill automatically add this header.What to Expect for the Reviews
We aim to address all PRs in a timely manner. If no one reviews your PR within 5 days, please @-mention one of YuhanLiu11
, Shaoting-Feng or ApostaC.