-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
163 additions
and
120 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
from vllm_router.routers.affinity.base import BaseAffinity | ||
|
||
import json | ||
from logging import getLogger | ||
|
||
logger = getLogger(__name__) | ||
|
||
from vllm_router.affinity.round_robin_affinity import RoundRobinAffinity | ||
from vllm_router.affinity.session_based_affinity import SessionBasedAffinity | ||
from vllm_router.affinity.longest_prefix_affinity import LongestPrefixAffinity | ||
from vllm_router.affinity.simhash_affinity import SimhashAffinity | ||
|
||
affinity_name_to_class = { | ||
"round_robin": RoundRobinAffinity, | ||
"session": SessionBasedAffinity, | ||
"longest_prefix": LongestPrefixAffinity, | ||
"simhash": SimhashAffinity, | ||
} | ||
|
||
def get_affinity(affinity_name: str, affinity_config: Dict[str, Any] = {}, **kwargs) -> BaseAffinity: | ||
|
||
if affinity_name not in affinity_name_to_class: | ||
raise ValueError(f"Invalid affinity name: {affinity_name}") | ||
|
||
|
||
assert kwargs == {}, ("There are extra kwargs forwarded to the affinity " | ||
"factory method. This is likely unintended. " | ||
"Received kwargs: %s" % kwargs) | ||
|
||
logger.info(f"Using affinity type: {affinity_name} with config: {affinity_config}") | ||
return affinity_name_to_class[affinity_name](**affinity_config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
from vllm_router.routers.endpoint_filter.base import BaseEndpointFilter | ||
|
||
import json | ||
from logging import getLogger | ||
|
||
logger = getLogger(__name__) | ||
|
||
from vllm_router.routers.endpoint_filter.num_queueing_request_filter import NumQueueingRequestFilter | ||
|
||
endpoint_filter_name_to_class = { | ||
"num_queueing_request_filter": NumQueueingRequestFilter, | ||
} | ||
|
||
def get_endpoint_filter(endpoint_filter_name: str, endpoint_filter_config: Dict[str, Any] = {}, **kwargs) -> BaseEndpointFilter: | ||
if endpoint_filter_name not in endpoint_filter_name_to_class: | ||
raise ValueError(f"Invalid endpoint filter name: {endpoint_filter_name}") | ||
|
||
assert kwargs == {}, ("There are extra kwargs forwarded to the endpoint filter " | ||
"factory method. This is likely unintended. " | ||
"Received kwargs: %s" % kwargs) | ||
|
||
logger.info(f"Using endpoint filter type: {endpoint_filter_name} with config: {endpoint_filter_config}") | ||
return endpoint_filter_name_to_class[endpoint_filter_name](**endpoint_filter_config) |
11 changes: 6 additions & 5 deletions
11
...overload_detector/num_queueing_request.py → ...int_filter/num_queueing_request_filter.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.