before_code stringlengths 14 465k | reviewer_comment stringlengths 16 64.5k | after_code stringlengths 9 467k | diff_context stringlengths 0 97k | file_path stringlengths 5 226 | comment_line int32 0 26 | language stringclasses 37
values | quality_score float32 0.07 1 | comment_type stringclasses 9
values | comment_length int32 16 64.5k | before_lines int32 1 17.2k | after_lines int32 1 12.1k | is_negative bool 2
classes | pr_title stringlengths 1 308 | pr_number int32 1 299k | repo_name stringclasses 533
values | repo_stars int64 321 419k | repo_language stringclasses 27
values | reviewer_username stringlengths 0 39 | author_username stringlengths 2 39 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
// For sanity, make sure we're routing to a valid pod
assert.NotEqual(t, -1, idx, "Should route to a valid pod")
}
})
// Clamp fairness when tokens exceed adaptive bucket*(nPods-1)
t.Run("ClampedFairnessHighTokens", func(t *testing.T) {
highTracker := NewInMemorySlidingWindowTokenTracker(trackerConfig)
... | We delete the redundant case here, which is not helpful for testing. Our `Route(ctx *RoutingContext, readyPodList PodList) (string, error)` already ensures that there is no noready pod and at least one readypod scenario. |
// For sanity, make sure we're routing to a valid pod
assert.NotEqual(t, -1, idx, "Should route to a valid pod")
}
})
// Clamp fairness when tokens exceed adaptive bucket*(nPods-1)
t.Run("ClampedFairnessHighTokens", func(t *testing.T) {
highTracker := NewInMemorySlidingWindowTokenTracker(trackerConfig)
... | @@ -422,34 +422,6 @@ func TestVTCBasicRouterStrengths(t *testing.T) {
assert.Equal(t, "192.168.1.2:8000", addr, "High tokens clamp fairness to middle pod index")
})
- // Error when no pods to forward request | pkg/plugins/gateway/algorithms/vtc/vtc_basic_test.go | 26 | Go | 0.714 | suggestion | 220 | 51 | 51 | false | [Misc] fix: Optimizing Route method of the gateway algorithms | 1,001 | vllm-project/aibrix | 2,572 | Go | googs1025 | googs1025 |
*/
package cache
import (
"fmt"
"sync/atomic"
"github.com/vllm-project/aibrix/pkg/metrics"
"github.com/vllm-project/aibrix/pkg/types"
v1 "k8s.io/api/core/v1"
"k8s.io/klog/v2"
)
// GetPod retrieves a Pod object by name from the cache
// Parameters:
//
// podName: Name of the pod to retrieve
// podNamespace: ... | - Better to make a util method here.
- Update error messages as well, for example `fmt.Errorf("pod does not exist in the cache: %s", podName)` -> `fmt.Errorf("key does not exist in the cache: %s", key)` | */
package cache
import (
"fmt"
"sync/atomic"
"github.com/vllm-project/aibrix/pkg/metrics"
"github.com/vllm-project/aibrix/pkg/types"
"github.com/vllm-project/aibrix/pkg/utils"
v1 "k8s.io/api/core/v1"
"k8s.io/klog/v2"
)
// GetPod retrieves a Pod object by name from the cache
// Parameters:
//
// podName: Na... | @@ -29,14 +29,16 @@ import (
// GetPod retrieves a Pod object by name from the cache
// Parameters:
//
-// podName: Name of the pod to retrieve
+// podName: Name of the pod to retrieve
+// podNamespace: Namespace of the pod to retrieve
//
// Returns:
//
// *v1.Pod: The found Pod object
// error: Error if pod ... | pkg/cache/cache_impl.go | 26 | Go | 0.786 | performance | 206 | 51 | 51 | false | [Bug] fix: update metaPods cache to use namespace/name as the key | 1,015 | vllm-project/aibrix | 2,572 | Go | varungup90 | googs1025 |
klog.Errorf("Error initializing Prometheus API: %v", err)
} else {
prometheusApi = api
klog.Infof("Prometheus API initialized successfully")
}
}
return prometheusApi
}
func (c *Store) getPodMetricImpl(podName string, metricStore *utils.SyncMap[string, metrics.MetricValue], metricName string) (metrics.Me... | you can add a util method here as well to check if key is valid. | } else {
prometheusApi = api
klog.Infof("Prometheus API initialized successfully")
}
}
return prometheusApi
}
func (c *Store) getPodMetricImpl(podName string, metricStore *utils.SyncMap[string, metrics.MetricValue], metricName string) (metrics.MetricValue, error) {
metricVal, ok := metricStore.Load(metric... | @@ -111,7 +112,14 @@ func (c *Store) getPodModelMetricName(modelName string, metricName string) strin
}
func (c *Store) updatePodMetrics() {
- c.metaPods.Range(func(podName string, metaPod *Pod) bool {
+ c.metaPods.Range(func(key string, metaPod *Pod) bool {
+ // Split the key into namespace and name
+ parts := s... | pkg/cache/cache_metrics.go | 26 | Go | 0.214 | suggestion | 64 | 51 | 51 | false | [Bug] fix: update metaPods cache to use namespace/name as the key | 1,015 | vllm-project/aibrix | 2,572 | Go | varungup90 | googs1025 |
contextLength := node.ContextLength()
baseTime := 0.0
if targetGPU == "A6000" {
baseTime = mistral7BA6000LinearTime(numTokens) + mistral7BA6000AttentionTime(1, contextLength, numTokens)
} else if targetGPU == "V100" {
baseTime = mistral7BV100LinearTime(numTokens) + mistral7BV100AttentionTime(1, contextLength, n... | I remember we barely use V(5). can you check any references? If not, let's change to V(4). | contextLength := node.ContextLength()
baseTime := 0.0
if targetGPU == "A6000" {
baseTime = mistral7BA6000LinearTime(numTokens) + mistral7BA6000AttentionTime(1, contextLength, numTokens)
} else if targetGPU == "V100" {
baseTime = mistral7BV100LinearTime(numTokens) + mistral7BV100AttentionTime(1, contextLength, n... | @@ -221,10 +221,10 @@ func (h *SlidingWindowHistogram) getPrefillCost(node *prefixcacheindexer.TreeNod
}
prefillTime := (baseTime + attnQuad) / 0.9
numPods := node.GetModelToPodCount() // You might need to adjust this based on your actual GPU allocation tracking
- klog.Infof("numTokens: %d, contextLength: %d, tar... | pkg/plugins/gateway/algorithms/prefix_cache_and_load.go | 26 | Go | 0.286 | suggestion | 91 | 51 | 51 | false | [Fix] Removing redundant locks in prefix cache and load router function | 1,024 | vllm-project/aibrix | 2,572 | Go | Jeffwan | gangmuk |
func (c *LPRadixCache) GetAllPodsInNode(node *TreeNode) []string {
node.mu.RLock()
defer node.mu.RUnlock()
allPodsInNode := make([]string, 0)
for _, pods := range node.modelToPods {
for podName := range pods {
allPodsInNode = append(allPodsInNode, podName)
}
}
return allPodsInNode
}
func (c *LPRadixCache)... | remove it if that won't be used | func (c *LPRadixCache) GetAllPodsInNode(node *TreeNode) []string {
node.mu.RLock()
defer node.mu.RUnlock()
allPodsInNode := make([]string, 0)
for _, pods := range node.modelToPods {
for podName := range pods {
allPodsInNode = append(allPodsInNode, podName)
}
}
return allPodsInNode
}
// This can be used fo... | @@ -296,13 +307,13 @@ func (c *LPRadixCache) prettyPrintHelper(node *TreeNode, prefix string, isLast b
childPrefix = prefix + "│ "
}
// klog.Infof("%s%s[Key: %v, Value: %v, Load: %d, Depth: %d]", prefix, marker, node.key, node.value, node.load, node.depth)
- tokensInString, err := utils.DetokenizeText(node.key... | pkg/utils/prefixcacheindexer/tree.go | 26 | Go | 0.143 | suggestion | 31 | 51 | 51 | false | [Fix] Removing redundant locks in prefix cache and load router function | 1,024 | vllm-project/aibrix | 2,572 | Go | Jeffwan | gangmuk |
return child, child.key
}
// Partial match with this node's key
return child, child.key[:prefixLen]
}
}
return node, nil
}
func (c *LPRadixCache) AddPrefix(tokens []int, model string, podName string) (*TreeNode, []int, []int) {
c.mu.Lock()
defer c.mu.Unlock()
// Do insertion first
node, matchedTo... | I see many PrettyPrint() reference are comment out. Please either change the log level or remove it | current.parent.InitAndUpdateModelPod(model, podName, time.Now())
current = current.parent
}
klog.V(5).InfoS("Updated mapping for model %s, pod %s in node(%d)", "model", model, "podName", podName, "nodeID", node.id, "key", node.key)
}
return node, matchedTokens, unmatchedTokens
}
func (c *LPRadixCache) ins... | @@ -443,14 +442,14 @@ func (c *LPRadixCache) AddPrefix(tokens []int, model string, podName string) (*T
// Do insertion first
node, matchedTokens, unmatchedTokens := c.insertHelper(c.rootNode, tokens, tokens)
- if node != nil {
+ if node != nil && podName != "" {
node.InitAndUpdateModelPod(model, podName, time.... | pkg/utils/prefixcacheindexer/tree.go | 26 | Go | 0.286 | suggestion | 99 | 51 | 51 | false | [Fix] Removing redundant locks in prefix cache and load router function | 1,024 | vllm-project/aibrix | 2,572 | Go | Jeffwan | gangmuk |
h.timestamps = newTimestamps
}
}
func (p *prefixCacheAndLoadRouter) Route(ctx *types.RoutingContext, pods types.PodList) (string, error) {
readyPods := utils.FilterRoutablePods(pods.All())
if len(readyPods) == 0 {
return "", fmt.Errorf("no pods to forward request")
}
if len(readyPods) == 1 {
for _, pod := ... | To keep logging same, use klog.InfoS.
Better to merge multiple log statements in one and also try to minimize the number of log messages for better debugability. | defer p.podsMu.RUnlock()
podUpdateNeeded = len(readyPods) != p.numPods
}()
if podUpdateNeeded {
p.podsMu.Lock()
p.updatePodSet(readyPods) // Move update pod logic to separate function
p.podsMu.Unlock()
klog.InfoS("Request processing", "requestID", ctx.RequestID, "updatePodSet", p.numPods)
}
tokens, er... | @@ -449,45 +448,53 @@ func (p *prefixCacheAndLoadRouter) Route(ctx *types.RoutingContext, pods types.P
}
}
- p.mu.Lock()
- defer p.mu.Unlock()
+ var podUpdateNeeded bool
+ func() {
+ p.podsMu.RLock()
+ defer p.podsMu.RUnlock()
+ podUpdateNeeded = len(readyPods) != p.numPods
+ }()
+
+ if podUpdateNeeded {
+ k... | pkg/plugins/gateway/algorithms/prefix_cache_and_load.go | 26 | Go | 0.571 | bug | 164 | 51 | 51 | false | [Fix] Removing redundant locks in prefix cache and load router function | 1,024 | vllm-project/aibrix | 2,572 | Go | varungup90 | gangmuk |
}
}
klog.Infof("MatchPrefix - node(%d) key: %v, matched tokens: %v, model pods: %v",
node.id, node.key, matchedTokens, node.modelToPods)
return matchedTokens, unmatchedTokens, matchedPods
}
// This is being used by GetNode
func (c *LPRadixCache) matchPrefixHelper(node *TreeNode, tokens []int) (*TreeNode, []in... | unit tests did not fail. To productionize it unit and e2e tests are must. You can add them in follow up PR. | if prefixLen == len(child.key) {
// Complete match with this node's key
if prefixLen == len(tokens) {
return child, child.key
}
// Continue matching with remaining tokens
deeperNode, deeperMatched := c.matchPrefixHelper(child, tokens[prefixLen:])
if deeperNode != nil && len(deeperMatched... | @@ -443,14 +442,14 @@ func (c *LPRadixCache) AddPrefix(tokens []int, model string, podName string) (*T
// Do insertion first
node, matchedTokens, unmatchedTokens := c.insertHelper(c.rootNode, tokens, tokens)
- if node != nil {
+ if node != nil && podName != "" { | pkg/utils/prefixcacheindexer/tree.go | 26 | Go | 0.357 | bug | 107 | 51 | 51 | false | [Fix] Removing redundant locks in prefix cache and load router function | 1,024 | vllm-project/aibrix | 2,572 | Go | varungup90 | gangmuk |
func (n *TreeNode) GetChildren() map[int]*TreeNode {
return n.children
}
func (n *TreeNode) ResetEvictedPods() {
n.evictedPods = make(map[int]bool)
}
func (n *TreeNode) ResetCachedPods() {
n.cachedPods = make(map[int]bool)
}
func (n *TreeNode) ResetRefCounter(numPods int) {
n.refCounter = make([]int, numPods)
}... | I'm curious why some of our info logs have levels set but others don't? Does this make the controller log too much? 🤔 |
func (n *TreeNode) GetChildren() map[int]*TreeNode {
return n.children
}
func (n *TreeNode) ResetEvictedPods() {
n.evictedPods = make(map[int]bool)
}
func (n *TreeNode) ResetCachedPods() {
n.cachedPods = make(map[int]bool)
}
func (n *TreeNode) ResetRefCounter(numPods int) {
n.refCounter = make([]int, numPods)
}... | @@ -140,11 +139,13 @@ func (n *TreeNode) RemovePodsNotInCurrentPodSet(currentPodSet map[string]bool) b
for podName := range podMap {
if !currentPodSet[podName] {
delete(podMap, podName)
+ klog.Infof("Removing pod from modelToPod: %s, %s", podName, model) | pkg/utils/prefixcacheindexer/tree.go | 26 | Go | 0.357 | suggestion | 118 | 51 | 51 | false | [Fix] Removing redundant locks in prefix cache and load router function | 1,024 | vllm-project/aibrix | 2,572 | Go | googs1025 | gangmuk |
tokenInString, err := utils.DetokenizeText(tokens)
matchedTokensInString, _ := utils.DetokenizeText(matchedTokens)
if err != nil {
klog.Errorf("requestID: %s, DetokenizeTexts failed: %s, tokens: '%v', matchedTokens: '%v', model: %s", ctx.RequestID, err, tokenInString, matchedTokensInString, ctx.Model)
}... | Why is this log info removed here? | if targetPod == nil {
klog.ErrorS(fmt.Errorf("no suitable pod found"), "requestID: %s, After all logic, no suitable pod found. readyPods: %v", "requestID", ctx.RequestID, "readyPods", readyPods)
return "", fmt.Errorf("no suitable pod found")
}
// Update pod mapping in ALL nodes from matched node to root
curren... | @@ -571,9 +577,6 @@ func (p *prefixCacheAndLoadRouter) Route(ctx *types.RoutingContext, pods types.P
p.histogram.update(time.Now(), node, node, targetPod.Name, defaultDecodingLength)
- klog.InfoS("target_pod_name", targetPod.Name, "target_pod_ip", targetPod.Status.PodIP) | pkg/plugins/gateway/algorithms/prefix_cache_and_load.go | 26 | Go | 0.143 | question | 34 | 51 | 51 | false | [Fix] Removing redundant locks in prefix cache and load router function | 1,024 | vllm-project/aibrix | 2,572 | Go | googs1025 | gangmuk |
setupVTCUsers(t)
users := []string{"user1", "user2", "user3"}
shortMsg := "Short message."
mediumMsg := "This is a medium length message with more tokens."
longMsg := "This is a very long message with many tokens. " +
"It should be significantly longer than the others to ensure higher token count. " +
"We wan... | new golang version can support range int. If your local env report issues. feel free to upgrade to v1.22 or above | setupVTCUsers(t)
users := []string{"user1", "user2", "user3"}
shortMsg := "Short message."
mediumMsg := "This is a medium length message with more tokens."
longMsg := "This is a very long message with many tokens. " +
"It should be significantly longer than the others to ensure higher token count. " +
"We wan... | @@ -188,7 +188,7 @@ func TestVTCBasicRouting(t *testing.T) {
podHistogram := make(map[string]int)
- for range 5 {
+ for i := 0; i < 5; i++ { | test/e2e/vtc_routing_test.go | 26 | Go | 0.357 | suggestion | 113 | 51 | 51 | false | [BUG] Use more accurate chi-squared test for randomness validation in e2e test. | 1,027 | vllm-project/aibrix | 2,572 | Go | Jeffwan | zhangjyr |
} else if err != nil {
klog.InfoS("Error encountered while checking expectations, forcing sync", "err", err)
} else {
// When a new controller is created, it doesn't have expectations.
// When it doesn't see expected watch events for > TTL, the expectations expire.
// - In this case it wakes up, creates/delet... | this part was from upstream code. we probably have merge conflicts in future but I think this code snippet is pretty stable and barely changes. Change to atomic type looks good to me | } else if err != nil {
klog.InfoS("Error encountered while checking expectations, forcing sync", "err", err)
} else {
// When a new controller is created, it doesn't have expectations.
// When it doesn't see expected watch events for > TTL, the expectations expire.
// - In this case it wakes up, creates/delet... | @@ -145,7 +144,9 @@ func (exp *ControlleeExpectations) isExpired() bool {
// SetExpectations registers new expectations for the given controller. Forgets existing expectations.
func (r *ControllerExpectations) SetExpectations(controllerKey string, add, del int) error {
- exp := &ControlleeExpectations{add: int64(ad... | pkg/controller/util/expectation/expectation.go | 26 | Go | 0.571 | suggestion | 182 | 51 | 51 | false | use atomic.Int32c instead of use Int32 type | 1,035 | vllm-project/aibrix | 2,572 | Go | Jeffwan | googs1025 |
export PROMPT_LENGTH=100
export PROMPT_STD=10
export NUM_TURNS=10
export NUM_TURNS_STD=1
export NUM_SESSIONS=10
export NUM_SESSIONS_STD=1 | How did we come out with this STD value? | export PROMPT_LENGTH=80
export PROMPT_STD=472
export NUM_TURNS=3.55
export NUM_TURNS_STD=2.89
export NUM_SESSIONS=1000
export NUM_SESSIONS_STD=1 | @@ -1,6 +1,6 @@
-export PROMPT_LENGTH=100
-export PROMPT_STD=10
-export NUM_TURNS=10
-export NUM_TURNS_STD=1
-export NUM_SESSIONS=10
+export PROMPT_LENGTH=80
+export PROMPT_STD=472 | benchmarks/config/dataset/synthetic_multiturn.sh | 2 | Shell | 0.071 | question | 41 | 6 | 6 | false | Add Pareto Sampler for Multiturn Dataset Generation | 1,038 | vllm-project/aibrix | 2,572 | Go | xieus | happyandslow |
}
// TODO(jiaxin.shan): convert this raw metric to PodMetrics
return nil, currentTimestamp, nil
}
func GetMetricsFromPods(ctx context.Context, fetcher MetricFetcher, pods []corev1.Pod, source autoscalingv1alpha1.MetricSource) ([]float64, error) {
metrics := make([]float64, 0, len(pods))
for _, pod := range pods ... | can you help double check whether client side has better handling on the case `len(metrics) != len(pods)`. I think `len(metrics) == 0 && len(pods) > 0` is one of the special case. What if partial pods failed? I am a little bit concern on the client logic if client need to iterate metric slice but the length can not be... | }
// TODO(jiaxin.shan): convert this raw metric to PodMetrics
return nil, currentTimestamp, nil
}
func GetMetricsFromPods(ctx context.Context, fetcher MetricFetcher, pods []corev1.Pod, source autoscalingv1alpha1.MetricSource) ([]float64, error) {
metrics := make([]float64, 0, len(pods))
var failedPods []string
... | @@ -114,10 +115,15 @@ func GetMetricsFromPods(ctx context.Context, fetcher MetricFetcher, pods []corev
// TODO: Let's optimize the performance for multi-metrics later.
metric, err := fetcher.FetchPodMetrics(ctx, pod, source)
if err != nil {
- return nil, err
+ klog.ErrorS(err, "Failed to get metrics from p... | pkg/controller/podautoscaler/metrics/utils.go | 26 | Go | 0.643 | bug | 329 | 37 | 44 | false | [Bug] fix: add more info for pod metric fetch failures in GetMetricsFromPods | 1,039 | vllm-project/aibrix | 2,572 | Go | Jeffwan | googs1025 |
metricsTotal += metric.Value
}
currentUsage = metricsTotal / int64(len(metrics))
return float64(currentUsage) / float64(targetUsage), currentUsage
}
func GetPodContainerMetric(ctx context.Context, fetcher MetricFetcher, pod corev1.Pod, source autoscalingv1alpha1.MetricSource) (PodMetricsInfo, time.Time, error) ... | There was error logging before, but if there is a persistant error then it floods the logs making them difficult to read.
I will suggest to either add metrics to track this or open to other alternative which does not floods the log. | metricsTotal += metric.Value
}
currentUsage = metricsTotal / int64(len(metrics))
return float64(currentUsage) / float64(targetUsage), currentUsage
}
func GetPodContainerMetric(ctx context.Context, fetcher MetricFetcher, pod corev1.Pod, source autoscalingv1alpha1.MetricSource) (PodMetricsInfo, time.Time, error) ... | @@ -114,10 +115,15 @@ func GetMetricsFromPods(ctx context.Context, fetcher MetricFetcher, pods []corev
// TODO: Let's optimize the performance for multi-metrics later.
metric, err := fetcher.FetchPodMetrics(ctx, pod, source)
if err != nil {
- return nil, err
+ klog.ErrorS(err, "Failed to get metrics from p... | pkg/controller/podautoscaler/metrics/utils.go | 26 | Go | 0.571 | suggestion | 235 | 50 | 51 | false | [Bug] fix: add more info for pod metric fetch failures in GetMetricsFromPods | 1,039 | vllm-project/aibrix | 2,572 | Go | varungup90 | googs1025 |
ExcellentDistribution: "EXCELLENT",
GoodDistribution: "GOOD",
FairDistribution: "FAIR",
PoorDistribution: "POOR",
}
var redisClient *redis.Client
var (
availablePods []string
)
func (d DistributionQuality) String() string {
if str, ok := distributionQualityStrings[d]; ok {
return str
}
retur... | if we use `defer` here, the scope is associated to `setupVTCUsers`, but `setupVTCUsers` is invoked within the test and test might not be done, I think the idea is to close the connection no matter it succeed or failed.
Technically, I feel replace with following code makes more sense. binding the lifecycle to test i... | ExcellentDistribution: "EXCELLENT",
GoodDistribution: "GOOD",
FairDistribution: "FAIR",
PoorDistribution: "POOR",
}
var redisClient *redis.Client
var (
availablePods []string
)
func (d DistributionQuality) String() string {
if str, ok := distributionQualityStrings[d]; ok {
return str
}
retur... | @@ -89,6 +89,7 @@ func setupVTCUsers(t *testing.T) {
if redisClient == nil {
t.Fatal("Failed to connect to Redis")
}
+ defer redisClient.Close() | test/e2e/vtc_routing_test.go | 26 | Go | 0.857 | bug | 389 | 51 | 51 | false | [Misc] fix: add miss Close() for redis client | 1,056 | vllm-project/aibrix | 2,572 | Go | Jeffwan | googs1025 |
// KVCacheReconciler reconciles a KVCache object
type KVCacheReconciler struct {
client.Client
Scheme *runtime.Scheme
Recorder record.EventRecorder
RuntimeConfig config.RuntimeConfig
Backends map[string]backends.BackendReconciler
}
// +kubebuilder:rbac:groups=orchestration.aibrix.ai,resources=kv... | /cc @googs1025 Please take a look |
// KVCacheReconciler reconciles a KVCache object
type KVCacheReconciler struct {
client.Client
Scheme *runtime.Scheme
Recorder record.EventRecorder
RuntimeConfig config.RuntimeConfig
Backends map[string]backends.BackendReconciler
}
// +kubebuilder:rbac:groups=orchestration.aibrix.ai,resources=kv... | @@ -133,6 +133,10 @@ type KVCacheReconciler struct {
// +kubebuilder:rbac:groups=apps,resources=deployments/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=apps,resources=statefulsets,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=apps,resources=statefulsets/status,verbs=get;up... | pkg/controller/kvcache/kvcache_controller.go | 26 | Go | 0.071 | suggestion | 33 | 51 | 51 | false | Support watcher pod rbac in kvcache controller | 1,071 | vllm-project/aibrix | 2,572 | Go | Jeffwan | Jeffwan |
return nil
}
func (r *BaseReconciler) ReconcileStatefulsetObject(ctx context.Context, sts *appsv1.StatefulSet) error {
found := &appsv1.StatefulSet{}
err := r.Get(ctx, types.NamespacedName{Name: sts.Name, Namespace: sts.Namespace}, found)
if err != nil && apierrors.IsNotFound(err) {
klog.InfoS("Creating a new S... | If it is reconcile, do we need to consider the update case? For example, do we need to check whether they are equal, and update if they are not equal? 🤔 | }
return nil
}
func (r *BaseReconciler) ReconcileStatefulsetObject(ctx context.Context, sts *appsv1.StatefulSet) error {
found := &appsv1.StatefulSet{}
err := r.Get(ctx, types.NamespacedName{Name: sts.Name, Namespace: sts.Namespace}, found)
if err != nil && apierrors.IsNotFound(err) {
klog.InfoS("Creating a ne... | @@ -128,6 +129,42 @@ func (r *BaseReconciler) ReconcileStatefulsetObject(ctx context.Context, sts *ap
return nil
}
+func (r *BaseReconciler) reconcileWatcherPodServiceAccount(ctx context.Context, sa *corev1.ServiceAccount) error { | pkg/controller/kvcache/backends/reconciler.go | 26 | Go | 0.429 | suggestion | 153 | 51 | 51 | false | Support watcher pod rbac in kvcache controller | 1,071 | vllm-project/aibrix | 2,572 | Go | googs1025 | Jeffwan |
#!/bin/bash
set -euo pipefail
DEVICE="mlx5_2"
PORT=1
BASE_PATH="/sys/class/infiniband/${DEVICE}/ports/${PORT}/gid_attrs/types"
echo "Scanning GID types in: $BASE_PATH"
if [ ! -d "$BASE_PATH" ]; then
echo "❌ Directory not found: $BASE_PATH"
echo "Check if the RDMA device and port are correct and visible in thi... | ```
DEVICE=${DEVICE:-"mlx5_2"}
PORT=${PORT:-1}
```
would be better for users to overwrite these parameter without modifying the script. | #!/bin/bash
set -euo pipefail
DEVICE=${DEVICE:-"mlx5_2"}
PORT=${PORT:-1}
BASE_PATH="/sys/class/infiniband/${DEVICE}/ports/${PORT}/gid_attrs/types"
echo "Scanning GID types in: $BASE_PATH"
if [ ! -d "$BASE_PATH" ]; then
echo "❌ Directory not found: $BASE_PATH"
echo "Check if the RDMA device and port are correc... | @@ -0,0 +1,35 @@
+#!/bin/bash
+set -euo pipefail
+
+DEVICE="mlx5_2"
+PORT=1 | hack/rdma/detect-gid-in-container.sh | 5 | Shell | 0.786 | suggestion | 139 | 30 | 30 | false | Add rdma gid search scripts | 1,072 | vllm-project/aibrix | 2,572 | Go | DwyaneShi | Jeffwan |
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is d... | Make interface definition clearer | Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is d... | @@ -26,8 +26,9 @@ import (
)
type Scheduler interface {
- // SelectPod returns the pod to schedule model adapter
- SelectPod(ctx context.Context, model string, pods []v1.Pod) (*v1.Pod, error)
+ // SelectPod selects a suitable Pod to schedule the model adapter based on the given model and available pods. | pkg/controller/modeladapter/scheduling/scheduler.go | 26 | Go | 0.071 | suggestion | 33 | 47 | 48 | false | [Misc] chore: change Scheduler interface describe in modeladapter controller | 1,075 | vllm-project/aibrix | 2,572 | Go | googs1025 | googs1025 |
for _, condition := range conditions {
if meta.SetStatusCondition(&instance.Status.Conditions, condition) {
changed = true
}
}
// TODO: sort the conditions based on LastTransitionTime if needed.
klog.InfoS("model adapter reconcile", "Update CR status", instance.Name, "changed", changed, "status", instance.St... | if we can not find the condition, should we return error here? I have concern that the state machine might not be correct so it never create this condition even we return errors and re-enter the reconciliation loop.
Another approach is to create the new scheduleCondition to unblock the next steps.
Could you help... | func (r *ModelAdapterReconciler) updateStatus(ctx context.Context, instance *modelv1alpha1.ModelAdapter, conditions ...metav1.Condition) error {
changed := false
for _, condition := range conditions {
if meta.SetStatusCondition(&instance.Status.Conditions, condition) {
changed = true
}
}
// TODO: sort the co... | @@ -484,10 +484,16 @@ func (r *ModelAdapterReconciler) clearModelAdapterInstanceList(ctx context.Conte
// However, meta.SetStatusCondition won't update the status unless there's other change like Status as well.
// Here it also help trigger time update in later updates.
scheduleCondition := meta.FindStatusConditi... | pkg/controller/modeladapter/modeladapter_controller.go | 26 | Go | 0.643 | bug | 381 | 51 | 51 | false | [Bug] fix: condition nil panic in FindStatusCondition func | 1,078 | vllm-project/aibrix | 2,572 | Go | Jeffwan | googs1025 |
// Total number of available pods (ready for at least minReadySeconds) targeted by this deployment.
// +optional
AvailableReplicas int32 `json:"availableReplicas,omitempty" protobuf:"varint,4,opt,name=availableReplicas"`
// Total number of unavailable pods targeted by this deployment. This is the total number of
... | I'd like to double confirm the purpose of this change. Do you mean you like to use naive HPA for `RayClusterFleet` and this will be passed through the HPA object?
What would be the target? head or entire pods? they both have corresponding labels. | // Total number of available pods (ready for at least minReadySeconds) targeted by this deployment.
// +optional
AvailableReplicas int32 `json:"availableReplicas,omitempty" protobuf:"varint,4,opt,name=availableReplicas"`
// Total number of unavailable pods targeted by this deployment. This is the total number of
... | @@ -113,6 +113,10 @@ type RayClusterFleetStatus struct {
// newest ReplicaSet.
// +optional
CollisionCount *int32 `json:"collisionCount,omitempty" protobuf:"varint,8,opt,name=collisionCount"`
+
+ // HPAPodSelector for pods that belong to the RayClusterFleet object, this is
+ // needed for HPA to know what pods be... | api/orchestration/v1alpha1/rayclusterfleet_types.go | 26 | Go | 0.643 | suggestion | 250 | 51 | 51 | false | [Bug]fix: add scale subresource to rayclusterfleet | 1,082 | vllm-project/aibrix | 2,572 | Go | Jeffwan | zhixian82 |
// FoundNewRSReason is added in a deployment when it adopts an existing replica set.
FoundNewRSReason = "FoundNewReplicaSet"
// NewRSAvailableReason is added in a deployment when its newest replica set is made available
// ie. the number of new pods that have passed readiness checks and run for at least minReadySec... | can we change to `orchestration.aibrix.ai`, let's add the group name as well. | // FoundNewRSReason is added in a deployment when it adopts an existing replica set.
FoundNewRSReason = "FoundNewReplicaSet"
// NewRSAvailableReason is added in a deployment when its newest replica set is made available
// ie. the number of new pods that have passed readiness checks and run for at least minReadySec... | @@ -103,6 +103,9 @@ const (
// MinimumReplicasUnavailable is added in a deployment when it doesn't have the minimum required replicas
// available.
MinimumReplicasUnavailable = "MinimumReplicasUnavailable"
+
+ // Set name label will record the rayclusterfleet name that those Pods belong to.
+ SetNameLabelKey stri... | pkg/controller/rayclusterfleet/util/fleet.go | 26 | Go | 0.429 | suggestion | 77 | 51 | 51 | false | [Bug]fix: add scale subresource to rayclusterfleet | 1,082 | vllm-project/aibrix | 2,572 | Go | Jeffwan | zhixian82 |
AIBRIX_KV_CACHE_OL_L2_CACHE_NUM_ASYNC_WORKERS: int = 8
# Mock Connector
AIBRIX_KV_CACHE_OL_MOCK_USE_RDMA: bool = False
AIBRIX_KV_CACHE_OL_MOCK_USE_MPUT_MGET: bool = False
# RocksDB Env Vars
AIBRIX_KV_CACHE_OL_ROCKSDB_ROOT: str = os.path.expanduser(
os.path.join(os.path.expanduser("~"),... | I kind of feel this fashion is a little bit conflict with `NCCL_IB_HCA` setting, however, their `:1` is port, but not gid. Let's stick with this way at this moment and consider whether need to do internal search or env auto replacement later. | AIBRIX_KV_CACHE_OL_L2_CACHE_NUM_ASYNC_WORKERS: int = 8
# Mock Connector
AIBRIX_KV_CACHE_OL_MOCK_USE_RDMA: bool = False
AIBRIX_KV_CACHE_OL_MOCK_USE_MPUT_MGET: bool = False
# RocksDB Env Vars
AIBRIX_KV_CACHE_OL_ROCKSDB_ROOT: str = os.path.expanduser(
os.path.join(os.path.expanduser("~"),... | @@ -98,6 +98,9 @@
AIBRIX_KV_CACHE_OL_INFINISTORE_CONNECTION_TYPE: str = "RDMA"
AIBRIX_KV_CACHE_OL_INFINISTORE_IB_PORT: int = 1
AIBRIX_KV_CACHE_OL_INFINISTORE_LINK_TYPE: str = "Ethernet"
+ # Since 0.2.42, InfiniStore supports RDMA GID index in client config,
+ # users can specify the GID index of ea... | python/aibrix_kvcache/aibrix_kvcache/envs.py | 26 | Python | 0.643 | suggestion | 242 | 51 | 51 | false | [Feature] KVCache: Suppport InfiniStore GID and enhance cluster mode | 1,106 | vllm-project/aibrix | 2,572 | Go | Jeffwan | DwyaneShi |
}
return filtered
}
func FilterPodByName(podname string, pods []*v1.Pod) (*v1.Pod, bool) {
for _, pod := range pods {
if pod.Name == podname {
return pod, true
}
}
return nil, false
}
// SelectRandomPod selects a random pod from the provided list, ensuring it's routable.
// It returns an error if no ready... | Should we add similar boundary conditions to make the code more robust?
🤔
```go
if pod == nil || pod.Labels == nil {
return defaultPodMetricPort
}
portStr, exists := pod.Labels[modelPortIdentifier]
if !exists {
return defaultPodMetricPort
}
``` | }
return filtered
}
func FilterPodByName(podname string, pods []*v1.Pod) (*v1.Pod, bool) {
for _, pod := range pods {
if pod.Name == podname {
return pod, true
}
}
return nil, false
}
// SelectRandomPod selects a random pod from the provided list, ensuring it's routable.
// It returns an error if no ready... | @@ -238,3 +241,11 @@ func SelectRandomPod(pods []*v1.Pod, randomFn func(int) int) (*v1.Pod, error) {
randomPod := readyPods[randomFn(len(readyPods))]
return randomPod, nil
}
+
+func GetModelPortForPod(pod *v1.Pod) int64 {
+ modelPort, err := strconv.ParseInt(pod.Labels[modelPortIdentifier], 10, 32) | pkg/utils/pod.go | 26 | Go | 0.857 | question | 294 | 32 | 41 | false | Add support for custom inference engine port | 1,140 | vllm-project/aibrix | 2,572 | Go | googs1025 | varungup90 |
from aibrix.gpu_optimizer.utils import DelayedLog
from .clusterer import Clusterer, MovingDBSCANClusterer
from .helpers import Centeroid, DataBuffer, DataPoint
from .load_reader import LoadReader, LoadRecord
from .profile_reader import ProfileReader
Empty_Array: Iterable = []
logger = logging.getLogger("aibrix.gpu_o... | Currently it is redundant, but I think it will be useful in the near future. 🤔 | from aibrix.gpu_optimizer.utils import DelayedLog
from .clusterer import Clusterer, MovingDBSCANClusterer
from .helpers import Centeroid, DataBuffer, DataPoint
from .load_reader import LoadReader, LoadRecord
from .profile_reader import ProfileReader
Empty_Array: Iterable = []
logger = logging.getLogger("aibrix.gpu_o... | @@ -44,8 +44,9 @@
class DeploymentStates:
"""States of a deployment with resource version."""
- def __init__(self, name: str, replicas: int = 1, min_replicas: int = 0):
+ def __init__(self, name: str, namespace: str, replicas: int = 1, min_replicas: int = 0):
self.name = name
+ self.namesp... | python/aibrix/aibrix/gpu_optimizer/load_monitor/monitor.py | 26 | Python | 0.286 | suggestion | 79 | 51 | 51 | false | [Misc] [gpu_optimizer] add namespace info for log | 1,149 | vllm-project/aibrix | 2,572 | Go | googs1025 | googs1025 |
}
}
// If header not set, use default routing strategy from environment variable
return defaultRoutingStrategy, defaultRoutingStrategyEnabled
}
// getChatCompletionsMessage returns message for chat completions object
func getChatCompletionsMessage(requestID string, chatCompletionObj openai.ChatCompletionNewParam... | Any reason to continue message processing even on error? Can you also add a unit test for this. | }
}
// If header not set, use default routing strategy from environment variable
return defaultRoutingStrategy, defaultRoutingStrategyEnabled
}
// getChatCompletionsMessage returns message for chat completions object
func getChatCompletionsMessage(requestID string, chatCompletionObj openai.ChatCompletionNewParam... | @@ -117,30 +117,26 @@ func getRoutingStrategy(headers []*configPb.HeaderValue) (string, bool) {
}
// getChatCompletionsMessage returns message for chat completions object
-func getChatCompletionsMessage(jsonMap map[string]json.RawMessage) (string, *extProcPb.ProcessingResponse) {
- // openai golang lib does not sup... | pkg/plugins/gateway/util.go | 26 | Go | 0.357 | nitpick | 95 | 51 | 51 | false | [Bug] fix: error when parse complex content in completion body | 1,160 | vllm-project/aibrix | 2,572 | Go | varungup90 | firebook |
# Copyright 2024 The Aibrix Team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | add some unit test, But I'm not sure if it complies with the feature logic. If you can, please help me check it out | # Copyright 2024 The Aibrix Team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | @@ -0,0 +1,113 @@
+# Copyright 2024 The Aibrix Team.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable ... | python/aibrix_kvcache/tests/test_common.py | 21 | Python | 0.357 | suggestion | 115 | 46 | 46 | false | [Bug]: fix(aibrix kvcache): ObjectPool | 1,162 | vllm-project/aibrix | 2,572 | Go | googs1025 | googs1025 |
}
return add(mgr, r)
}
// newReconciler returns a new reconcile.Reconciler
func newReconciler(mgr manager.Manager, runtimeConfig config.RuntimeConfig) (reconcile.Reconciler, error) {
cacher := mgr.GetCache()
podInformer, err := cacher.GetInformer(context.TODO(), &corev1.Pod{})
if err != nil {
return nil, err
... | if you do not have any variables. I suggest to use `errors.New(..)` instead of `fmt.Errorf(..)` | }
return add(mgr, r)
}
// newReconciler returns a new reconcile.Reconciler
func newReconciler(mgr manager.Manager, runtimeConfig config.RuntimeConfig) (reconcile.Reconciler, error) {
cacher := mgr.GetCache()
podInformer, err := cacher.GetInformer(context.TODO(), &corev1.Pod{})
if err != nil {
return nil, err
... | @@ -146,6 +146,12 @@ func newReconciler(mgr manager.Manager, runtimeConfig config.RuntimeConfig) (rec
return nil, err
}
+ klog.Info("Waiting for caches to sync")
+ if ok := cacher.WaitForCacheSync(context.TODO()); !ok {
+ return nil, fmt.Errorf("failed to sync cache") | pkg/controller/modeladapter/modeladapter_controller.go | 26 | Go | 0.571 | suggestion | 95 | 51 | 51 | false | [Misc]: ensure cache sync before starting controller reconcile | 1,219 | vllm-project/aibrix | 2,572 | Go | Jeffwan | googs1025 |
capacity_nbytes=capacity_nbytes,
device=device,
pin_memory=pin_memory,
)
else:
return CoalescingPoolAllocator(
capacity_nbytes=capacity_nbytes,
device=device,
pin_memory=pin_memory,
... | what's `MR_USE_COMPACT_LAYOUT`? | self.device: str = "cpu" if device is None else device
self.pin_memory: bool = pin_memory
self._lock: Lock = Lock()
# Fill slabs
self._slabs: List[torch.Tensor] = []
self._grow(capacity_nbytes)
@staticmethod
def create(
*,
capacity_nbytes: int,
... | @@ -387,31 +384,46 @@ def __init__(
self.device: str = "cpu" if device is None else device
self.pin_memory: bool = pin_memory
- self._mr_list = SortedList([], key=lambda x: x.data_ptr())
- # Each item is a list of memory regions having the same length
- self._lookup_table = Sort... | python/aibrix_kvcache/aibrix_kvcache/memory/allocator.py | 26 | Python | 0.286 | question | 32 | 51 | 51 | false | [Feature] KVCache: optimize allocator for compact layout | 1,288 | vllm-project/aibrix | 2,572 | Go | Jeffwan | DwyaneShi |
device=device,
pin_memory=pin_memory,
)
else:
return CoalescingPoolAllocator(
capacity_nbytes=capacity_nbytes,
device=device,
pin_memory=pin_memory,
)
def __len__(self) -> int:
"""Ret... | any simple allocation performance comparision between these two? | self.pin_memory: bool = pin_memory
self._lock: Lock = Lock()
# Fill slabs
self._slabs: List[torch.Tensor] = []
self._grow(capacity_nbytes)
@staticmethod
def create(
*,
capacity_nbytes: int,
device: str = "cpu",
pin_memory: bool = False,
... | @@ -387,31 +384,46 @@ def __init__(
self.device: str = "cpu" if device is None else device
self.pin_memory: bool = pin_memory
- self._mr_list = SortedList([], key=lambda x: x.data_ptr())
- # Each item is a list of memory regions having the same length
- self._lookup_table = Sort... | python/aibrix_kvcache/aibrix_kvcache/memory/allocator.py | 26 | Python | 0.357 | performance | 64 | 51 | 51 | false | [Feature] KVCache: optimize allocator for compact layout | 1,288 | vllm-project/aibrix | 2,572 | Go | Jeffwan | DwyaneShi |
continue
}
histogramValue := &metrics.HistogramMetricValue{
Sum: metricValue.Sum,
Count: metricValue.Count,
Buckets: metricValue.Buckets,
}
err = c.updatePodRecord(pod, modelName, metricName, scope, histogramValue)
if err != nil {
klog.V(4).Infof("Failed to update metrics %s fr... | my point is we should always use full metrics name instead of `vllm:%s` which is confusing. Let's cut a short PR to fix this part first. | histogramValue := &metrics.HistogramMetricValue{
Sum: metricValue.Sum,
Count: metricValue.Count,
Buckets: metricValue.Buckets,
}
err = c.updatePodRecord(pod, modelName, metricName, scope, histogramValue)
if err != nil {
klog.V(4).Infof("Failed to update metrics %s from pod %s %s %d: %v... | @@ -250,7 +254,7 @@ func (c *Store) updateQueryLabelMetricFromRawMetrics(pod *Pod, allMetrics map[st
}
rawMetricName := metric.RawMetricName
scope := metric.MetricScope
- metricFamily, exists := allMetrics[fmt.Sprintf("vllm:%s", rawMetricName)] | pkg/cache/cache_metrics.go | 26 | Go | 0.571 | suggestion | 137 | 51 | 51 | false | [Feature] Adding raw metrics name conversion in metrics | 1,293 | vllm-project/aibrix | 2,572 | Go | Jeffwan | happyandslow |
}
}
}
func (c *Store) queryUpdatePromQLMetrics(ctx context.Context, metric metrics.Metric, queryLabels map[string]string, pod *Pod, modelName string, metricName string, podMetricPort int) error {
scope := metric.MetricScope
query := metrics.BuildQuery(metric.PromQL, queryLabels)
// Querying metrics
result, warn... | labelMetricName is the aibrix normalized metrics name, right? |
func (c *Store) queryUpdatePromQLMetrics(ctx context.Context, metric metrics.Metric, queryLabels map[string]string, pod *Pod, modelName string, metricName string, podMetricPort int) error {
scope := metric.MetricScope
query := metrics.BuildQuery(metric.PromQL, queryLabels)
// Querying metrics
result, warnings, err... | @@ -330,14 +334,37 @@ func (c *Store) queryUpdatePromQLMetrics(ctx context.Context, metric metrics.Met
return nil
}
+func (c *Store) fetchMetrics(pod *Pod, allMetrics map[string]*dto.MetricFamily, labelMetricName string) (*dto.MetricFamily, bool) {
+ metric, exists := metrics.Metrics[labelMetricName] | pkg/cache/cache_metrics.go | 26 | Go | 0.214 | question | 62 | 51 | 51 | false | [Feature] Adding raw metrics name conversion in metrics | 1,293 | vllm-project/aibrix | 2,572 | Go | Jeffwan | happyandslow |
if err != nil {
// Skip this model fetching if an error is thrown
return fmt.Errorf("error executing query: %v", err)
}
if len(warnings) > 0 {
klog.V(4).Infof("Warnings: %v\n", warnings)
}
// Update metrics
metricValue := &metrics.PrometheusMetricValue{Result: &result}
err = c.updatePodRecord(pod, modelNa... | here it tries to convert to engine specific name. | }
if len(warnings) > 0 {
klog.V(4).Infof("Warnings: %v\n", warnings)
}
// Update metrics
metricValue := &metrics.PrometheusMetricValue{Result: &result}
err = c.updatePodRecord(pod, modelName, metricName, scope, metricValue)
if err != nil {
return fmt.Errorf("failed to update metrics %s from prometheus %s: %... | @@ -330,14 +334,37 @@ func (c *Store) queryUpdatePromQLMetrics(ctx context.Context, metric metrics.Met
return nil
}
+func (c *Store) fetchMetrics(pod *Pod, allMetrics map[string]*dto.MetricFamily, labelMetricName string) (*dto.MetricFamily, bool) {
+ metric, exists := metrics.Metrics[labelMetricName]
+ if !exists ... | pkg/cache/cache_metrics.go | 26 | Go | 0.071 | suggestion | 49 | 51 | 51 | false | [Feature] Adding raw metrics name conversion in metrics | 1,293 | vllm-project/aibrix | 2,572 | Go | Jeffwan | happyandslow |
func (c *Store) aggregateMetrics() {
for _, subscriber := range c.subscribers {
for _, metric := range subscriber.SubscribedMetrics() {
if _, exists := c.metrics[metric]; !exists {
// TODO: refactor to
c.metrics[metric] = "yes"
}
}
}
}
func getPodMetricPort(pod *Pod) int {
if pod == nil || pod.Lab... | do we have such utils in utils.go etc? can you search references? | /*
Copyright 2024 The Aibrix Team.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... | @@ -380,3 +407,12 @@ func getPodMetricPort(pod *Pod) int {
}
return defaultMetricPort
}
+
+func getPodLabel(pod *Pod, labelName string, defaultValue string) string { | pkg/cache/cache_metrics.go | 26 | Go | 0.214 | question | 65 | 34 | 398 | false | [Feature] Adding raw metrics name conversion in metrics | 1,293 | vllm-project/aibrix | 2,572 | Go | Jeffwan | happyandslow |
}
func (m MetricType) IsRawMetric() bool {
return m.Raw != ""
}
func (m MetricType) IsQuery() bool {
return m.Query != ""
}
// MetricScope defines the scope of a metric (e.g., model or pod or podmodel).
type MetricScope string
const (
ModelMetricScope MetricScope = "Model"
PodMetricScope MetricScope = "... | with the mapping, the rawMetricsName should be logical metrics names? We need to consider the compatibility as well | }
func (m MetricType) IsRawMetric() bool {
return m.Raw != ""
}
func (m MetricType) IsQuery() bool {
return m.Query != ""
}
// MetricScope defines the scope of a metric (e.g., model or pod or podmodel).
type MetricScope string
const (
ModelMetricScope MetricScope = "Model"
PodMetricScope MetricScope = "... | @@ -77,12 +77,13 @@ const (
// Metric defines a unique metric with metadata.
type Metric struct {
- MetricSource MetricSource
- MetricType MetricType
- PromQL string // Optional: Only applicable for PromQL-based metrics
- RawMetricName string // Optional: Only applicable for QueryLabel-based metrics
- De... | pkg/metrics/types.go | 26 | Go | 0.429 | suggestion | 115 | 51 | 51 | false | [Feature] Adding raw metrics name conversion in metrics | 1,293 | vllm-project/aibrix | 2,572 | Go | Jeffwan | happyandslow |
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package ca... | do we have const in some common files? |
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package ca... | @@ -33,6 +33,11 @@ const (
// the request port and metrics port may differ, so a dedicated metrics port is required.
MetricPortLabel = "model.aibrix.ai/metric-port"
defaultPodMetricRefreshIntervalInMS = 50
+ engineLabel = "model.aibrix.ai/engine" | pkg/cache/cache_metrics.go | 26 | Go | 0.071 | question | 38 | 51 | 51 | false | [Feature] Adding raw metrics name conversion in metrics | 1,293 | vllm-project/aibrix | 2,572 | Go | Jeffwan | happyandslow |
limitations under the License.
*/
package cache
import (
"context"
"fmt"
"time"
prometheusv1 "github.com/prometheus/client_golang/api/prometheus/v1"
dto "github.com/prometheus/client_model/go"
"github.com/vllm-project/aibrix/pkg/metrics"
"github.com/vllm-project/aibrix/pkg/utils"
"k8s.io/klog/v2"
)
const (
... | do we need this? seems "" is weird. if there's no model found, we should ignore this pod or throw warning | limitations under the License.
*/
package cache
import (
"context"
"fmt"
"time"
prometheusv1 "github.com/prometheus/client_golang/api/prometheus/v1"
dto "github.com/prometheus/client_model/go"
"github.com/vllm-project/aibrix/pkg/metrics"
"github.com/vllm-project/aibrix/pkg/utils"
"k8s.io/klog/v2"
)
const (
... | @@ -28,11 +27,17 @@ import (
)
const (
- defaultMetricPort = 8000
// When the engine's HTTP proxy is separated from the engine itself,
// the request port and metrics port may differ, so a dedicated metrics port is required.
MetricPortLabel = "model.aibrix.ai/metric-port"
+ engineLabel ... | pkg/cache/cache_metrics.go | 26 | Go | 0.429 | question | 105 | 51 | 51 | false | [Feature] Adding raw metrics name conversion in metrics | 1,293 | vllm-project/aibrix | 2,572 | Go | Jeffwan | happyandslow |
"k8s.io/klog/v2"
)
const (
// When the engine's HTTP proxy is separated from the engine itself,
// the request port and metrics port may differ, so a dedicated metrics port is required.
MetricPortLabel = "model.aibrix.ai/metric-port"
engineLabel = "model.aibrix.ai/engin... | if you put the engine here, does vLLM deployment also try to find this metrics? | "k8s.io/klog/v2"
)
const (
// When the engine's HTTP proxy is separated from the engine itself,
// the request port and metrics port may differ, so a dedicated metrics port is required.
MetricPortLabel = "model.aibrix.ai/metric-port"
engineLabel = "model.aibrix.ai/engin... | @@ -44,6 +49,7 @@ var (
metrics.AvgGenerationThroughputToksPerS,
metrics.GPUCacheUsagePerc,
metrics.CPUCacheUsagePerc,
+ metrics.EngineUtilization, | pkg/cache/cache_metrics.go | 26 | Go | 0.214 | question | 79 | 51 | 51 | false | [Feature] Adding raw metrics name conversion in metrics | 1,293 | vllm-project/aibrix | 2,572 | Go | Jeffwan | happyandslow |
if !exists {
klog.V(4).Infof("Cannot find labelMetricName %v in collected metrics names", labelMetricName)
return nil, false
}
engineType := getPodLabel(pod, engineLabel, defaultEngineLabelValue)
rawMetricName, ok := metric.EngineMetricsNameMapping[engineType]
if !ok {
klog.V(4).Infof("Cannot find engine typ... | let's update the method to return `name, bool`, defaultModleName ="" is kind of weird | klog.V(4).Infof("Cannot find labelMetricName %v in collected metrics names", labelMetricName)
return nil, false
}
engineType, err := getPodLabel(pod, engineLabel)
if engineType == "" {
klog.V(4).Infof(err.Error())
engineType = defaultEngineLabelValue
}
rawMetricName, ok := metric.EngineMetricsNameMapping[e... | @@ -330,14 +332,37 @@ func (c *Store) queryUpdatePromQLMetrics(ctx context.Context, metric metrics.Met
return nil
}
+func (c *Store) fetchMetrics(pod *Pod, allMetrics map[string]*dto.MetricFamily, labelMetricName string) (*dto.MetricFamily, bool) {
+ metric, exists := metrics.Metrics[labelMetricName]
+ if !exists ... | pkg/cache/cache_metrics.go | 26 | Go | 0.357 | suggestion | 85 | 51 | 51 | false | [Feature] Adding raw metrics name conversion in metrics | 1,293 | vllm-project/aibrix | 2,572 | Go | Jeffwan | happyandslow |
Raw: Counter,
},
EngineMetricsNameMapping: map[string]string{
"vllm": "vllm:num_requests_waiting",
},
Description: "Number of waiting requests",
},
NumRequestsSwapped: {
MetricScope: PodModelMetricScope,
MetricSource: PodRawMetrics,
MetricType: MetricType{
Raw: Counter,
},
En... | sglang doesn't have such metrics? | Raw: Counter,
},
EngineMetricsNameMapping: map[string]string{
"vllm": "vllm:num_requests_waiting",
},
Description: "Number of waiting requests",
},
NumRequestsSwapped: {
MetricScope: PodModelMetricScope,
MetricSource: PodRawMetrics,
MetricType: MetricType{
Raw: Counter,
},
En... | @@ -88,6 +99,9 @@ var (
MetricType: MetricType{
Raw: Gauge,
},
+ EngineMetricsNameMapping: map[string]string{ | pkg/metrics/metrics.go | 26 | Go | 0.071 | question | 33 | 51 | 51 | false | [Feature] Adding raw metrics name conversion in metrics | 1,293 | vllm-project/aibrix | 2,572 | Go | Jeffwan | happyandslow |
var toCreate, toDelete []*v1.Pod
allPods, err := getRolePods(ctx, s.cli, roleSet.Namespace, roleSet.Name, role.Name)
if err != nil {
return err
}
activePods, _ := filterActivePods(allPods)
expectedReplicas := getRoleReplicas(role)
updated, outdated := filterUpdatedPods(activePods, s.computeHashFunc(&role.Templ... | Notice, the logic here has been modified. I believe pods that are outdated and not ready can be directly deleted. In the original logic, it would break if deleteBudget was less than or equal to 0. | }
func (s *StatelessRoleSyncer) Rollout(ctx context.Context, roleSet *orchestrationv1alpha1.RoleSet, role *orchestrationv1alpha1.RoleSpec) error {
var toCreate, toDelete []*v1.Pod
allPods, err := getRolePods(ctx, s.cli, roleSet.Namespace, roleSet.Name, role.Name)
if err != nil {
return err
}
activePods, _ := fi... | @@ -438,20 +442,24 @@ func (s *StatelessRoleSyncer) Rollout(ctx context.Context, roleSet *orchestratio
}
activePods, _ := filterActivePods(allPods)
expectedReplicas := getRoleReplicas(role)
- updated, outdated := filterUpdatedPods(activePods, ctrlutil.ComputeHash(&role.Template, nil))
- klog.Infof("[StatelessRole... | pkg/controller/roleset/rolesyncer.go | 26 | Go | 0.357 | suggestion | 196 | 51 | 51 | false | [Misc] Add unit test code coverage of rolesyncer | 1,296 | vllm-project/aibrix | 2,572 | Go | vie-serendipity | vie-serendipity |
}
if _, err = deletePodsInBatch(ctx, s.cli, toDelete); err != nil {
return false, err
}
return len(toCreate) > 0 || len(toDelete) > 0, nil
}
func (s *StatelessRoleSyncer) Rollout(ctx context.Context, roleSet *orchestrationv1alpha1.RoleSet, role *orchestrationv1alpha1.RoleSpec) error {
var toCreate, toDelete []*... | this is a logic change.. I think it's better to have a code improvement for fix separately. After the change, all unready pods will be processed. | }
if _, err = createPodsInBatch(ctx, s.cli, toCreate); err != nil {
return false, err
}
if _, err = deletePodsInBatch(ctx, s.cli, toDelete); err != nil {
return false, err
}
return len(toCreate) > 0 || len(toDelete) > 0, nil
}
func (s *StatelessRoleSyncer) Rollout(ctx context.Context, roleSet *orchestrationv... | @@ -438,20 +442,24 @@ func (s *StatelessRoleSyncer) Rollout(ctx context.Context, roleSet *orchestratio
}
activePods, _ := filterActivePods(allPods)
expectedReplicas := getRoleReplicas(role)
- updated, outdated := filterUpdatedPods(activePods, ctrlutil.ComputeHash(&role.Template, nil))
- klog.Infof("[StatelessRole... | pkg/controller/roleset/rolesyncer.go | 26 | Go | 0.429 | suggestion | 146 | 51 | 51 | false | [Misc] Add unit test code coverage of rolesyncer | 1,296 | vllm-project/aibrix | 2,572 | Go | Jeffwan | vie-serendipity |
sgls: List[Pris.SGL] = []
cache_keys: List[str] = []
value_lens: List[int] = []
op_status: List[Status] = [Status.ok()] * len(keys)
for i, mr in enumerate(mrs):
desc_status = self._get_register_descriptor(mr)
if not desc_status.is_ok():
for... | need we keep the detail error code from the sdk? | sgls: List[Pris.SGL] = []
cache_keys: List[str] = []
value_lens: List[int] = []
op_status: List[Status] = [Status.ok()] * len(keys)
for i, mr in enumerate(mrs):
desc_status = self._get_register_descriptor(mr)
if not desc_status.is_ok():
for... | @@ -0,0 +1,275 @@
+# Copyright 2024 The Aibrix Team.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable ... | python/aibrix_kvcache/aibrix_kvcache/l2/connectors/pris.py | 26 | Python | 0.214 | question | 48 | 51 | 51 | false | [Feature] KVCache: add Pris connector | 1,303 | vllm-project/aibrix | 2,572 | Go | yapple | DwyaneShi |
cache_keys: List[str] = []
op_status: List[Status] = [Status.ok()] * len(keys)
for i, mr in enumerate(mrs):
desc_status = self._get_register_descriptor(mr)
if not desc_status.is_ok():
for j in range(i, len(keys)):
op_status[j] = Status(... | need we keep the detail error code from the sdk? | ) -> Sequence[Status]:
assert self.conn is not None
sgls: List[Pris.SGL] = []
cache_keys: List[str] = []
op_status: List[Status] = [Status.ok()] * len(keys)
for i, mr in enumerate(mrs):
desc_status = self._get_register_descriptor(mr)
if not desc_status... | @@ -0,0 +1,275 @@
+# Copyright 2024 The Aibrix Team.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable ... | python/aibrix_kvcache/aibrix_kvcache/l2/connectors/pris.py | 26 | Python | 0.214 | question | 48 | 29 | 35 | false | [Feature] KVCache: add Pris connector | 1,303 | vllm-project/aibrix | 2,572 | Go | yapple | DwyaneShi |
keys: Sequence[Any],
mrs: Sequence[MemoryRegion],
batch_size: int,
) -> Sequence[Sequence[Tuple[bytes, MemoryRegion]]]:
lists: List[List[Tuple[bytes, MemoryRegion]]] = []
for key, mr in zip(keys, mrs):
if len(lists) == 0 or len(lists[-1]) >= batch_size:
... | Here, if error occurs when we register memory, it seems we still go to self.conn.mget? | keys: Sequence[Any],
mrs: Sequence[MemoryRegion],
batch_size: int,
) -> Sequence[Sequence[Tuple[bytes, MemoryRegion]]]:
lists: List[List[Tuple[bytes, MemoryRegion]]] = []
for key, mr in zip(keys, mrs):
if len(lists) == 0 or len(lists[-1]) >= batch_size:
... | @@ -0,0 +1,275 @@
+# Copyright 2024 The Aibrix Team.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable ... | python/aibrix_kvcache/aibrix_kvcache/l2/connectors/pris.py | 26 | Python | 0.357 | question | 87 | 51 | 51 | false | [Feature] KVCache: add Pris connector | 1,303 | vllm-project/aibrix | 2,572 | Go | sovmatrixac | DwyaneShi |
"AIBRIX_KV_CACHE_OL_HPKV_REMOTE_PORT": lambda: int(
os.getenv("AIBRIX_KV_CACHE_OL_HPKV_REMOTE_PORT", "12346")
),
"AIBRIX_KV_CACHE_OL_HPKV_LOCAL_ADDR": lambda: (
os.getenv("AIBRIX_KV_CACHE_OL_HPKV_LOCAL_ADDR", "127.0.0.1").strip()
),
"AIBRIX_KV_CACHE_OL_HPKV_LOCAL_PORT": lambda: int(
... | Plz, do not add default password. | "AIBRIX_KV_CACHE_OL_HPKV_REMOTE_PORT": lambda: int(
os.getenv("AIBRIX_KV_CACHE_OL_HPKV_REMOTE_PORT", "12346")
),
"AIBRIX_KV_CACHE_OL_HPKV_LOCAL_ADDR": lambda: (
os.getenv("AIBRIX_KV_CACHE_OL_HPKV_LOCAL_ADDR", "127.0.0.1").strip()
),
"AIBRIX_KV_CACHE_OL_HPKV_LOCAL_PORT": lambda: int(
... | @@ -343,6 +349,20 @@
os.getenv("AIBRIX_KV_CACHE_OL_HPKV_USE_GDR", "1").strip().lower()
in ("1", "true")
),
+ # ================== PRIS Env Vars ==================
+ "AIBRIX_KV_CACHE_OL_PRIS_REMOTE_ADDR": lambda: (
+ os.getenv("AIBRIX_KV_CACHE_OL_PRIS_REMOTE_ADDR", "127.0.0.1").strip(... | python/aibrix_kvcache/aibrix_kvcache/envs.py | 26 | Python | 0.071 | suggestion | 34 | 51 | 51 | false | [Feature] KVCache: add Pris connector | 1,303 | vllm-project/aibrix | 2,572 | Go | sovmatrixac | DwyaneShi |
*/
package routingalgorithms
import (
"bytes"
"encoding/json"
"fmt"
"io"
"math/rand"
"net/http"
"strconv"
"time"
"github.com/vllm-project/aibrix/pkg/cache"
"github.com/vllm-project/aibrix/pkg/types"
"github.com/vllm-project/aibrix/pkg/utils"
"github.com/vllm-project/aibrix/pkg/utils/prefixcacheindexer"
... | There's no need to introduce new roles. cache should be aware of stormservice pod labels/envs.
```
Labels: role-name=decode
role-template-hash=7dcf585456
roleset-name=llm-xpyd-roleset-dc8bz
storm-service-name=llm-xpyd
stormservic... | */
package routingalgorithms
import (
"bytes"
"encoding/json"
"fmt"
"io"
"math/rand"
"net/http"
"strconv"
"time"
"github.com/vllm-project/aibrix/pkg/cache"
"github.com/vllm-project/aibrix/pkg/types"
"github.com/vllm-project/aibrix/pkg/utils"
"github.com/vllm-project/aibrix/pkg/utils/prefixcacheindexer"
... | @@ -0,0 +1,212 @@
+/*
+Copyright 2024 The Aibrix Team.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or a... | pkg/plugins/gateway/algorithms/pd_disaggregation.go | 26 | Go | 0.857 | performance | 447 | 51 | 51 | false | [feat] Add prefill-decode disaggregation support in aibrix router | 1,309 | vllm-project/aibrix | 2,572 | Go | Jeffwan | varungup90 |
"bytes"
"encoding/json"
"fmt"
"io"
"math/rand"
"net/http"
"strconv"
"time"
"github.com/vllm-project/aibrix/pkg/cache"
"github.com/vllm-project/aibrix/pkg/types"
"github.com/vllm-project/aibrix/pkg/utils"
"github.com/vllm-project/aibrix/pkg/utils/prefixcacheindexer"
"github.com/vllm-project/aibrix/pkg/util... | what's the purpose of this var? | "bytes"
"encoding/json"
"fmt"
"io"
"math/rand"
"net/http"
"strconv"
"time"
"github.com/vllm-project/aibrix/pkg/cache"
"github.com/vllm-project/aibrix/pkg/types"
"github.com/vllm-project/aibrix/pkg/utils"
"github.com/vllm-project/aibrix/pkg/utils/prefixcacheindexer"
"github.com/vllm-project/aibrix/pkg/util... | @@ -0,0 +1,212 @@
+/*
+Copyright 2024 The Aibrix Team.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or a... | pkg/plugins/gateway/algorithms/pd_disaggregation.go | 26 | Go | 0.071 | question | 31 | 51 | 51 | false | [feat] Add prefill-decode disaggregation support in aibrix router | 1,309 | vllm-project/aibrix | 2,572 | Go | Jeffwan | varungup90 |
tokens, prefixMatchDecodePods, prefixHashes, err := r.evaluatePrefixCache(ctx, decodePods)
if err != nil {
return "", err
}
// do prefill request only if tokens > 256 (default) AND no prefix matched decode pods
if len(tokens) > decodeOnlyTokenLimit && len(prefixMatchDecodePods) == 0 {
if err = r.doPrefillReq... | same as above comment. it should be aware of storm service and build the cache structure.
- stormservice
- roleset
- role | if err = r.doPrefillRequest(ctx, prefillPods); err != nil {
return "", fmt.Errorf("prefill request failed: %w", err)
}
decodePod := r.selectDecodePod(decodePods)
ctx.SetTargetPod(decodePod)
return ctx.TargetAddress(), nil
}
func (r *pdRouter) filterPrefillDecodePods(readyPods []*v1.Pod) ([]*v1.Pod, []*v1.Pod,... | @@ -0,0 +1,212 @@
+/*
+Copyright 2024 The Aibrix Team.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or a... | pkg/plugins/gateway/algorithms/pd_disaggregation.go | 26 | Go | 0.429 | performance | 126 | 51 | 51 | false | [feat] Add prefill-decode disaggregation support in aibrix router | 1,309 | vllm-project/aibrix | 2,572 | Go | Jeffwan | varungup90 |
return nil, err
}
return pdRouter{
cache: c,
tokenizer: tokenizerObj,
prefixCacheIndexer: prefixcacheindexer.NewPrefixHashTable(),
}, nil
}
func (r pdRouter) Route(ctx *types.RoutingContext, readyPodList types.PodList) (string, error) {
prefillPods, decodePods, err := r.filterPrefill... | let's also add few test cases on different setups. e.g. TP, multiple roleset, pooled and replica mode etc. because we only want to filter the pod-group-index=0 pod | }
return pdRouter{
cache: c,
tokenizer: tokenizerObj,
prefixCacheIndexer: prefixcacheindexer.NewPrefixHashTable(),
}, nil
}
func (r pdRouter) Route(ctx *types.RoutingContext, readyPodList types.PodList) (string, error) {
prefillPods, decodePods, err := r.filterPrefillDecodePods(readyPo... | @@ -0,0 +1,212 @@
+/*
+Copyright 2024 The Aibrix Team.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or a... | pkg/plugins/gateway/algorithms/pd_disaggregation.go | 26 | Go | 0.429 | suggestion | 163 | 51 | 51 | false | [feat] Add prefill-decode disaggregation support in aibrix router | 1,309 | vllm-project/aibrix | 2,572 | Go | Jeffwan | varungup90 |
if len(prefixHashes) > 0 {
r.prefixCacheIndexer.AddPrefix(prefixHashes, ctx.Model, decodePod.Name)
}
ctx.SetTargetPod(decodePod)
return ctx.TargetAddress(), nil
}
func (r *pdRouter) filterPrefillDecodePods(readyPods []*v1.Pod) ([]*v1.Pod, []*v1.Pod, error) {
prefillPods, decodePods := []*v1.Pod{}, []*v1.Pod{}
... | why do not evaluate `decodePods` here? | for _, pod := range readyPods {
if rolename, ok = pod.Labels[PDRoleIdentifier]; !ok {
continue
}
if rolename == "prefill" {
prefillPods = append(prefillPods, pod)
} else if rolename == "decode" {
decodePods = append(decodePods, pod)
}
}
if len(prefillPods) == 0 || len(decodePods) == 0 {
return... | @@ -0,0 +1,212 @@
+/*
+Copyright 2024 The Aibrix Team.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or a... | pkg/plugins/gateway/algorithms/pd_disaggregation.go | 26 | Go | 0.214 | question | 38 | 51 | 51 | false | [feat] Add prefill-decode disaggregation support in aibrix router | 1,309 | vllm-project/aibrix | 2,572 | Go | Jeffwan | varungup90 |
c, err := cache.Get()
if err != nil {
klog.Error("fail to get cache store in prefix cache router")
return nil, err
}
return pdRouter{
cache: c,
tokenizer: tokenizerObj,
prefixCacheIndexer: prefixcacheindexer.NewPrefixHashTable(),
}, nil
}
func (r pdRouter) Route(ctx *types.Routing... | we need some discussion on this workflow. should we just consider prefill at this moment? there's no remote prefill feature enabled yet. | if err != nil {
klog.Error("fail to get cache store in prefix cache router")
return nil, err
}
return pdRouter{
cache: c,
tokenizer: tokenizerObj,
prefixCacheIndexer: prefixcacheindexer.NewPrefixHashTable(),
}, nil
}
func (r pdRouter) Route(ctx *types.RoutingContext, readyPodList t... | @@ -0,0 +1,212 @@
+/*
+Copyright 2024 The Aibrix Team.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or a... | pkg/plugins/gateway/algorithms/pd_disaggregation.go | 26 | Go | 0.429 | suggestion | 136 | 51 | 51 | false | [feat] Add prefill-decode disaggregation support in aibrix router | 1,309 | vllm-project/aibrix | 2,572 | Go | Jeffwan | varungup90 |
if err != nil {
klog.Error("fail to get cache store in prefix cache router")
return nil, err
}
return pdRouter{
cache: c,
tokenizer: tokenizerObj,
prefixCacheIndexer: prefixcacheindexer.NewPrefixHashTable(),
}, nil
}
func (r pdRouter) Route(ctx *types.RoutingContext, readyPodList t... | do we need some adapter for different engine, the vLLM and SGlang behavior is different.
- vLLM seems needs to wait until the request is done
- SGLang can send the request in parallel | klog.Error("fail to get cache store in prefix cache router")
return nil, err
}
return pdRouter{
cache: c,
tokenizer: tokenizerObj,
prefixCacheIndexer: prefixcacheindexer.NewPrefixHashTable(),
}, nil
}
func (r pdRouter) Route(ctx *types.RoutingContext, readyPodList types.PodList) (st... | @@ -0,0 +1,212 @@
+/*
+Copyright 2024 The Aibrix Team.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or a... | pkg/plugins/gateway/algorithms/pd_disaggregation.go | 26 | Go | 0.357 | suggestion | 186 | 51 | 51 | false | [feat] Add prefill-decode disaggregation support in aibrix router | 1,309 | vllm-project/aibrix | 2,572 | Go | Jeffwan | varungup90 |
}
readyPodsMap := map[string]struct{}{}
for _, pod := range decodePods {
readyPodsMap[pod.Name] = struct{}{}
}
matchedPods, prefixHashes := r.prefixCacheIndexer.MatchPrefix(tokens, ctx.Model, readyPodsMap)
return tokens, matchedPods, prefixHashes, nil
}
func (r *pdRouter) selectDecodePod(decodePods []*v1.Pod... | why not check prefix cache against prefill pods but using random here? | matchedPods, prefixHashes := r.prefixCacheIndexer.MatchPrefix(tokens, ctx.Model, readyPodsMap)
return matchedPods, prefixHashes, nil
}
func (r *pdRouter) selectDecodePod(decodePods []*v1.Pod) *v1.Pod {
decodePod, _ := utils.SelectRandomPod(decodePods, rand.Intn)
return decodePod
}
func (r *pdRouter) doPrefillReq... | @@ -0,0 +1,212 @@
+/*
+Copyright 2024 The Aibrix Team.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or a... | pkg/plugins/gateway/algorithms/pd_disaggregation.go | 26 | Go | 0.214 | performance | 70 | 51 | 51 | false | [feat] Add prefill-decode disaggregation support in aibrix router | 1,309 | vllm-project/aibrix | 2,572 | Go | Jeffwan | varungup90 |
expectedService := &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: service.Name,
Namespace: service.Namespace,
Labels: service.Labels,
},
Spec: corev1.ServiceSpec{
Type: corev1.ServiceTypeClusterIP,
ClusterIP: corev1.ClusterIPNone,
Selector: map[string]string{constants.Storm... | Can we use something like this? (This code seems more concise)
```go
if !isServiceEqual(headlessService, expectedService) {
headlessService.Spec = expectedService.Spec
if err := r.Client.Update(ctx, headlessService); err != nil {
return fmt.Errorf("failed to update headless service: %w", err)
}... | expectedService := &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: service.Name,
Namespace: service.Namespace,
Labels: service.Labels,
},
Spec: corev1.ServiceSpec{
Type: corev1.ServiceTypeClusterIP,
ClusterIP: corev1.ClusterIPNone,
Selector: map[string]string{constants.Storm... | @@ -84,15 +85,32 @@ func (r *StormServiceReconciler) syncHeadlessService(ctx context.Context, servic
}
headlessService := &corev1.Service{}
- if err := r.Client.Get(ctx, client.ObjectKey{Name: service.Name, Namespace: service.Namespace}, headlessService); client.IgnoreNotFound(err) != nil {
- return err
- } else... | pkg/controller/stormservice/sync.go | 26 | Go | 1 | bug | 812 | 51 | 51 | false | [Misc] enhance headless service sync with update logic | 1,311 | vllm-project/aibrix | 2,572 | Go | googs1025 | omerap12 |
from ...memory import MemoryRegion
from ...status import Status, StatusCodes
from ...transport import HAS_RDMA_TRANSPORT_SUPPORT
from . import Connector, ConnectorFeature
logger = getLogger(__name__)
class InfiniStoreConnector(Connector[bytes, torch.Tensor], AsyncBase):
"""InfiniStore connector."""
def __in... | tcp_conns will be always created? | from ...memory import MemoryRegion
from ...status import Status, StatusCodes
from ...transport import HAS_RDMA_TRANSPORT_SUPPORT
from . import Connector, ConnectorFeature
logger = getLogger(__name__)
class InfiniStoreConnector(Connector[bytes, torch.Tensor], AsyncBase):
"""InfiniStore connector."""
def __in... | @@ -44,7 +44,15 @@ def __init__(
super().__init__(executor)
self.config = config
self.key_suffix = key_suffix
- self.conn: infinistore.InfinityConnection | None = None
+
+ # rdma connection
+ self.rdma_conn: infinistore.InfinityConnection | None = None
+
+ # tcp co... | python/aibrix_kvcache/aibrix_kvcache/l2/connectors/infinistore.py | 26 | Python | 0.071 | question | 33 | 51 | 51 | false | [Fix] KVCache: InfiniStore connector w/ TCP | 1,312 | vllm-project/aibrix | 2,572 | Go | Jeffwan | DwyaneShi |
@contextmanager
def _tcp_conn(self):
assert self.config.connection_type == infinistore.TYPE_TCP
conn = None
try:
conn = self.tcp_conns.get()
yield conn
finally:
if conn is not None:
self.tcp_conns.put(conn)
@Status.capture... | seems the InfinityConnection abstraction is the connection so we have to manage the pool & connections outside? `self.tcp_conns.put(tcp_conn)` | assert self.config.connection_type == infinistore.TYPE_TCP
assert self.tcp_conns is not None
conn = None
try:
conn = self.tcp_conns.get()
yield conn
finally:
if conn is not None:
self.tcp_conns.put(conn)
@Status.capture_exc... | @@ -200,41 +208,82 @@ def __del__(self) -> None:
def _key(self, key: bytes) -> str:
return key.hex() + self.key_suffix
+ @contextmanager
+ def _tcp_conn(self):
+ assert self.config.connection_type == infinistore.TYPE_TCP
+ conn = None
+ try:
+ conn = self.tcp_conns.... | python/aibrix_kvcache/aibrix_kvcache/l2/connectors/infinistore.py | 26 | Python | 0.5 | refactor | 144 | 51 | 51 | false | [Fix] KVCache: InfiniStore connector w/ TCP | 1,312 | vllm-project/aibrix | 2,572 | Go | Jeffwan | DwyaneShi |
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
... | let's rename t to `model.aibrix.ai/metric-port`? comment could be a separate line | http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
... | @@ -28,7 +28,8 @@ import (
)
const (
- podPort = 8000
+ defaultMetricPort = 8000
+ MetricportLabel = "model.aibrix.ai/MetricPort" //When the engine's HTTP proxy is separated from the engine itself, the request port and metrics port may differ, so a d... | pkg/cache/cache_metrics.go | 26 | Go | 0.429 | suggestion | 81 | 51 | 51 | false | [feat] Support dynamic metrics port via model.aibrix.ai/metric-port label | 1,313 | vllm-project/aibrix | 2,572 | Go | Jeffwan | Yaegaki1Erika |
}
if expectedReplicas != roleStatus.UpdatedReadyReplicas {
updatedAndReady = false
break
}
}
return updatedAndReady
}
func filterRoleSetByRevision(roleSets []*orchestrationv1alpha1.RoleSet, revision string) (match, notMatch []*orchestrationv1alpha1.RoleSet) {
match = []*orchestrationv1alpha1.RoleSet{}
... | Do we have the same issue in `filterTerminatingRoleSets` ? | if roleSpec.Replicas != nil {
expectedReplicas = *roleSpec.Replicas
}
if expectedReplicas != roleStatus.UpdatedReadyReplicas {
updatedAndReady = false
break
}
}
return updatedAndReady
}
func filterRoleSetByRevision(roleSets []*orchestrationv1alpha1.RoleSet, revision string) (match, notMatch []*orche... | @@ -185,6 +187,8 @@ func filterRoleSetByRevision(roleSets []*orchestrationv1alpha1.RoleSet, revision
}
func filterReadyRoleSets(roleSets []*orchestrationv1alpha1.RoleSet) (ready []*orchestrationv1alpha1.RoleSet, notReady []*orchestrationv1alpha1.RoleSet) {
+ ready = []*orchestrationv1alpha1.RoleSet{} | pkg/controller/stormservice/utils.go | 26 | Go | 0.357 | question | 58 | 51 | 51 | false | Fix nil slice issue and add UT coverage for stormservice utils | 1,314 | vllm-project/aibrix | 2,572 | Go | googs1025 | Jeffwan |
routingCtx.ReqBody = body.RequestBody.GetBody()
// early reject the request if model doesn't exist.
if !s.cache.HasModel(model) {
klog.ErrorS(nil, "model doesn't exist in cache, probably wrong model name", "requestID", requestID, "model", model)
return generateErrorResponse(envoyTypePb.StatusCode_BadRequest,
... | can we return a json response? `{code: xx, message:xxx}` I forgot the openai convention. something like this like | routingCtx.Message = message
routingCtx.ReqBody = body.RequestBody.GetBody()
// early reject the request if model doesn't exist.
if !s.cache.HasModel(model) {
klog.ErrorS(nil, "model doesn't exist in cache, probably wrong model name", "requestID", requestID, "model", model)
return generateErrorResponse(envoyTy... | @@ -67,6 +67,9 @@ func (s *Server) HandleRequestBody(ctx context.Context, requestID string, req *e
headers := []*configPb.HeaderValueOption{}
if routingAlgorithm == routing.RouterNotSet {
+ if err := s.validateHTTPRouteStatus(ctx, model); err != nil {
+ return buildErrorResponse(envoyTypePb.StatusCode_ServiceU... | pkg/plugins/gateway/gateway_req_body.go | 26 | Go | 0.5 | question | 115 | 51 | 51 | false | Add check for missing httproute before request start | 1,344 | vllm-project/aibrix | 2,572 | Go | Jeffwan | varungup90 |
// Create HTTP request
apiURL := fmt.Sprintf("http://%s:%d%s", prefillPod.Status.PodIP, utils.GetModelPortForPod(routingCtx.RequestID, prefillPod), routingCtx.ReqPath)
req, err := http.NewRequest("POST", apiURL, bytes.NewBuffer(payloadBytes))
if err != nil {
return fmt.Errorf("failed to create prefill request: %... | could you double check sglang router logics? I remember this is used to identify the kv on prefill server. | if err := r.executeHTTPRequest(apiURL, routingCtx, payload); err != nil {
klog.ErrorS(err, "prefill request for sglang failed", "request_id", routingCtx.RequestID)
}
klog.InfoS("prefill_request_complete", "request_id", routingCtx.RequestID)
}()
} else {
if err := r.executeHTTPRequest(apiURL, routingCt... | @@ -93,109 +96,151 @@ func (r pdRouter) Route(ctx *types.RoutingContext, readyPodList types.PodList) (
func (r *pdRouter) filterPrefillDecodePods(readyPods []*v1.Pod) ([]*v1.Pod, []*v1.Pod, error) {
prefillPods, decodePods := []*v1.Pod{}, []*v1.Pod{}
- var rolename string
- var ok bool
for _, pod := range readyP... | pkg/plugins/gateway/algorithms/pd_disaggregation.go | 26 | Go | 0.429 | question | 107 | 46 | 51 | false | Bug fixes for PD disaggregation routing | 1,354 | vllm-project/aibrix | 2,572 | Go | Jeffwan | varungup90 |
type RollingManagerSequential struct {
cli client.Client
}
func (m *RollingManagerSequential) Next(ctx context.Context, roleSet *orchestrationv1alpha1.RoleSet) (err error) {
// 1. ensure pod replica meet expectations
var scaling bool
for _, role := range roleSet.Spec.Roles {
klog.Infof("[RollingManagerSequential... | Not sure about those logs.. we can remove them / having them in higher verbose level. open to suggestions | }
type RollingManagerSequential struct {
cli client.Client
}
func (m *RollingManagerSequential) Next(ctx context.Context, roleSet *orchestrationv1alpha1.RoleSet) (err error) {
// 1. ensure pod replica meet expectations
var scaling bool
for _, role := range roleSet.Spec.Roles {
klog.Infof("[RollingManagerSequent... | @@ -50,9 +50,17 @@ func (m *RollingManagerSequential) Next(ctx context.Context, roleSet *orchestrat
klog.Infof("[RollingManagerSequential.Next] waiting for roleset %s/%s to be scaled", roleSet.Namespace, roleSet.Name)
return nil
}
- // 2. do the rollout process for each role
- // TODO: in future, consider the r... | pkg/controller/roleset/rolling.go | 26 | Go | 0.429 | suggestion | 105 | 51 | 51 | false | Feat: Support role upgrade sequences in stormservice | 1,432 | vllm-project/aibrix | 2,572 | Go | omerap12 | omerap12 |
for _, role := range roleSet.Spec.Roles {
klog.Infof("[RollingManagerSequential.Next] start to scale roleset %s/%s role %s", roleSet.Namespace, roleSet.Name, role.Name)
s, err := GetRoleSyncer(m.cli, &role).Scale(ctx, roleSet, &role)
if err != nil {
return err
}
scaling = scaling || s
}
if scaling {
k... | Not sure about those logs.. we can remove them / having them in higher verbose level. open to suggestions | // 1. ensure pod replica meet expectations
var scaling bool
for _, role := range roleSet.Spec.Roles {
klog.Infof("[RollingManagerSequential.Next] start to scale roleset %s/%s role %s", roleSet.Namespace, roleSet.Name, role.Name)
s, err := GetRoleSyncer(m.cli, &role).Scale(ctx, roleSet, &role)
if err != nil {
... | @@ -50,9 +50,21 @@ func (m *RollingManagerSequential) Next(ctx context.Context, roleSet *orchestrat
klog.Infof("[RollingManagerSequential.Next] waiting for roleset %s/%s to be scaled", roleSet.Namespace, roleSet.Name)
return nil
}
- // 2. do the rollout process for each role
- // TODO: in future, consider the r... | pkg/controller/roleset/rolling.go | 26 | Go | 0.429 | suggestion | 105 | 51 | 51 | false | Feat: Support role upgrade sequences in stormservice | 1,432 | vllm-project/aibrix | 2,572 | Go | omerap12 | omerap12 |
type RoleSetUpdateStrategyType string
const (
// ParallelRoleSetUpdateStrategyType update all roles in parallel
ParallelRoleSetUpdateStrategyType RoleSetUpdateStrategyType = "Parallel"
// SequentialRoleSetStrategyType update all roles in sequential
SequentialRoleSetStrategyType RoleSetUpdateStrategyType = "Sequent... | Can we use this so that we can remove a lot of `== nil` judgments? 🤔
`// +kubebuilder:default:=0`
Because the comment says default is 0
| type RoleSetUpdateStrategyType string
const (
// ParallelRoleSetUpdateStrategyType update all roles in parallel
ParallelRoleSetUpdateStrategyType RoleSetUpdateStrategyType = "Parallel"
// SequentialRoleSetStrategyType update all roles in sequential
SequentialRoleSetStrategyType RoleSetUpdateStrategyType = "Sequent... | @@ -64,6 +64,13 @@ type RoleSpec struct {
// +optional
Replicas *int32 `json:"replicas,omitempty"`
+ // UpgradeOrder specifies the order in which this role should be upgraded.
+ // Lower values are upgraded first. If not specified, defaults to 0.
+ // +optional
+ // +kubebuilder:validation:Minimum=0 | api/orchestration/v1alpha1/roleset_types.go | 26 | Go | 0.571 | question | 147 | 51 | 51 | false | Feat: Support role upgrade sequences in stormservice | 1,432 | vllm-project/aibrix | 2,572 | Go | googs1025 | omerap12 |
RuntimeConfig: runtimeConfig,
}
_, err = deploymentInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{
AddFunc: modelRouter.addRouteFromDeployment,
DeleteFunc: modelRouter.deleteRouteFromDeployment,
})
if err != nil {
return err
}
_, err = modelInformer.AddEventHandler(cache.ResourceEventHandle... | what's the purpose of this change? | Client: mgr.GetClient(),
RuntimeConfig: runtimeConfig,
}
_, err = deploymentInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{
AddFunc: modelRouter.addRouteFromDeployment,
DeleteFunc: modelRouter.deleteRouteFromDeployment,
})
if err != nil {
return err
}
_, err = modelInformer.AddEven... | @@ -107,12 +106,6 @@ func Add(mgr manager.Manager, runtimeConfig config.RuntimeConfig) error {
DeleteFunc: modelRouter.deleteRouteFromRayClusterFleet,
})
- klog.Info("Waiting for caches to sync") | pkg/controller/modelrouter/modelrouter_controller.go | 26 | Go | 0.143 | question | 34 | 51 | 51 | false | [Test]: add controller integration test framework | 1,448 | vllm-project/aibrix | 2,572 | Go | Jeffwan | googs1025 |
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
scheme.AddUnversionedTypes(metav1.SchemeGroupVersion, &metav1.UpdateOptions{}, &metav1.DeleteOptions{}, &metav1.CreateOptions{})
//+kubebuilder:scaffold:scheme
}
func RegisterSchemas(scheme *runtime.Scheme) error {
podAutoscalerEnabled := features.IsControllerE... | do you know whether there's a way fine grain control the scheme. Currently, we have to register the group level. | utilruntime.Must(clientgoscheme.AddToScheme(scheme))
scheme.AddUnversionedTypes(metav1.SchemeGroupVersion, &metav1.UpdateOptions{}, &metav1.DeleteOptions{}, &metav1.CreateOptions{})
//+kubebuilder:scaffold:scheme
}
func RegisterSchemas(scheme *runtime.Scheme) error {
podAutoscalerEnabled := features.IsControllerE... | @@ -79,31 +79,27 @@ func init() {
}
func RegisterSchemas(scheme *runtime.Scheme) error {
+ podAutoscalerEnabled := features.IsControllerEnabled(features.PodAutoscalerController)
+ modelAdapterEnabled := features.IsControllerEnabled(features.ModelAdapterController)
+ distributedInferenceEnabled := features.IsControl... | cmd/controllers/main.go | 26 | Go | 0.357 | suggestion | 113 | 51 | 51 | false | refactor(scheme): prevent duplicate registration in RegisterSchemas | 1,464 | vllm-project/aibrix | 2,572 | Go | Jeffwan | googs1025 |
}
func RegisterSchemas(scheme *runtime.Scheme) error {
podAutoscalerEnabled := features.IsControllerEnabled(features.PodAutoscalerController)
modelAdapterEnabled := features.IsControllerEnabled(features.ModelAdapterController)
distributedInferenceEnabled := features.IsControllerEnabled(features.DistributedInference... | Seems this should be kept? If we use any Options in the client, with above code, it can find the right type? | }
func RegisterSchemas(scheme *runtime.Scheme) error {
podAutoscalerEnabled := features.IsControllerEnabled(features.PodAutoscalerController)
modelAdapterEnabled := features.IsControllerEnabled(features.ModelAdapterController)
distributedInferenceEnabled := features.IsControllerEnabled(features.DistributedInference... | @@ -79,31 +79,27 @@ func init() {
}
func RegisterSchemas(scheme *runtime.Scheme) error {
+ podAutoscalerEnabled := features.IsControllerEnabled(features.PodAutoscalerController)
+ modelAdapterEnabled := features.IsControllerEnabled(features.ModelAdapterController)
+ distributedInferenceEnabled := features.IsControl... | cmd/controllers/main.go | 26 | Go | 0.571 | question | 108 | 51 | 51 | false | refactor(scheme): prevent duplicate registration in RegisterSchemas | 1,464 | vllm-project/aibrix | 2,572 | Go | Jeffwan | googs1025 |
err := r.syncHeadlessService(context.TODO(), tt.stormService)
if (err != nil) != tt.wantError {
t.Errorf("syncHeadlessService() error = %v, wantError %v", err, tt.wantError)
return
}
// Check if service was created/updated
service := &corev1.Service{}
err = fakeClient.Get(context.TODO(), cl... | This is a review error... It seems that `if tt.existingService != nil {` should be correct here...
😅 |
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
var objs []client.Object
if tt.existingService != nil {
objs = append(objs, tt.existingService)
}
fakeClient := fake.NewClientBuilder().
WithScheme(scheme).
WithObjects(objs...).
Build()
r := &StormServiceReconciler{
... | @@ -238,14 +255,12 @@ func TestSyncHeadlessService(t *testing.T) {
t.Errorf("Expected ClusterIP to be None, got %s", service.Spec.ClusterIP)
}
- if tt.existingService == nil { | pkg/controller/stormservice/sync_test.go | 26 | Go | 0.714 | suggestion | 105 | 51 | 51 | false | [fix] Correct the headless service ownerReference UID in tests | 1,469 | vllm-project/aibrix | 2,572 | Go | googs1025 | Jeffwan |
sumOfSquares := 0.0
for _, number := range numbers {
sumOfSquares += math.Pow(number-avg, 2)
}
variance := sumOfSquares / float64(len(numbers)-1)
return math.Sqrt(variance)
}
// SelectRandomPodAsFallback selects a pod randomly as a fallback.
// This method should only be used when all other selection mechanisms... | could you move this method to test file since it's test specific? | /*
Copyright 2024 The Aibrix Team.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softwar... | @@ -60,3 +61,29 @@ func SelectRandomPodAsFallback(ctx *types.RoutingContext, pods []*v1.Pod, random
}
return targetPod, nil
}
+
+// newPod creates a new Pod object for testing purposes.
+// It constructs a Pod with basic configuration including name, IP address, ready status, and labels.
+// returns a pointer to t... | pkg/plugins/gateway/algorithms/util.go | 26 | Go | 0.286 | refactor | 65 | 48 | 63 | false | [Misc] Add unit tests for least_busy_time | 1,495 | vllm-project/aibrix | 2,572 | Go | Jeffwan | omerap12 |
"github.com/vllm-project/aibrix/pkg/cache"
"github.com/vllm-project/aibrix/pkg/metrics"
"github.com/vllm-project/aibrix/pkg/types"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func TestLeastGpuCache(t *testing.T) {
tests := []struct {
name string
readyPods []*v1.Po... | This code repeats. Why not use this function instead: [https://github.com/vllm-project/aibrix/blob/main/pkg/plugins/gateway/algorithms/least_busy_time_test.go#L220](https://github.com/vllm-project/aibrix/blob/main/pkg/plugins/gateway/algorithms/least_busy_time_test.go?utm_source=chatgpt.com#L220)
less copy-paste. | "github.com/vllm-project/aibrix/pkg/cache"
"github.com/vllm-project/aibrix/pkg/metrics"
"github.com/vllm-project/aibrix/pkg/types"
v1 "k8s.io/api/core/v1"
)
func TestLeastGpuCache(t *testing.T) {
tests := []struct {
name string
readyPods []*v1.Pod
podModelMetrics map[string]map[string]metri... | @@ -0,0 +1,135 @@
+/*
+Copyright 2025 The Aibrix Team.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or a... | pkg/plugins/gateway/algorithms/least_gpu_cache_test.go | 26 | Go | 0.5 | suggestion | 315 | 51 | 51 | false | [Misc] test: add unit test for leastGpuCacheRouter | 1,505 | vllm-project/aibrix | 2,572 | Go | omerap12 | zyfy29 |
activePods := filterActivePods(podList.Items)
currentPodCount := len(activePods)
desiredPodCount := int(podSet.Spec.PodGroupSize)
// The current logic for creating missing pods assumes that existing pods have contiguous indices starting from
// 0 (i.e., 0, 1, ..., currentPodCount-1). If a pod with a lower index i... | Shouldn't we add unit test for this behavior? | activePods := filterActivePods(podList.Items)
currentPodCount := len(activePods)
desiredPodCount := int(podSet.Spec.PodGroupSize)
// The current logic for creating missing pods assumes that existing pods have contiguous indices starting from
// 0 (i.e., 0, 1, ..., currentPodCount-1). If a pod with a lower index i... | @@ -164,6 +164,10 @@ func (r *PodSetReconciler) reconcilePods(ctx context.Context, podSet *orchestrat
}
if err := r.Create(ctx, pod); err != nil {
+ if apierrors.IsAlreadyExists(err) {
+ klog.InfoS("Pod already exists, skipping", "pod", pod.Name, "podset", podSet.Name)
+ continue
+ } | pkg/controller/podset/podset_controller.go | 26 | Go | 0.143 | question | 46 | 51 | 51 | false | [Misc]: ignore AlreadyExists and NotFound in controller operations | 1,507 | vllm-project/aibrix | 2,572 | Go | omerap12 | googs1025 |
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// PodSetSpec defines the desired state of a PodSet
// PodSet represents one atomic group of pods that work togethe... | We have added fields and need to add them in crd yaml. Please use `make manifest` | See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// PodSetSpec defines the desired state of a PodSet
// PodSet represents one atomic group of pods that work togethe... | @@ -35,6 +35,12 @@ type PodSetSpec struct {
// Stateful indicates whether pods should have stable network identities
// +optional
Stateful bool `json:"stateful,omitempty"`
+ | api/orchestration/v1alpha1/podset_types.go | 26 | Go | 0.429 | suggestion | 81 | 51 | 51 | false | [API] Add "FullRecreate" strategy for atomic PodSet recovery | 1,511 | vllm-project/aibrix | 2,572 | Go | googs1025 | mayooot |
}
}
// fill the gaps
for i := 0; i < desiredPodCount; i++ {
if _, exists := existingIndices[i]; !exists {
pod, err := r.createPodFromTemplate(podSet, i)
if err != nil {
return fmt.Errorf("failed to create pod template: %w", err)
}
if err := r.Create(ctx, pod); err != nil {
... | In order to avoid unnecessary errors, do errors such as `apierrors.IsAlreadyExists(err)` and `apierrors.IsNotFound(err)` need to be retained? |
func (r *PodSetReconciler) handleReplaceUnhealthy(ctx context.Context, podSet *orchestrationv1alpha1.PodSet,
activePods []corev1.Pod, currentPodCount, desiredPodCount int) error {
// Proactively find and delete unhealthy pods
var podsToDelete []*corev1.Pod
for i := range activePods {
pod := activePods[i]
for ... | @@ -146,49 +146,75 @@ func (r *PodSetReconciler) reconcilePods(ctx context.Context, podSet *orchestrat
currentPodCount := len(activePods)
desiredPodCount := int(podSet.Spec.PodGroupSize)
- // The current logic for creating missing pods assumes that existing pods have contiguous indices starting from
- // 0 (i.e.,... | pkg/controller/podset/podset_controller.go | 26 | Go | 0.714 | question | 141 | 51 | 51 | false | [API] Add "FullRecreate" strategy for atomic PodSet recovery | 1,511 | vllm-project/aibrix | 2,572 | Go | googs1025 | mayooot |
type PodSetPhase string
const (
// PodSetPhasePending indicates the PodSet is being created
PodSetPhasePending PodSetPhase = "Pending"
// PodSetPhaseRunning indicates at least one pod is running
PodSetPhaseRunning PodSetPhase = "Running"
// PodSetPhaseReady indicates all pods in the set are ready
PodSetPhaseRe... | Since we define at podset level, I think `Recreate` is enough, it represents `Recreate` the podset object. No need to append `Full` as suffix.
| type PodSetPhase string
const (
// PodSetPhasePending indicates the PodSet is being created
PodSetPhasePending PodSetPhase = "Pending"
// PodSetPhaseRunning indicates at least one pod is running
PodSetPhaseRunning PodSetPhase = "Running"
// PodSetPhaseReady indicates all pods in the set are ready
PodSetPhaseRe... | @@ -73,6 +79,18 @@ const (
PodSetPhaseFailed PodSetPhase = "Failed"
)
+// PodRecreateStrategy defines how a PodSet handles pod recreation when pods are lost or fail.
+// +enum
+type PodRecreateStrategy string
+
+const (
+ // MissingOnlyPodRecreateStrategy means only missing pods (by index) will be recreated.
+ Mis... | api/orchestration/v1alpha1/podset_types.go | 26 | Go | 0.5 | suggestion | 151 | 51 | 51 | false | [API] Add "FullRecreate" strategy for atomic PodSet recovery | 1,511 | vllm-project/aibrix | 2,572 | Go | Jeffwan | mayooot |
// PodSetPhase represents the current lifecycle phase of a PodSet
// +enum
type PodSetPhase string
const (
// PodSetPhasePending indicates the PodSet is being created
PodSetPhasePending PodSetPhase = "Pending"
// PodSetPhaseRunning indicates at least one pod is running
PodSetPhaseRunning PodSetPhase = "Running"
... | our original case is carelessly delete pod. However, we have other failure cases like Failed、Evicted、NodeLost、CrashLoop etc.
I personally feel missing only is too restricted, could you use something like `Repair` or `ReplaceUnhealthy` instead? |
// PodSetPhase represents the current lifecycle phase of a PodSet
// +enum
type PodSetPhase string
const (
// PodSetPhasePending indicates the PodSet is being created
PodSetPhasePending PodSetPhase = "Pending"
// PodSetPhaseRunning indicates at least one pod is running
PodSetPhaseRunning PodSetPhase = "Running"
... | @@ -73,6 +79,18 @@ const (
PodSetPhaseFailed PodSetPhase = "Failed"
)
+// PodRecreateStrategy defines how a PodSet handles pod recreation when pods are lost or fail.
+// +enum
+type PodRecreateStrategy string
+
+const (
+ // MissingOnlyPodRecreateStrategy means only missing pods (by index) will be recreated.
+ Mis... | api/orchestration/v1alpha1/podset_types.go | 26 | Go | 0.643 | bug | 247 | 51 | 51 | false | [API] Add "FullRecreate" strategy for atomic PodSet recovery | 1,511 | vllm-project/aibrix | 2,572 | Go | Jeffwan | mayooot |
import (
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// PodSetSpec defines the desired state of a PodSet
// PodSet represents one atomic group of pods that work together
type PodSetSpec struct {
// PodGroupSize is the number of pods in this set
// +kubebuilder:validation:Minimum=2
// ... | See below discussion, consider all rest cases, `RecoveryPolicy` is more proper name |
import (
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// PodSetSpec defines the desired state of a PodSet
// PodSet represents one atomic group of pods that work together
type PodSetSpec struct {
// PodGroupSize is the number of pods in this set
// +kubebuilder:validation:Minimum=2
// ... | @@ -35,6 +35,12 @@ type PodSetSpec struct {
// Stateful indicates whether pods should have stable network identities
// +optional
Stateful bool `json:"stateful,omitempty"`
+
+ // RecreateStrategy defines how pods in the set are recreated when failures happen
+ // +kubebuilder:default=MissingOnly
+ // +kubebuilder... | api/orchestration/v1alpha1/podset_types.go | 26 | Go | 0.429 | suggestion | 83 | 51 | 51 | false | [API] Add "FullRecreate" strategy for atomic PodSet recovery | 1,511 | vllm-project/aibrix | 2,572 | Go | Jeffwan | mayooot |
if err := r.reconcilePods(ctx, podSet); err != nil {
r.EventRecorder.Eventf(podSet, v1.EventTypeWarning, "ReconcileError", "Failed to reconcile pods: %v", err)
return ctrl.Result{}, err
}
// Update status
if err := r.updateStatus(ctx, podSet); err != nil {
return ctrl.Result{}, err
}
return ctrl.Result{},... | also cover pod with container restart count >= 1 ? WRT api comments | // Reconcile pods
if err := r.reconcilePods(ctx, podSet); err != nil {
r.EventRecorder.Eventf(podSet, v1.EventTypeWarning, "ReconcileError", "Failed to reconcile pods: %v", err)
return ctrl.Result{}, err
}
// Update status
if err := r.updateStatus(ctx, podSet); err != nil {
return ctrl.Result{}, err
}
re... | @@ -146,49 +146,75 @@ func (r *PodSetReconciler) reconcilePods(ctx context.Context, podSet *orchestrat
currentPodCount := len(activePods)
desiredPodCount := int(podSet.Spec.PodGroupSize)
- // The current logic for creating missing pods assumes that existing pods have contiguous indices starting from
- // 0 (i.e.,... | pkg/controller/podset/podset_controller.go | 26 | Go | 0.214 | suggestion | 67 | 51 | 51 | false | [API] Add "FullRecreate" strategy for atomic PodSet recovery | 1,511 | vllm-project/aibrix | 2,572 | Go | Epsilon314 | mayooot |
if idxStr, ok := pod.Labels[constants.PodGroupIndexLabelKey]; ok {
if idx, err := strconv.Atoi(idxStr); err == nil {
existingIndices[idx] = struct{}{}
}
}
}
// fill the gaps
for i := 0; i < desiredPodCount; i++ {
if _, exists := existingIndices[i]; !exists {
pod, err := r.crea... | shall we record a eventto explain the podset deletion, since users may wonder why their pod got deleted by controller | }
return nil
}
func (r *PodSetReconciler) handleReplaceUnhealthy(ctx context.Context, podSet *orchestrationv1alpha1.PodSet,
activePods []corev1.Pod, currentPodCount, desiredPodCount int) error {
// Proactively find and delete unhealthy pods
var podsToDelete []*corev1.Pod
for i := range activePods {
pod := ac... | @@ -146,49 +146,75 @@ func (r *PodSetReconciler) reconcilePods(ctx context.Context, podSet *orchestrat
currentPodCount := len(activePods)
desiredPodCount := int(podSet.Spec.PodGroupSize)
- // The current logic for creating missing pods assumes that existing pods have contiguous indices starting from
- // 0 (i.e.,... | pkg/controller/podset/podset_controller.go | 26 | Go | 0.429 | suggestion | 117 | 51 | 51 | false | [API] Add "FullRecreate" strategy for atomic PodSet recovery | 1,511 | vllm-project/aibrix | 2,572 | Go | Epsilon314 | mayooot |
}
func (r *PodSetReconciler) reconcilePods(ctx context.Context, podSet *orchestrationv1alpha1.PodSet) error {
// Get existing pods
podList, err := r.getPodsForPodSet(ctx, podSet)
if err != nil {
return fmt.Errorf("failed to get pods for PodSet: %w", err)
}
activePods := filterActivePods(podList.Items)
current... | I'm curious about the logic `containerStatus.RestartCount > 0`.
The activePods are already in a Ready status, meaning they are running and can serve.
beside, restart count could result from:
- Temporary env issues (e.g., network,)
- Sidecar containers restarting
- Past crashes that have already been recovered... | }
func (r *PodSetReconciler) reconcilePods(ctx context.Context, podSet *orchestrationv1alpha1.PodSet) error {
// Get existing pods
podList, err := r.getPodsForPodSet(ctx, podSet)
if err != nil {
return fmt.Errorf("failed to get pods for PodSet: %w", err)
}
activePods := filterActivePods(podList.Items)
current... | @@ -146,49 +147,120 @@ func (r *PodSetReconciler) reconcilePods(ctx context.Context, podSet *orchestrat
currentPodCount := len(activePods)
desiredPodCount := int(podSet.Spec.PodGroupSize)
- // The current logic for creating missing pods assumes that existing pods have contiguous indices starting from
- // 0 (i.e.... | pkg/controller/podset/podset_controller.go | 26 | Go | 0.643 | bug | 389 | 51 | 51 | false | [API] Add "FullRecreate" strategy for atomic PodSet recovery | 1,511 | vllm-project/aibrix | 2,572 | Go | googs1025 | mayooot |
// Check for container restarts.
for _, containerStatus := range pod.Status.ContainerStatuses {
if containerStatus.RestartCount > 0 {
isUnhealthy = true
klog.InfoS("Marking pod as unhealthy due to container restarts", "pod", pod.Name, "restarts", containerStatus.RestartCount)
break // On... | Do we want to send an event every time a pod is deleted? | }
return nil
}
func (r *PodSetReconciler) handleReplaceUnhealthy(ctx context.Context, podSet *orchestrationv1alpha1.PodSet,
activePods []corev1.Pod, currentPodCount, desiredPodCount int) error {
// Proactively find and delete unhealthy pods
var podsToDelete []*corev1.Pod
for i := range activePods {
pod := ac... | @@ -146,49 +147,120 @@ func (r *PodSetReconciler) reconcilePods(ctx context.Context, podSet *orchestrat
currentPodCount := len(activePods)
desiredPodCount := int(podSet.Spec.PodGroupSize)
- // The current logic for creating missing pods assumes that existing pods have contiguous indices starting from
- // 0 (i.e.... | pkg/controller/podset/podset_controller.go | 26 | Go | 0.214 | question | 56 | 51 | 51 | false | [API] Add "FullRecreate" strategy for atomic PodSet recovery | 1,511 | vllm-project/aibrix | 2,572 | Go | googs1025 | mayooot |
}
// If no pods were deleted for being unhealthy, proceed with filling missing slots.
if desiredPodCount-currentPodCount > 0 {
r.EventRecorder.Eventf(podSet, corev1.EventTypeNormal, "ReplacingUnhealthy", "ReplaceUnhealthy policy: creating %d pod(s) to replace missing ones, aiming for %d total.", desiredPo... | `if apierrors.IsAlreadyExists(err) {` is missed | return nil
}
// If no unhealthy pods deleted, fill missing slots
if desiredPodCount-currentPodCount > 0 {
r.EventRecorder.Eventf(podSet, corev1.EventTypeNormal, "ReplacingUnhealthy",
"ReplaceUnhealthy policy: creating %d pod(s) to replace missing ones, aiming for %d total.",
desiredPodCount-currentPodCoun... | @@ -146,49 +147,120 @@ func (r *PodSetReconciler) reconcilePods(ctx context.Context, podSet *orchestrat
currentPodCount := len(activePods)
desiredPodCount := int(podSet.Spec.PodGroupSize)
- // The current logic for creating missing pods assumes that existing pods have contiguous indices starting from
- // 0 (i.e.... | pkg/controller/podset/podset_controller.go | 26 | Go | 0.357 | suggestion | 47 | 51 | 51 | false | [API] Add "FullRecreate" strategy for atomic PodSet recovery | 1,511 | vllm-project/aibrix | 2,572 | Go | googs1025 | mayooot |
return nil
}
func (r *PodSetReconciler) handleReplaceUnhealthy(ctx context.Context, podSet *orchestrationv1alpha1.PodSet,
activePods []corev1.Pod, currentPodCount, desiredPodCount int) error {
// Proactively find and delete unhealthy pods
var podsToDelete []*corev1.Pod
for i := range activePods {
pod := active... | https://github.com/vllm-project/aibrix/pull/1511?notification_referrer_id=NT_kwDOBSY69LQxODQ5OTUyMjc4Mzo4NjM5MTU0MA¬ifications_query=reason%3Aparticipating#discussion_r2329942074 | return nil
}
func (r *PodSetReconciler) handleReplaceUnhealthy(ctx context.Context, podSet *orchestrationv1alpha1.PodSet,
activePods []corev1.Pod, currentPodCount, desiredPodCount int) error {
// Proactively find and delete unhealthy pods
var podsToDelete []*corev1.Pod
for i := range activePods {
pod := active... | @@ -146,55 +147,129 @@ func (r *PodSetReconciler) reconcilePods(ctx context.Context, podSet *orchestrat
currentPodCount := len(activePods)
desiredPodCount := int(podSet.Spec.PodGroupSize)
- // The current logic for creating missing pods assumes that existing pods have contiguous indices starting from
- // 0 (i.e.... | pkg/controller/podset/podset_controller.go | 26 | Go | 0.357 | suggestion | 181 | 51 | 51 | false | [API] Add "FullRecreate" strategy for atomic PodSet recovery | 1,511 | vllm-project/aibrix | 2,572 | Go | googs1025 | mayooot |
UpdatedReplicas: int32(updatedReplicas),
UpdatedReadyReplicas: updatedReadyReplicas,
}, nil
}
func (r *RoleSetReconciler) calculateStatusFromPodSets(ctx context.Context, rs *orchestrationv1alpha1.RoleSet, role *orchestrationv1alpha1.RoleSpec) (*orchestrationv1alpha1.RoleStatus, error) {
// Get PodSets for t... | Can you check if there are similar in podset elsewhere? 🤔 | UpdatedReplicas: int32(updatedReplicas),
UpdatedReadyReplicas: updatedReadyReplicas,
}, nil
}
func (r *RoleSetReconciler) calculateStatusFromPodSets(ctx context.Context, rs *orchestrationv1alpha1.RoleSet, role *orchestrationv1alpha1.RoleSpec) (*orchestrationv1alpha1.RoleStatus, error) {
// Get PodSets for t... | @@ -192,7 +192,7 @@ func (r *RoleSetReconciler) calculateStatusFromPodSets(ctx context.Context, rs *
for _, podSet := range podSetList.Items {
totalReplicas++
- if podSet.DeletionTimestamp == nil && podSet.Status.Phase != orchestrationv1alpha1.PodSetPhaseFailed {
+ if podSet.DeletionTimestamp == nil && isPodSe... | pkg/controller/roleset/sync.go | 26 | Go | 0.214 | suggestion | 58 | 51 | 51 | false | [Bug] fix count ready podset condition | 1,518 | vllm-project/aibrix | 2,572 | Go | googs1025 | Epsilon314 |
func (m *MockPodList) Indexes() []string {
return []string{"default"}
}
func (m *MockPodList) ListByIndex(index string) []*v1.Pod {
return m.pods
}
func createTestPodForRoute(name, ip string) *v1.Pod {
return &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: "test-namespace",
},
Statu... | This is already defined here: https://github.com/vllm-project/aibrix/blob/f8640606d9f63abe3faf292d6541a24d14c5f311/pkg/plugins/gateway/algorithms/least_busy_time_test.go#L220-L241 |
func (m *MockPodList) Indexes() []string {
return []string{}
}
func (m *MockPodList) ListByIndex(index string) []*v1.Pod {
return m.pods
}
func createTestRoutingContext(model, message, requestID string) *types.RoutingContext {
ctx := context.Background()
return types.NewRoutingContext(ctx, RouterPrefixCachePrebl... | @@ -0,0 +1,250 @@
+/*
+Copyright 2024 The Aibrix Team.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or a... | pkg/plugins/gateway/algorithms/prefix_cache_preble_test.go | 26 | Go | 0.357 | suggestion | 179 | 51 | 51 | false | [Misc] (test): add unit test for prefix_cache_preble | 1,519 | vllm-project/aibrix | 2,572 | Go | omerap12 | zhengkezhou1 |
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package scaler
import (
"fmt"
"testing"
"time"
"github.com/vllm-project/... | we should remove instead of turning it into comment. | distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package scaler
import (
"fmt"
"testing"
"time"
"github.com/vllm-project/... | @@ -33,7 +33,7 @@ import (
// TestHcpaScale tests the APA behavior. For now, APA implements HCPA algorithm.
func TestAPAScale(t *testing.T) {
// TODO (jiaxin.shan): make the logics to enable the test later.
- t.Skip("Skipping this test")
+ // t.Skip("Skipping this test") | pkg/controller/podautoscaler/scaler/apa_test.go | 26 | Go | 0.286 | suggestion | 53 | 51 | 51 | false | [Misc] test: modify apa scale test | 1,523 | vllm-project/aibrix | 2,572 | Go | googs1025 | jiangxiaobin96 |
},
expectAddr: "2.2.2.2:8000",
expectErr: false,
},
{
name: "utilization error",
pods: []*v1.Pod{
newPod("pod1", "1.1.1.1", true, map[string]string{"model.aibrix.ai/port": "8000"}),
},
utilErr: cache.ErrorLoadCapacityReached,
expectErr: true,
},
{
name: "some pods with utilizat... | The "some pods with utilization error" case seems a bit strange. Why is there no metric for p1 but expectErr is nil and the expected pod is p1? 🤔 | name: "no pods available",
pods: []*v1.Pod{},
expectErr: true,
},
{
name: "pod without IP",
pods: []*v1.Pod{
newPod("pod1", "", true, map[string]string{"model.aibrix.ai/port": "8000"}),
newPod("pod2", "2.2.2.2", true, map[string]string{"model.aibrix.ai/port": "8000"}),
},
util... | @@ -0,0 +1,345 @@
+/*
+Copyright 2025 The Aibrix Team.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or a... | pkg/plugins/gateway/algorithms/least_load_test.go | 26 | Go | 0.5 | suggestion | 146 | 51 | 51 | false | [MISC]: add test for least_load | 1,524 | vllm-project/aibrix | 2,572 | Go | googs1025 | omerap12 |
consumptionErr: cache.ErrorSLOFailureRequest,
cap: 1.0,
expectErr: true,
},
{
name: "equal load with different consumptions",
pods: []*v1.Pod{
newPod("pod1", "1.1.1.1", true, nil),
newPod("pod2", "2.2.2.2", true, nil),
},
utilizations: map[string]float64{
"pod1": 0.3... | Can there be multiple pods in this case? | },
consumptions: map[string]float64{
"pod1": 0.3,
"pod2": 0.1,
"pod3": 0.2,
},
cap: 1.0,
expectAddr: "2.2.2.2",
expectErr: false,
},
{
name: "consumption error",
pods: []*v1.Pod{
newPod("pod1", "1.1.1.1", true, map[string]string{"model.aibrix.ai/port": "8000"}),
},... | @@ -0,0 +1,345 @@
+/*
+Copyright 2025 The Aibrix Team.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or a... | pkg/plugins/gateway/algorithms/least_load_test.go | 26 | Go | 0.071 | question | 40 | 51 | 51 | false | [MISC]: add test for least_load | 1,524 | vllm-project/aibrix | 2,572 | Go | googs1025 | omerap12 |
if num > 0 and reason not in ["out_of_memory", "denied", "not_found"]:
raise AssertionError(f"GET {reason}: {num}")
def test_ext_handle_put_and_get_with_prefix(cache_mgr_fixture):
shape, spec, cache_mgr, param = cache_mgr_fixture
if (
spec.block_layout == KVCacheBlockLayout.LCND
... | Will idx be greater than the number of blocks? | if num > 0 and reason not in ["out_of_memory", "denied", "not_found"]:
raise AssertionError(f"GET {reason}: {num}")
def test_ext_handle_put_and_get_with_prefix(cache_mgr_fixture):
shape, spec, cache_mgr, param = cache_mgr_fixture
if (
spec.block_layout == KVCacheBlockLayout.LCND
... | @@ -418,16 +418,8 @@ def test_ext_handle_put_and_get_with_prefix(cache_mgr_fixture):
tokens0 = all_tokens[:32]
tokens1 = all_tokens[32:]
- token_idx_to_slot = (
- lambda idx: idx // block_ntokens * block_ntokens + idx % block_ntokens
- )
-
- slot_mapping = []
- for idx in range(len(tokens... | python/aibrix_kvcache/tests/test_cache_manager.py | 26 | Python | 0.071 | question | 46 | 51 | 51 | false | [Refactor] KVCache: simplify external cache handle create API | 1,542 | vllm-project/aibrix | 2,572 | Go | yapple | DwyaneShi |
CurrentRevision string `json:"currentRevision,omitempty" protobuf:"bytes,6,opt,name=currentRevision"`
// updateRevision, if not empty, indicates the version of the stormService used to generate roleSets in update state.
UpdateRevision string `json:"updateRevision,omitempty" protobuf:"bytes,7,opt,name=updateRevision... | Currently, there are no changes to code; only API field has been modified. I'm not sure if this design is what we want. | CurrentRevision string `json:"currentRevision,omitempty" protobuf:"bytes,6,opt,name=currentRevision"`
// updateRevision, if not empty, indicates the version of the stormService used to generate roleSets in update state.
UpdateRevision string `json:"updateRevision,omitempty" protobuf:"bytes,7,opt,name=updateRevision... | @@ -119,6 +119,13 @@ type StormServiceStatus struct {
// The label selector information of the pods belonging to the StormService object.
ScalingTargetSelector string `json:"scalingTargetSelector,omitempty"`
+ // RoleStatuses mirrors the role-level status from the underlying RoleSet.
+ // This field is only popul... | api/orchestration/v1alpha1/stormservice_types.go | 26 | Go | 0.429 | suggestion | 119 | 51 | 51 | false | [API]: add roleStatuses field in stormservice api | 1,599 | vllm-project/aibrix | 2,572 | Go | googs1025 | googs1025 |
limitations under the License.
*/
package v1alpha1
import (
"fmt"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
/... | we should keep `Age` filed
plz add this filed | limitations under the License.
*/
package v1alpha1
import (
"fmt"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
/... | @@ -31,6 +31,10 @@ import (
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+// +kubebuilder:printcolumn:name="MINPODS",type="integer",JSONPath=".spec.minReplicas"
+// +kubebuilder:printcolumn:name="MAXPODS",type="integer",JSO... | api/autoscaling/v1alpha1/podautoscaler_types.go | 26 | Go | 0.286 | suggestion | 46 | 51 | 51 | false | [Misc]: add more field for podautoscaler resource | 1,611 | vllm-project/aibrix | 2,572 | Go | googs1025 | omerap12 |
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | All methods require the "if" check during runtime, how about assigning a dummy lock at init time? | #
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | @@ -0,0 +1,42 @@
+# Copyright 2024 The Aibrix Team.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable l... | python/aibrix_kvcache/aibrix_kvcache/common/threading.py | 26 | Python | 0.214 | question | 97 | 42 | 51 | false | [Feature] KVCache: support multi-threading mode | 1,628 | vllm-project/aibrix | 2,572 | Go | dczhu | DwyaneShi |
var webhookServer webhook.Server
if !disableWebhook {
webhookServer = webhook.NewServer(webhook.Options{
TLSOpts: tlsOpts,
})
}
mgr, err := ctrl.NewManager(config, ctrl.Options{
Scheme: scheme,
Metrics: metricsserver.Options{
BindAddress: metricsAddr,
SecureServing: secureMetrics,
TLSOpts: ... | just use `ctrl.GetConfigOrDie()` | runtimeConfig := cfg.NewRuntimeConfig(enableRuntimeSidecar, debugMode, modeladapterSchedulerPolicy)
var webhookServer webhook.Server
if !disableWebhook {
webhookServer = webhook.NewServer(webhook.Options{
TLSOpts: tlsOpts,
})
}
mgr, err := ctrl.NewManager(config, ctrl.Options{
Scheme: scheme,
Metrics:... | @@ -233,21 +257,6 @@ func main() {
setupLog.Info("starting cache")
stopCh := make(chan struct{})
defer close(stopCh)
- var config *rest.Config
-
- // ref: https://github.com/kubernetes-sigs/controller-runtime/issues/878#issuecomment-1002204308
- kubeConfig := flag.Lookup("kubeconfig").Value.String()
- if kubeConf... | cmd/controllers/main.go | 26 | Go | 0.286 | suggestion | 33 | 51 | 51 | false | [Mics]: support qos and burst flag in controller | 1,637 | vllm-project/aibrix | 2,572 | Go | googs1025 | googs1025 |
// +optional
BaseModel *string `json:"baseModel,omitempty"`
// PodSelector is a label query over pods that should match the ModelAdapter configuration.
// +kubebuilder:validation:Required
PodSelector *metav1.LabelSelector `json:"podSelector,omitempty"`
// SchedulerName is the name of the scheduler to use for sc... | can we use like this? 🤔
Looks a little bit strange for both `Minimum =1` and `Maximum = 1`
```go
// +optional
// +kubebuilder:validation:Enum=1
```
| // +optional
BaseModel *string `json:"baseModel,omitempty"`
// PodSelector is a label query over pods that should match the ModelAdapter configuration.
// +kubebuilder:validation:Required
PodSelector *metav1.LabelSelector `json:"podSelector,omitempty"`
// SchedulerName is the name of the scheduler to use for sc... | @@ -47,9 +47,13 @@ type ModelAdapterSpec struct {
// +optional
CredentialsSecretRef *corev1.LocalObjectReference `json:"credentialsSecretRef,omitempty"`
- // Replicas is the desired number of replicas of model adapter
+ // Replicas controls adapter distribution across pods:
+ // - nil (omitted): Load adapter on A... | api/model/v1alpha1/modeladapter_types.go | 26 | Go | 0.786 | question | 150 | 51 | 51 | false | Refactor the model adapter replicas feature | 1,670 | vllm-project/aibrix | 2,572 | Go | googs1025 | Jeffwan |
// applyScaling applies the scaling decision to the target resource
func (r *PodAutoscalerReconciler) applyScaling(ctx context.Context, pa *autoscalingv1alpha1.PodAutoscaler, targetGR schema.GroupResource, scale *unstructured.Unstructured, decision *ScaleDecision) error {
return r.updateScale(ctx, pa.Namespace, target... | em. there's a problem.
If PodGroupSize is not being used, this label won't exist. If we force to use the labelSelector here. it will fail the normal case?
| }, nil
}
// applyScaling applies the scaling decision to the target resource
func (r *PodAutoscalerReconciler) applyScaling(ctx context.Context, pa *autoscalingv1alpha1.PodAutoscaler, targetGR schema.GroupResource, scale *unstructured.Unstructured, decision *ScaleDecision) error {
return r.updateScale(ctx, pa.Namesp... | @@ -1080,6 +1081,15 @@ func (r *PodAutoscalerReconciler) computeMetricBasedReplicas(
return nil, fmt.Errorf("failed to get pod selector: %w", err)
}
+ req, err := labels.NewRequirement(constants.PodGroupIndexLabelKey, selection.Equals, []string{"0"}) | pkg/controller/podautoscaler/podautoscaler_controller.go | 26 | Go | 0.429 | bug | 160 | 51 | 51 | false | fix: autoscaler for the podset only collect metrics from rank0 | 1,704 | vllm-project/aibrix | 2,572 | Go | Jeffwan | scarlet25151 |
func init() {
Register(RouterSessionAffinity, NewSessionAffinityRouter)
}
type sessionAffinityRouter struct{}
func NewSessionAffinityRouter() (types.Router, error) {
return &sessionAffinityRouter{}, nil
}
// Route implements session affinity by attempting to route requests to the same pod
// using a session ID sto... | log the error with request id. | func init() {
Register(RouterSessionAffinity, NewSessionAffinityRouter)
}
type sessionAffinityRouter struct{}
func NewSessionAffinityRouter() (types.Router, error) {
return &sessionAffinityRouter{}, nil
}
// Route implements session affinity by attempting to route requests to the same pod
// using a session ID sto... | @@ -0,0 +1,115 @@
+/*
+Copyright 2025 The Aibrix Team.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or a... | pkg/plugins/gateway/algorithms/simple_session_affinity.go | 26 | Go | 0.214 | suggestion | 30 | 51 | 51 | false | feature: add simple session affinity plugins in gateway plugin | 1,751 | vllm-project/aibrix | 2,572 | Go | varungup90 | googs1025 |
sessionID := ctx.ReqHeaders[sessionIDHeader]
var targetAddr string
if sessionID != "" {
decoded, err := base64.StdEncoding.DecodeString(sessionID)
if err != nil {
klog.ErrorS(err, "Invalid session ID format")
} else {
targetAddr = string(decoded)
}
}
// If find a decoded target address, try to mat... | for any log message include request id. | }
sessionID := ctx.ReqHeaders[sessionIDHeader]
var targetAddr string
if sessionID != "" {
decoded, err := base64.StdEncoding.DecodeString(sessionID)
if err != nil {
klog.ErrorS(err, "Invalid session ID format",
"request_id", ctx.RequestID, "session_id", sessionID)
} else {
targetAddr = string(deco... | @@ -0,0 +1,115 @@
+/*
+Copyright 2025 The Aibrix Team.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or a... | pkg/plugins/gateway/algorithms/simple_session_affinity.go | 26 | Go | 0.071 | suggestion | 40 | 51 | 51 | false | feature: add simple session affinity plugins in gateway plugin | 1,751 | vllm-project/aibrix | 2,572 | Go | varungup90 | googs1025 |
const KVCacheLabelKeyIdentifier = "kvcache.orchestration.aibrix.ai/name"
const KVCacheLabelKeyRole = "kvcache.orchestration.aibrix.ai/role"
const KVCacheLabelValueRoleCache = "cache"
const HPKVRedisNodeMemberKey = "hpkv_cluster_metadata"
const InfiniStoreRedisNodeMemberKey = "kvcache_nodes"
const networkStatusAnnotat... | not sure if use like: `aibrix_kv_wather` or `aibrix_controller` in different component 🤔 | )
const KVCacheLabelKeyIdentifier = "kvcache.orchestration.aibrix.ai/name"
const KVCacheLabelKeyRole = "kvcache.orchestration.aibrix.ai/role"
const KVCacheLabelValueRoleCache = "cache"
const HPKVRedisNodeMemberKey = "hpkv_cluster_metadata"
const InfiniStoreRedisNodeMemberKey = "kvcache_nodes"
const networkStatusAnnot... | @@ -76,31 +76,40 @@ var (
consistentHashingVirtualNodeCount int
)
+const (
+ aibrixSubsystemName = "aibrix" | cmd/kvcache-watcher/main.go | 26 | Go | 0.429 | suggestion | 89 | 51 | 51 | false | refactor(metrics): use Subsystem for aibrix metrics instead of embedding in Name | 1,756 | vllm-project/aibrix | 2,572 | Go | googs1025 | googs1025 |
},
//nolint:dupl
wantDeployment: func() *appsv1.Deployment {
return wrapper.MakeDeployment("dep-with-inject", ns.Name,
map[string]string{
webhook.SidecarInjectionAnnotation: "true",
}).
AddRuntimeContainer("aibrix-runtime", "aibrix/runtime:v0.4.0", []string{
"aibrix_runt... | Plz note, I didn't change test data here to use `v0.5.0` so that one can understand that how using `sidecar-runtime-image` annotation, one can load their choice of aibrix-runtime version. | },
//nolint:dupl
wantDeployment: func() *appsv1.Deployment {
return wrapper.MakeDeployment("dep-with-inject", ns.Name,
map[string]string{
webhook.SidecarInjectionAnnotation: "true",
}).
AddRuntimeContainer("aibrix-runtime", "aibrix/runtime:v0.5.0", []string{
"aibrix_runt... | test/integration/webhook/deployment_webhook_test.go | 26 | Go | 0.571 | suggestion | 187 | 51 | 51 | false | [Misc] upgrade sidecar webhook image from v0.4.0 to v0.5.0 | 1,762 | vllm-project/aibrix | 2,572 | Go | nurali-techie | nurali-techie | |
GenerateName: r.roleSetName(stormService.Name) + "-roleset-",
Namespace: stormService.Namespace,
OwnerReferences: []metav1.OwnerReference{
*metav1.NewControllerRef(stormService, orchestrationv1alpha1.SchemeGroupVersion.WithKind(orchestrationv1alpha1.StormServiceKind)),
},
Labels: utils.DeepCo... | why do we have to change `revisionName` to `revision`
Is this change related to an issue? | GenerateName: utils.Shorten(fmt.Sprintf("%s-roleset-", stormService.Name), true, true),
Namespace: stormService.Namespace,
OwnerReferences: []metav1.OwnerReference{
*metav1.NewControllerRef(stormService, orchestrationv1alpha1.SchemeGroupVersion.WithKind(orchestrationv1alpha1.StormServiceKind)),
},
... | @@ -84,8 +84,8 @@ func (r *StormServiceReconciler) renderRoleSet(stormService *orchestrationv1alph
return nil, fmt.Errorf("roleSet labels %v does not match stormService selector %v", roleSet.Labels, selector)
}
roleSet.Labels[constants.StormServiceNameLabelKey] = stormService.Name
- roleSet.Labels[constants.Stor... | pkg/controller/stormservice/rolesetoperations.go | 26 | Go | 0.429 | question | 89 | 51 | 51 | false | fix(controller): shorten resource name | 1,777 | vllm-project/aibrix | 2,572 | Go | googs1025 | zhixian82 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.