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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
// podgroup already presented
return false, nil
}
func FinalizePodGroup(ctx context.Context, dc dynamic.Interface, c client.Client, podGroup client.Object, name, namespace string) error {
crd := schema.GroupVersionResource{
Group: "apiextensions.k8s.io",
Version: "v1",
Resource: "customresourcedefinitions... | Can you make `Shorten` more generic and implement calling the Shorten method for `roleSetName` func? | // podgroup already presented
return false, nil
}
func FinalizePodGroup(ctx context.Context, dc dynamic.Interface, c client.Client, podGroup client.Object, name, namespace string) error {
crd := schema.GroupVersionResource{
Group: "apiextensions.k8s.io",
Version: "v1",
Resource: "customresourcedefinitions... | @@ -319,3 +319,17 @@ func FinalizePodGroup(ctx context.Context, dc dynamic.Interface, c client.Client
}
return dc.Resource(podGroup.GetObjectKind().GroupVersionKind().GroupVersion().WithResource("podgroups")).Namespace(namespace).Delete(ctx, name, metav1.DeleteOptions{})
}
+ | pkg/controller/util/orchestration/util.go | 26 | Go | 0.5 | question | 100 | 40 | 47 | false | fix(controller): shorten resource name | 1,777 | vllm-project/aibrix | 2,572 | Go | googs1025 | zhixian82 |
if selector == nil {
return nil, fmt.Errorf("selector can not be nil")
}
roleSetSelector, err := metav1.LabelSelectorAsSelector(selector)
if err != nil {
return nil, fmt.Errorf("bad selector format: %v", err)
}
roleSetList := &orchestrationv1alpha1.RoleSetList{}
err = r.Client.List(ctx, roleSetList, client.M... | can we use `fmt.Sprintf("%s-roleset-", stormService.Name)` instead of `"+"`? | if selector == nil {
return nil, fmt.Errorf("selector can not be nil")
}
roleSetSelector, err := metav1.LabelSelectorAsSelector(selector)
if err != nil {
return nil, fmt.Errorf("bad selector format: %v", err)
}
roleSetList := &orchestrationv1alpha1.RoleSetList{}
err = r.Client.List(ctx, roleSetList, client.M... | @@ -59,7 +59,7 @@ func (r *StormServiceReconciler) getRoleSetList(ctx context.Context, selector *m
func (r *StormServiceReconciler) renderRoleSet(stormService *orchestrationv1alpha1.StormService, index *int, revisionName string, roleRevisions map[string]*apps.ControllerRevision) (*orchestrationv1alpha1.RoleSet, error)... | pkg/controller/stormservice/rolesetoperations.go | 26 | Go | 0.429 | question | 76 | 51 | 51 | false | fix(controller): shorten resource name | 1,777 | vllm-project/aibrix | 2,572 | Go | googs1025 | zhixian82 |
//+kubebuilder:webhook:path=/validate-orchestration-aibrix-ai-v1alpha1-stormservice,mutating=false,failurePolicy=ignore,sideEffects=None,groups=orchestration.aibrix.ai,resources=stormservices,verbs=create;update,versions=v1alpha1,name=vstormservice.kb.io,admissionReviewVersions=v1
var _ webhook.CustomDefaulter = &Stor... | only valid `PodGroupSize != nil` | //+kubebuilder:webhook:path=/validate-orchestration-aibrix-ai-v1alpha1-stormservice,mutating=false,failurePolicy=ignore,sideEffects=None,groups=orchestration.aibrix.ai,resources=stormservices,verbs=create;update,versions=v1alpha1,name=vstormservice.kb.io,admissionReviewVersions=v1
var _ webhook.CustomDefaulter = &Stor... | @@ -124,7 +124,42 @@ var _ webhook.CustomDefaulter = &StormServiceCustomDefaulter{}
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *StormServiceCustomDefaulter) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
- // TODO(user):... | pkg/webhook/stormservice_webhook.go | 26 | Go | 0.214 | suggestion | 32 | 51 | 51 | false | [Bug]: add validation in stormservice webhook | 1,778 | vllm-project/aibrix | 2,572 | Go | googs1025 | googs1025 |
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
scheme := runtime.NewScheme()
fakeClient := fake.NewSimpleDynamicClient(scheme, tt.initialObjects...)
created, err := EnsurePodGroupExist(ctx, fakeClient, podGroup, name, namespace)
assert.NoError(t, err)
assert.Equal(t, tt.expectedRes... | Why would this require a mock podgroup instead of using a real podgroup? |
assert.NoError(t, err)
assert.Equal(t, tt.expectedResult, created)
if tt.expectedResult {
_, err := fakeClient.Resource(podGroupGVR).Namespace(namespace).Get(ctx, name, metav1.GetOptions{})
assert.NoError(t, err, "PodGroup should be created")
}
})
}
}
func TestFinalizePodGroup(t *testing.T) {... | @@ -133,3 +140,187 @@ func TestMinIntHelpers(t *testing.T) {
}
func boolPtr(b bool) *bool { return &b }
+
+type MockPodGroup struct {
+ metav1.TypeMeta
+ metav1.ObjectMeta
+}
+
+func (m *MockPodGroup) GetObjectKind() schema.ObjectKind {
+ return &m.TypeMeta
+}
+
+func (m *MockPodGroup) DeepCopyObject() runtime.Obje... | pkg/controller/util/orchestration/util_test.go | 26 | Go | 0.286 | question | 72 | 51 | 51 | false | add Podgroup util ut cases using fake-client | 1,790 | vllm-project/aibrix | 2,572 | Go | googs1025 | DengHom |
createPodGroupObject(name, namespace),
},
expectedResult: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
scheme := runtime.NewScheme()
fakeClient := fake.NewSimpleDynamicClient(scheme, tt.initialObjects...)
created, err := EnsurePodGroupExist(ctx, fakeClient, podGr... | `TestFinalizePodGroupWithFakeClient` -> `TestFinalizePodGroup` | t.Run(tt.name, func(t *testing.T) {
scheme := runtime.NewScheme()
fakeClient := fake.NewSimpleDynamicClient(scheme, tt.initialObjects...)
created, err := EnsurePodGroupExist(ctx, fakeClient, podGroup, name, namespace)
assert.NoError(t, err)
assert.Equal(t, tt.expectedResult, created)
if tt.expec... | @@ -133,3 +140,187 @@ func TestMinIntHelpers(t *testing.T) {
}
func boolPtr(b bool) *bool { return &b }
+
+type MockPodGroup struct {
+ metav1.TypeMeta
+ metav1.ObjectMeta
+}
+
+func (m *MockPodGroup) GetObjectKind() schema.ObjectKind {
+ return &m.TypeMeta
+}
+
+func (m *MockPodGroup) DeepCopyObject() runtime.Obje... | pkg/controller/util/orchestration/util_test.go | 26 | Go | 0.357 | suggestion | 62 | 51 | 51 | false | add Podgroup util ut cases using fake-client | 1,790 | vllm-project/aibrix | 2,572 | Go | googs1025 | DengHom |
"names": map[string]interface{}{
"plural": "podgroups",
"kind": "PodGroup",
},
},
},
}
}
func createPodGroupObject(name, namespace string) *unstructured.Unstructured {
return &unstructured.Unstructured{
Object: map[string]interface{}{
"apiVersion": "scheduling.volcano.sh/v1beta1",
"k... | `TestEnsurePodGroupExistWithFakeClient` -> `TestEnsurePodGroupExist` | }
func createPodGroupObject(name, namespace string) *unstructured.Unstructured {
return &unstructured.Unstructured{
Object: map[string]interface{}{
"apiVersion": "scheduling.volcano.sh/v1beta1",
"kind": "PodGroup",
"metadata": map[string]interface{}{
"name": name,
"namespace": namespace,... | @@ -133,3 +140,187 @@ func TestMinIntHelpers(t *testing.T) {
}
func boolPtr(b bool) *bool { return &b }
+
+type MockPodGroup struct {
+ metav1.TypeMeta
+ metav1.ObjectMeta
+}
+
+func (m *MockPodGroup) GetObjectKind() schema.ObjectKind {
+ return &m.TypeMeta
+}
+
+func (m *MockPodGroup) DeepCopyObject() runtime.Obje... | pkg/controller/util/orchestration/util_test.go | 26 | Go | 0.357 | suggestion | 68 | 51 | 51 | false | add Podgroup util ut cases using fake-client | 1,790 | vllm-project/aibrix | 2,572 | Go | googs1025 | DengHom |
},
}
}
func createPodGroupObject(name, namespace string) *unstructured.Unstructured {
return &unstructured.Unstructured{
Object: map[string]interface{}{
"apiVersion": "scheduling.volcano.sh/v1beta1",
"kind": "PodGroup",
"metadata": map[string]interface{}{
"name": name,
"namespace": na... | This is incorrect; the podgroup for the godel scheduler should be different from the volcano podgroup. | },
},
"scope": "Namespaced",
"names": map[string]interface{}{
"plural": "podgroups",
"kind": "PodGroup",
},
},
},
}
}
func createPodGroupObject(name, namespace string) *unstructured.Unstructured {
return &unstructured.Unstructured{
Object: map[string]interface{}{
"apiVersio... | @@ -133,3 +141,166 @@ func TestMinIntHelpers(t *testing.T) {
}
func boolPtr(b bool) *bool { return &b }
+
+var (
+ podGroupGVR = schema.GroupVersionResource{
+ Group: "scheduling.volcano.sh",
+ Version: "v1beta1",
+ Resource: "podgroups",
+ }
+)
+
+func createPGCRDObject(name string) *unstructured.Unstructur... | pkg/controller/util/orchestration/util_test.go | 26 | Go | 0.429 | bug | 102 | 51 | 51 | false | add Podgroup util ut cases using fake-client | 1,790 | vllm-project/aibrix | 2,572 | Go | googs1025 | DengHom |
"k8s.io/apimachinery/pkg/types"
corelisters "k8s.io/client-go/listers/core/v1"
discoverylisters "k8s.io/client-go/listers/discovery/v1"
toolscache "k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/record"
"k8s.io/klog/v2"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/builder"
"... | @Jeffwan for now I have hard-coded resync interval; let me know if there is need to make it configurable. | "k8s.io/apimachinery/pkg/types"
corelisters "k8s.io/client-go/listers/core/v1"
discoverylisters "k8s.io/client-go/listers/discovery/v1"
toolscache "k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/record"
"k8s.io/klog/v2"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/builder"
"... | @@ -64,6 +65,8 @@ const (
ModelAdapterPodTemplateLabelKey = "adapter.model.aibrix.ai/enabled"
ModelAdapterPodTemplateLabelValue = "true"
+ DefaultResyncInterval = 30 * time.Second | pkg/controller/modeladapter/modeladapter_controller.go | 26 | Go | 0.357 | suggestion | 105 | 51 | 51 | false | [Feat] Implement periodic reconcile for ModelAdapter | 1,824 | vllm-project/aibrix | 2,572 | Go | nurali-techie | nurali-techie |
"k8s.io/apimachinery/pkg/types"
corelisters "k8s.io/client-go/listers/core/v1"
discoverylisters "k8s.io/client-go/listers/discovery/v1"
toolscache "k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/record"
"k8s.io/klog/v2"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/builder"
"... | @Jeffwan resync interval kept every 30s. It means, if lora_model evict by vllm. At max it will take 30 sec + Reconcile() execution time to bring lora_model back on pod. Let me know if we want to increase/decrease interval. | "k8s.io/apimachinery/pkg/types"
corelisters "k8s.io/client-go/listers/core/v1"
discoverylisters "k8s.io/client-go/listers/discovery/v1"
toolscache "k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/record"
"k8s.io/klog/v2"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/builder"
"... | @@ -64,6 +65,8 @@ const (
ModelAdapterPodTemplateLabelKey = "adapter.model.aibrix.ai/enabled"
ModelAdapterPodTemplateLabelValue = "true"
+ DefaultResyncInterval = 30 * time.Second | pkg/controller/modeladapter/modeladapter_controller.go | 26 | Go | 0.429 | suggestion | 222 | 51 | 51 | false | [Feat] Implement periodic reconcile for ModelAdapter | 1,824 | vllm-project/aibrix | 2,572 | Go | nurali-techie | nurali-techie |
func (r *pdRouter) isPodSuitableForPromptLength(pod *v1.Pod, promptLength int) bool {
minLength, maxLength := r.getPodPromptRange(pod)
// If no prompt length range is configured, the pod is assumed to be suitable for handling any length.
if minLength == 0 && maxLength == math.MaxInt32 {
return true
}
// Check ... | Is this label specific, and is it set by the user? If so, can we use `const`? Also, if it's to be merged, should this be reflected in the docs? | minLength, maxLength := r.getPodPromptRange(pod)
if minLength > maxLength {
return false
}
// If no prompt length range is configured, the pod is assumed to be suitable for handling any length.
if minLength == 0 && maxLength == math.MaxInt32 {
return true
}
return promptLength >= minLength && promptLength ... | @@ -772,3 +801,78 @@ func (t *PrefillRequestTracker) GetPrefillRequestCountsForPods(pods []*v1.Pod) m
}
return counts
}
+
+func (r *pdRouter) isPodSuitableForPromptLength(pod *v1.Pod, promptLength int) bool {
+ minLength, maxLength := r.getPodPromptRange(pod)
+ // If no prompt length range is configured, the pod i... | pkg/plugins/gateway/algorithms/pd_disaggregation.go | 26 | Go | 0.571 | question | 143 | 51 | 33 | false | feat:router based on multi deployment configs | 1,835 | vllm-project/aibrix | 2,572 | Go | googs1025 | erictanjn |
promptLength = r.getPromptLength(routingCtx)
klog.InfoS("prompt length based filtering enabled", "request_id", routingCtx.RequestID, "prompt_length", promptLength)
}
for _, pod := range readyPods {
if _, ok := pod.Labels[PDRoleSetIdentifier]; !ok {
continue
}
if _, ok := pod.Labels[PDRoleIdentifier]; !o... | Seems the codes from 197-201 is duplicated.
is the code a filter? If so, can we write in similar way like this?
```
// For multi-node scenarios, only select pods from node_rank=0 (PodGroupIndex=0)
// which have the HTTP server running
if !isPodWithHTTPServer(pod) {
continue
}
```
```
if aibrixPromptLengt... | var promptLength int
if aibrixPromptLengthBucketing {
promptLength, _ = routingCtx.PromptLength()
klog.V(4).InfoS("prompt length based filtering enabled", "request_id", routingCtx.RequestID, "prompt_length", promptLength)
}
for _, pod := range readyPods {
if _, ok := pod.Labels[PDRoleSetIdentifier]; !ok {
... | @@ -180,11 +189,32 @@ func (r *pdRouter) filterPrefillDecodePods(routingCtx *types.RoutingContext, rea
case "decode":
decodePods = append(decodePods, pod)
}
+
+ if aibrixPromptLengthBucketing { | pkg/plugins/gateway/algorithms/pd_disaggregation.go | 26 | Go | 0.786 | refactor | 416 | 51 | 51 | false | feat:router based on multi deployment configs | 1,835 | vllm-project/aibrix | 2,572 | Go | Jeffwan | erictanjn |
"pod_name", podName,
"new_count", newCount)
}
func (t *PrefillRequestTracker) GetPrefillRequestCountsForPods(pods []*v1.Pod) map[string]int32 {
counts := make(map[string]int32)
for _, pod := range pods {
countInterface, exists := t.podRequestCounts.Load(pod.Name)
if !exists {
counts[pod.Name] = 0
} else... | what about the case that prompt belong to the boundary?
let's say bucket1 0-1000, bucket2 1000-2000,
now we have a prompt with length 950 token, with 5% boundary overlap, it could belong to any bucket. This is expected and we do not care about whick buckets it is allocated to? | }
func (t *PrefillRequestTracker) GetPrefillRequestCountsForPods(pods []*v1.Pod) map[string]int32 {
counts := make(map[string]int32)
for _, pod := range pods {
countInterface, exists := t.podRequestCounts.Load(pod.Name)
if !exists {
counts[pod.Name] = 0
} else {
counts[pod.Name] = countInterface.(*atomic... | @@ -772,3 +801,78 @@ func (t *PrefillRequestTracker) GetPrefillRequestCountsForPods(pods []*v1.Pod) m
}
return counts
}
+
+func (r *pdRouter) isPodSuitableForPromptLength(pod *v1.Pod, promptLength int) bool {
+ minLength, maxLength := r.getPodPromptRange(pod)
+ // If no prompt length range is configured, the pod i... | pkg/plugins/gateway/algorithms/pd_disaggregation.go | 26 | Go | 0.5 | question | 280 | 51 | 49 | false | feat:router based on multi deployment configs | 1,835 | vllm-project/aibrix | 2,572 | Go | Jeffwan | erictanjn |
newCount := count.Add(-1)
// Ensure count doesn't go below zero
if newCount < 0 {
count.Store(0)
newCount = 0
}
klog.V(4).InfoS("prefill_request_removed",
"request_id", requestID,
"pod_name", podName,
"new_count", newCount)
}
func (t *PrefillRequestTracker) GetPrefillRequestCountsForPods(pods []*v1.Po... | there're few common atomic methods added. like
- isPodSuitableForPromptLength
- getPodPromptRange
- getPromptLength
let's add some unit test for above methods | // Ensure count doesn't go below zero
if newCount < 0 {
count.Store(0)
newCount = 0
}
klog.V(4).InfoS("prefill_request_removed",
"request_id", requestID,
"pod_name", podName,
"new_count", newCount)
}
func (t *PrefillRequestTracker) GetPrefillRequestCountsForPods(pods []*v1.Pod) map[string]int32 {
count... | @@ -772,3 +801,78 @@ func (t *PrefillRequestTracker) GetPrefillRequestCountsForPods(pods []*v1.Pod) m
}
return counts
}
+
+func (r *pdRouter) isPodSuitableForPromptLength(pod *v1.Pod, promptLength int) bool { | pkg/plugins/gateway/algorithms/pd_disaggregation.go | 26 | Go | 0.357 | nitpick | 160 | 51 | 51 | false | feat:router based on multi deployment configs | 1,835 | vllm-project/aibrix | 2,572 | Go | Jeffwan | erictanjn |
if err != nil {
klog.ErrorS(err, "prefill request failed", "request_id", ctx.RequestID)
return "", fmt.Errorf("prefill request failed for request %s: %w", ctx.RequestID, err)
}
ctx.SetTargetPod(decodePod)
return ctx.TargetAddress(), nil
}
type Scores struct {
Pod *v1.Pod
Score float64
}
// filterPrefillD... | could be v(4) and not to spam logs | klog.InfoS("selected prefill/decode pods", "request_id", ctx.RequestID, "prefill_pod", prefillPod.Name, "decode_pod", decodePod.Name)
err = r.doPrefillRequest(ctx, prefillPod, llmEngine)
if err != nil {
klog.ErrorS(err, "prefill request failed", "request_id", ctx.RequestID)
return "", fmt.Errorf("prefill request... | @@ -160,6 +161,14 @@ type Scores struct {
// Pods without PodGroupIndex label are also included for backward compatibility.
func (r *pdRouter) filterPrefillDecodePods(routingCtx *types.RoutingContext, readyPods []*v1.Pod) (*v1.Pod, *v1.Pod, error) {
prefillPods, decodePods := []*v1.Pod{}, []*v1.Pod{}
+ promptLength... | pkg/plugins/gateway/algorithms/pd_disaggregation.go | 26 | Go | 0.143 | suggestion | 34 | 51 | 51 | false | feat:router based on multi deployment configs | 1,835 | vllm-project/aibrix | 2,572 | Go | Jeffwan | erictanjn |
// Pods without PodGroupIndex label are also included for backward compatibility.
func (r *pdRouter) filterPrefillDecodePods(routingCtx *types.RoutingContext, readyPods []*v1.Pod) (*v1.Pod, *v1.Pod, error) {
prefillPods, decodePods := []*v1.Pod{}, []*v1.Pod{}
var promptLength int
if aibrixPromptLengthBucketing {
... | Assuming, if no pod was suitable for prompt length then final prefillPods array will be empty.
Better alternative will be
```
var prefillPodsByPromptLength []*v1.Pod
for _, pod := range readyPods {
role := pod.Labels[PDRoleIdentifier]
switch role {
case "prefill":
prefillPods = append(prefillPods, pod)
if a... | // Pods without PodGroupIndex label are also included for backward compatibility.
func (r *pdRouter) filterPrefillDecodePods(routingCtx *types.RoutingContext, readyPods []*v1.Pod) (*v1.Pod, *v1.Pod, error) {
prefillPods, decodePods := []*v1.Pod{}, []*v1.Pod{}
promptLengthBucketingPrefillPods, promptLengthBucketingDec... | @@ -174,17 +184,23 @@ func (r *pdRouter) filterPrefillDecodePods(routingCtx *types.RoutingContext, rea
continue
}
+ if aibrixPromptLengthBucketing {
+ if !r.isPodSuitableForPromptLength(pod, promptLength) { | pkg/plugins/gateway/algorithms/pd_disaggregation.go | 26 | Go | 0.857 | suggestion | 703 | 51 | 51 | false | feat:router based on multi deployment configs | 1,835 | vllm-project/aibrix | 2,572 | Go | varungup90 | erictanjn |
// getPodPromptRange retrieves the minimum and maximum prompt lengths from pod labels.
func (r *pdRouter) getPodPromptRange(pod *v1.Pod) (int, int) {
minLength := 0
maxLength := math.MaxInt32
if val, ok := pod.Labels[PromptMinLength]; ok {
if parsed, err := strconv.Atoi(val); err == nil {
minLength = parsed
... | this is not needed. You can simply use
routingCtx.PromptLength() |
if minLength > maxLength {
return false
}
// If no prompt length range is configured, the pod is assumed to be suitable for handling any length.
if minLength == 0 && maxLength == math.MaxInt32 {
return true
}
return promptLength >= minLength && promptLength <= maxLength
}
// getPodPromptRange retrieves the... | @@ -772,3 +787,77 @@ func (t *PrefillRequestTracker) GetPrefillRequestCountsForPods(pods []*v1.Pod) m
}
return counts
}
+
+func (r *pdRouter) isPodSuitableForPromptLength(pod *v1.Pod, promptLength int) bool {
+ minLength, maxLength := r.getPodPromptRange(pod)
+
+ if minLength > maxLength {
+ return false
+ }
+ //... | pkg/plugins/gateway/algorithms/pd_disaggregation.go | 26 | Go | 0.286 | suggestion | 66 | 51 | 32 | false | feat:router based on multi deployment configs | 1,835 | vllm-project/aibrix | 2,572 | Go | varungup90 | erictanjn |
}
func (r *pdRouter) isPodSuitableForPromptLength(pod *v1.Pod, promptLength int) bool {
minLength, maxLength := r.getPodPromptRange(pod)
if minLength > maxLength {
return false
}
// If no prompt length range is configured, the pod is assumed to be suitable for handling any length.
if minLength == 0 && maxLengt... | Please remove the warn log message from line 814 and 822. If a pod is inaccurately configured then it will pollute the logs.
For future reference, if you need to log something, please include log like this
```
klog.InfoS("<message>", "request_id", routerCtx.RequestID, <variables>...)
``` |
func (t *PrefillRequestTracker) GetPrefillRequestCountsForPods(pods []*v1.Pod) map[string]int32 {
counts := make(map[string]int32)
for _, pod := range pods {
countInterface, exists := t.podRequestCounts.Load(pod.Name)
if !exists {
counts[pod.Name] = 0
} else {
counts[pod.Name] = countInterface.(*atomic.I... | @@ -772,3 +787,77 @@ func (t *PrefillRequestTracker) GetPrefillRequestCountsForPods(pods []*v1.Pod) m
}
return counts
}
+
+func (r *pdRouter) isPodSuitableForPromptLength(pod *v1.Pod, promptLength int) bool {
+ minLength, maxLength := r.getPodPromptRange(pod)
+
+ if minLength > maxLength {
+ return false
+ }
+ //... | pkg/plugins/gateway/algorithms/pd_disaggregation.go | 26 | Go | 0.857 | suggestion | 291 | 51 | 48 | false | feat:router based on multi deployment configs | 1,835 | vllm-project/aibrix | 2,572 | Go | varungup90 | erictanjn |
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/manager"
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
gatewayv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
modelv1alpha1 "github.com/vllm-project/aibrix/api/model/v1alpha1"
orchestrationv1alpha1 "github.com/vllm-p... | can we use some struct like this:
```go
var watchedWorkloads = []schema.GroupVersionKind{
{Group: "leaderworkerset.x-k8s.io", Version: "v1", Kind: "LeaderWorkerSet"},
...
}
```
This way, if we want to add other workloads, we only need to add them to this configuration. Also, can help make the other parts related to... | "k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/manager"
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
gatewayv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
modelv1alpha1 "github.com/vllm-project/aibrix/api/model/v1alpha1"
orchestrationv1alpha1 "github.com/vllm-p... | @@ -56,6 +58,7 @@ const (
defaultModelServingPort = 8000
modelRouterCustomPath = constants.ModelAnnoRouterCustomPath
+ lwsIdentifier = "leaderworkersets.leaderworkerset.x-k8s.io" | pkg/controller/modelrouter/modelrouter_controller.go | 26 | Go | 0.857 | suggestion | 355 | 51 | 51 | false | [Feature] support LWS in model-router controller (#1839) | 1,851 | vllm-project/aibrix | 2,572 | Go | googs1025 | rayne-Li |
}
}
m.deleteHTTPRoute(modelAdapter.Namespace, modelAdapter.Labels)
}
func (m *ModelRouter) addRouteFromRayClusterFleet(obj interface{}) {
fleet := obj.(*orchestrationv1alpha1.RayClusterFleet)
m.createHTTPRoute(fleet.Namespace, fleet.Labels, fleet.Annotations)
}
func (m *ModelRouter) deleteRouteFromRayClusterFle... | This func name can be more generic, it has nothing to do with lws. | if !ok {
return
}
}
m.deleteHTTPRoute(modelAdapter.Namespace, modelAdapter.Labels)
}
func (m *ModelRouter) addRouteFromRayClusterFleet(obj interface{}) {
fleet := obj.(*orchestrationv1alpha1.RayClusterFleet)
m.createHTTPRoute(fleet.Namespace, fleet.Labels, fleet.Annotations)
}
func (m *ModelRouter) deleteR... | @@ -189,6 +210,30 @@ func (m *ModelRouter) deleteRouteFromRayClusterFleet(obj interface{}) {
m.deleteHTTPRoute(fleet.Namespace, fleet.Labels)
}
+func (m *ModelRouter) addRouteFromLeaderWorkerSet(obj interface{}) { | pkg/controller/modelrouter/modelrouter_controller.go | 26 | Go | 0.214 | suggestion | 66 | 51 | 51 | false | [Feature] support LWS in model-router controller (#1839) | 1,851 | vllm-project/aibrix | 2,572 | Go | googs1025 | rayne-Li |
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/manager"
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
gatewayv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
modelv1alpha1 "github.com/vllm-project/aibrix/api/model/v1alpha1"
orchestrationv1alpha1 "github.com/vllm-p... | Is `lwsIdentifier` still be used? | "k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/manager"
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
gatewayv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
modelv1alpha1 "github.com/vllm-project/aibrix/api/model/v1alpha1"
orchestrationv1alpha1 "github.com/vllm-p... | @@ -56,8 +58,13 @@ const (
defaultModelServingPort = 8000
modelRouterCustomPath = constants.ModelAnnoRouterCustomPath
+ lwsIdentifier = "leaderworkersets.leaderworkerset.x-k8s.io" | pkg/controller/modelrouter/modelrouter_controller.go | 26 | Go | 0.286 | question | 34 | 51 | 51 | false | [Feature] support LWS in model-router controller (#1839) | 1,851 | vllm-project/aibrix | 2,572 | Go | googs1025 | rayne-Li |
})
if err != nil {
return err
}
_, err = fleetInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{
AddFunc: modelRouter.addRouteFromRayClusterFleet,
DeleteFunc: modelRouter.deleteRouteFromRayClusterFleet,
})
if err != nil {
return err
}
// add dynamic informer for all workloads
for _, gvk := ... | how about:
```go
exists, err := utils.GVKCheckExists(mgr.GetConfig(), gvk)
if err != nil || !exists {
klog.InfoS("skip informer (optional CRD)", "GVK", gvk, "exists", exists, "error", err)
continue
}
if err := addInformerForGVK(mgr, modelRouter, gvk); err != nil {
return err
}
``` | AddFunc: modelRouter.addRouteFromModelAdapter,
DeleteFunc: modelRouter.deleteRouteFromModelAdapter,
})
if err != nil {
return err
}
_, err = fleetInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{
AddFunc: modelRouter.addRouteFromRayClusterFleet,
DeleteFunc: modelRouter.deleteRouteFromRayClu... | @@ -119,8 +125,29 @@ func Add(mgr manager.Manager, runtimeConfig config.RuntimeConfig) error {
AddFunc: modelRouter.addRouteFromRayClusterFleet,
DeleteFunc: modelRouter.deleteRouteFromRayClusterFleet,
})
+ if err != nil {
+ return err
+ }
- return err
+ // add dynamic informer for all workloads
+ for _, g... | pkg/controller/modelrouter/modelrouter_controller.go | 26 | Go | 0.929 | suggestion | 302 | 51 | 51 | false | [Feature] support LWS in model-router controller (#1839) | 1,851 | vllm-project/aibrix | 2,572 | Go | googs1025 | rayne-Li |
continue
}
httpRoute.Spec.Rules[0].Matches = append(httpRoute.Spec.Rules[0].Matches,
gatewayv1.HTTPRouteMatch{
Path: &gatewayv1.HTTPPathMatch{
Type: ptr.To(gatewayv1.PathMatchPathPrefix),
Value: ptr.To(path),
},
Headers: []gatewayv1.HTTPHeaderMatch{
modelHeaderMatch,
},
})
... | Should be generic since the function handles any GVK:
`klog.ErrorS(err, "Failed to get informer", "GVK", gvk)` | path = strings.ReplaceAll(path, " ", "")
if _, exists := pathSet[path]; path == "" || exists {
continue
}
httpRoute.Spec.Rules[0].Matches = append(httpRoute.Spec.Rules[0].Matches,
gatewayv1.HTTPRouteMatch{
Path: &gatewayv1.HTTPPathMatch{
Type: ptr.To(gatewayv1.PathMatchPathPrefix),
Value: p... | @@ -424,3 +469,26 @@ func appendCustomModelRouterPaths(httpRoute *gatewayv1.HTTPRoute, modelHeaderMat
klog.InfoS("Added custom model router path", "path", path)
}
}
+
+func addInformerForGVK(mgr manager.Manager, modelRouter *ModelRouter, gvk schema.GroupVersionKind) error {
+ // create dynamic Informer
+ uObj := ... | pkg/controller/modelrouter/modelrouter_controller.go | 26 | Go | 0.714 | bug | 110 | 39 | 41 | false | [Feature] support LWS in model-router controller (#1839) | 1,851 | vllm-project/aibrix | 2,572 | Go | Jeffwan | rayne-Li |
path = strings.ReplaceAll(path, " ", "")
if _, exists := pathSet[path]; path == "" || exists {
continue
}
httpRoute.Spec.Rules[0].Matches = append(httpRoute.Spec.Rules[0].Matches,
gatewayv1.HTTPRouteMatch{
Path: &gatewayv1.HTTPPathMatch{
Type: ptr.To(gatewayv1.PathMatchPathPrefix),
Value: p... | minor: Should use `context.Background()` for a clearer intent that this is a new top-level operation | for _, path := range pathSlice {
// remove illegal space in path
path = strings.ReplaceAll(path, " ", "")
if _, exists := pathSet[path]; path == "" || exists {
continue
}
httpRoute.Spec.Rules[0].Matches = append(httpRoute.Spec.Rules[0].Matches,
gatewayv1.HTTPRouteMatch{
Path: &gatewayv1.HTTPPathMat... | @@ -424,3 +469,26 @@ func appendCustomModelRouterPaths(httpRoute *gatewayv1.HTTPRoute, modelHeaderMat
klog.InfoS("Added custom model router path", "path", path)
}
}
+
+func addInformerForGVK(mgr manager.Manager, modelRouter *ModelRouter, gvk schema.GroupVersionKind) error {
+ // create dynamic Informer
+ uObj := ... | pkg/controller/modelrouter/modelrouter_controller.go | 26 | Go | 0.571 | nitpick | 101 | 41 | 43 | false | [Feature] support LWS in model-router controller (#1839) | 1,851 | vllm-project/aibrix | 2,572 | Go | Jeffwan | rayne-Li |
// Set arr.podsByDeployment at last
arr.deployments = deployments
arr.podsByDeployment = podsByDeployment
}
func (arr *PodArray) ListPortsForPod() map[string][]int {
pods := arr.All()
if len(pods) == 0 {
return nil
}
podWithPort := make(map[string][]int, len(pods))
for _, pod := range pods {
ports := Get... | seems this is a pod interface or util rather that PodArray?
Do you think it's better to make it an auxiliary tool at the pod Level? Now the logic seems to be if any of the pod return >1, it becomes true. Do you think the external for loop is necessary? | /*
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
d... | @@ -118,3 +118,32 @@ func (arr *PodArray) initDeployments() {
arr.deployments = deployments
arr.podsByDeployment = podsByDeployment
}
+
+func (arr *PodArray) ListPortsForPod() map[string][]int {
+ pods := arr.All()
+ if len(pods) == 0 {
+ return nil
+ }
+
+ podWithPort := make(map[string][]int, len(pods))
+ for _... | pkg/utils/pod_array.go | 26 | Go | 0.5 | question | 254 | 35 | 140 | false | [feat] add distribute-dp api server least_request route | 1,866 | vllm-project/aibrix | 2,572 | Go | Jeffwan | paranoidRick |
if err != nil {
klog.Warningf("Invalid port value in label %s=%s: %v",
constants.ModelLabelPort, portStr, err)
return 0, fmt.Errorf("invalid port format: %w", err)
}
if port <= 0 || port > 65535 {
klog.Warningf("Port %d from label %s is out of valid range",
port, constants.ModelLabelPort)
return 0, fm... | this is injected and control by users? If so, I suggest we add some comments here, to enable this feature, we require user to pass it in the pod template env etc. Later ,we can move it to the doc to guide user following this setting | klog.Warningf("Invalid port value in label %s=%s: %v",
constants.ModelLabelPort, portStr, err)
return 0, fmt.Errorf("invalid port format: %w", err)
}
if port <= 0 || port > 65535 {
klog.Warningf("Port %d from label %s is out of valid range",
port, constants.ModelLabelPort)
return 0, fmt.Errorf("port %d... | @@ -157,6 +162,86 @@ func LoadEnvDuration(key string, defaultValue time.Duration) time.Duration {
return defaultValue
}
+// GetPortsForPod returns all ports for a pod based on its configuration.
+// For distributed data-parallel (DP) inference, a pod may expose multiple ports:
+// - Base port from pod labels (e.g.... | pkg/utils/util.go | 26 | Go | 0.643 | suggestion | 232 | 51 | 51 | false | [feat] add distribute-dp api server least_request route | 1,866 | vllm-project/aibrix | 2,572 | Go | Jeffwan | paranoidRick |
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"sigs.k8s.io/controller-runtime/pkg/client"
)
const (
NAMESPACE = "aibrix-system"
modelPortIdentifier = constants.ModelLabelPort
defaultPodMetricPort = 8000
)
var (
ReplicaSetDeploymentFinder = ... | I see the comment is updated but the code is not updated? Do you expect a Port argument? I suggest to have another wrapper on top of this method |
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"sigs.k8s.io/controller-runtime/pkg/client"
)
const (
NAMESPACE = "aibrix-system"
modelPortIdentifier = constants.ModelLabelPort
defaultPodMetricPort = 8000
)
var (
ReplicaSetDeploymentFinder = ... | @@ -50,6 +50,7 @@ func getDeploymentIdentifier() string {
}
// GeneratePodKey generates a key in the format "namespace/name" for a given pod.
+// or generates a key in the format "namespace/name/port" for a given pod with port.
func GeneratePodKey(podNamespace, podName string) string { | pkg/utils/pod.go | 26 | Go | 0.357 | suggestion | 144 | 51 | 51 | false | [feat] add distribute-dp api server least_request route | 1,866 | vllm-project/aibrix | 2,572 | Go | Jeffwan | paranoidRick |
/*
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
d... | `xdit` Using const is better than hardcoding. 🤔 | Body: routingCtx.ReqBody,
},
},
},
},
},
}, model, routingCtx, stream, term
}
// getEngineBasedPathRewrite returns the rewritten path for image/video generation endpoints
// based on the engine type specified in the pod labels/annotations.
// Returns empty string if no rewrite is needed (e.... | @@ -130,3 +140,32 @@ func (s *Server) HandleRequestBody(ctx context.Context, requestID string, req *e
},
}, model, routingCtx, stream, term
}
+
+// getEngineBasedPathRewrite returns the rewritten path for image/video generation endpoints
+// based on the engine type specified in the pod labels/annotations.
+// Re... | pkg/plugins/gateway/gateway_req_body.go | 26 | Go | 0.286 | suggestion | 48 | 133 | 38 | false | Support OpenAI compatible image generation endpoint | 1,867 | vllm-project/aibrix | 2,572 | Go | googs1025 | Jeffwan |
autoscalingv1alpha1.APA: true,
}
if !validStrategies[pa.Spec.ScalingStrategy] {
strategyPath := specPath.Child("scalingStrategy")
allErrs = append(allErrs, field.NotSupported(strategyPath, pa.Spec.ScalingStrategy, []string{
string(autoscalingv1alpha1.HPA),
string(autoscalingv1alpha1.KPA),
string(autosc... | should be resource.ParseQuantity(ms.TargetValue) instead.
import "k8s.io/apimachinery/pkg/api/resource" | autoscalingv1alpha1.APA: true,
}
if !validStrategies[pa.Spec.ScalingStrategy] {
strategyPath := specPath.Child("scalingStrategy")
allErrs = append(allErrs, field.NotSupported(strategyPath, pa.Spec.ScalingStrategy, []string{
string(autoscalingv1alpha1.HPA),
string(autoscalingv1alpha1.KPA),
string(autosc... | @@ -168,6 +169,13 @@ func (v *PodAutoscalerCustomValidator) validatePodAutoscaler(pa *autoscalingv1al
}
if ms.TargetValue == "" {
allErrs = append(allErrs, field.Required(msPath.Child("targetValue"), "must be set"))
+ } else {
+ val, err := strconv.ParseFloat(ms.TargetValue, 64) | pkg/webhook/podautoscaler_webhook.go | 26 | Go | 0.429 | suggestion | 105 | 51 | 51 | false | [Bug] Prevent div by zero in APA | 1,879 | vllm-project/aibrix | 2,572 | Go | alpe | alpe |
strategyPath := specPath.Child("scalingStrategy")
allErrs = append(allErrs, field.NotSupported(strategyPath, pa.Spec.ScalingStrategy, []string{
string(autoscalingv1alpha1.HPA),
string(autoscalingv1alpha1.KPA),
string(autoscalingv1alpha1.APA),
}))
}
// 4. Validate MetricsSources
metricsPath := specPat... | ```suggestion
} else if val.Sign() <= 0 {
``` | strategyPath := specPath.Child("scalingStrategy")
allErrs = append(allErrs, field.NotSupported(strategyPath, pa.Spec.ScalingStrategy, []string{
string(autoscalingv1alpha1.HPA),
string(autoscalingv1alpha1.KPA),
string(autoscalingv1alpha1.APA),
}))
}
// 4. Validate MetricsSources
metricsPath := specPat... | @@ -168,6 +169,13 @@ func (v *PodAutoscalerCustomValidator) validatePodAutoscaler(pa *autoscalingv1al
}
if ms.TargetValue == "" {
allErrs = append(allErrs, field.Required(msPath.Child("targetValue"), "must be set"))
+ } else {
+ val, err := strconv.ParseFloat(ms.TargetValue, 64)
+ if err != nil {
+ al... | pkg/webhook/podautoscaler_webhook.go | 26 | Go | 0.571 | suggestion | 50 | 51 | 51 | false | [Bug] Prevent div by zero in APA | 1,879 | vllm-project/aibrix | 2,572 | Go | alpe | alpe |
maxBackoffSeconds := 300 // 5 minutes max
if retryCount == 0 {
return 0 // No backoff for first attempt
}
// Calculate 2^retryCount, but cap it to prevent overflow
multiplier := int32(1 << uint(retryCount))
if multiplier > int32(maxBackoffSeconds/RetryBackoffSeconds) {
multiplier = int32(maxBackoffSeconds /... | nit: Better to compute `currentSpecHash` inside if_cond. | /*
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... | @@ -1202,3 +1280,90 @@ func (r *ModelAdapterReconciler) calculateExponentialBackoff(retryCount int32) t
backoffSeconds := RetryBackoffSeconds * int(multiplier)
return time.Duration(backoffSeconds) * time.Second
}
+
+// shouldRecoverFromFailed checks if a Failed adapter should attempt recovery
+// Returns (shouldRe... | pkg/controller/modeladapter/modeladapter_controller.go | 26 | Go | 0.429 | suggestion | 56 | 51 | 1,217 | false | [fix] Transition Lora to Failed state when no pods are retriable | 1,884 | vllm-project/aibrix | 2,572 | Go | nurali-techie | Jeffwan |
}
tests := []struct {
name string
initialObjects []runtime.Object
expectedResult bool
}{
{
name: "CRD not installed",
initialObjects: []runtime.Object{}, // not found CRD
expectedResult: false,
},
{
name: "PodGroup not found and create successfully",
initialObjects: []... | can we add other case to cover this change logic? | Spec: volcanoschedv1beta1.PodGroupSpec{
MinMember: 2,
},
}
tests := []struct {
name string
initialObjects []runtime.Object
expectCreated bool
expectUpdated bool
}{
{
name: "CRD not installed",
initialObjects: []runtime.Object{}, // not found CRD
expectCreated: false,... | pkg/controller/util/orchestration/util_test.go | 26 | Go | 0.143 | question | 50 | 51 | 51 | false | [Feat]: update PodGroup when RoleSet.SchedulingStrategy changed | 1,889 | vllm-project/aibrix | 2,572 | Go | googs1025 | fungaren | |
logger.info(f"Downloaded TOS file to {destination_file}")
return local_path
except (TosClientError, TosServerError) as e:
logger.error(f"TOS download error: {e}")
status_code = getattr(e, "status_code", None)
if status_code == 404 or "404" in str... | seems response has `is_truncated`? seems it doesn't handle the pagination. this is ok since the model weights won't be that large but let's leave a comment here | bucket=bucket_name,
key=object_key,
file_path=tmp_file,
)
os.replace(tmp_file, destination_file)
logger.info(f"Downloaded TOS file to {destination_file}")
return local_path
except (TosClient... | @@ -252,6 +261,156 @@ async def download(
raise RuntimeError(f"GCS download error: {e}")
+class TOSArtifactDownloader(ArtifactDownloader):
+ """Download artifacts from Volcengine TOS."""
+
+ async def download(
+ self, source_url: str, local_path: str, credentials: Optional[Dict] = Non... | python/aibrix/aibrix/runtime/downloaders.py | 26 | Python | 0.643 | suggestion | 160 | 51 | 51 | false | Feat: delegate artifacts preparation to lora downloader | 1,898 | vllm-project/aibrix | 2,572 | Go | Jeffwan | scarlet25151 |
- session_key: Session key (optional)
- endpoint: TOS endpoint (optional)
- region: TOS region (optional)
- enable_crc: Whether to enable CRC check (optional)
"""
try:
import tos
from tos.exceptions import TosClientError, TosServerError
exc... | em. this is kind of confusing, does TOS support `ak` or `access-key` or `access_key`? let's link a doc if there's official api documentation. If not, let's remove unnecessary envs to clean up the code | raise PermissionError(f"Access denied to GCS object: {source_url}")
else:
raise RuntimeError(f"GCS download error: {e}")
class TOSArtifactDownloader(ArtifactDownloader):
"""Download artifacts from Volcengine TOS."""
async def download(
self, source_url: str... | @@ -252,6 +261,156 @@ async def download(
raise RuntimeError(f"GCS download error: {e}")
+class TOSArtifactDownloader(ArtifactDownloader):
+ """Download artifacts from Volcengine TOS."""
+
+ async def download(
+ self, source_url: str, local_path: str, credentials: Optional[Dict] = Non... | python/aibrix/aibrix/runtime/downloaders.py | 26 | Python | 0.643 | refactor | 200 | 51 | 51 | false | Feat: delegate artifacts preparation to lora downloader | 1,898 | vllm-project/aibrix | 2,572 | Go | Jeffwan | scarlet25151 |
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(metricName)
if !ok {
return nil, &Met... | is this new introduced environments? | api, err := metrics.InitializePrometheusAPI(prometheusEndpoint, prometheusBasicAuthUser, prometheusBasicAuthPass)
if err != nil {
klog.Errorf("Error initializing Prometheus API: %v", err)
} else {
prometheusApi = api
klog.Infof("Prometheus API initialized successfully")
}
}
return prometheusApi
}
//... | @@ -155,6 +160,47 @@ func initPrometheusAPI() prometheusv1.API {
return prometheusApi
}
+// loadPrometheusBasicAuth initializes Prometheus basic auth credentials exactly once (via sync.Once).
+// It loads from a Kubernetes Secret when PROMETHEUS_BASIC_AUTH_SECRET_NAME is set; otherwise it falls back to env vars.
+... | pkg/cache/cache_metrics.go | 26 | Go | 0.071 | question | 36 | 51 | 51 | false | Feat: load prom auth from secret | 1,949 | vllm-project/aibrix | 2,572 | Go | Jeffwan | scarlet25151 |
package scaler
import (
"testing"
"time"
autoscalingv1alpha1 "github.com/aibrix/aibrix/api/autoscaling/v1alpha1"
"github.com/aibrix/aibrix/pkg/controller/podautoscaler/metrics"
)
// TestHcpaScale tests the APA behavior. For now, APA implements HCPA algorithm.
func TestAPAScale(t *testing.T) {
readyPodCount :=... | No issues found. |
package scaler
import (
"testing"
"time"
autoscalingv1alpha1 "github.com/aibrix/aibrix/api/autoscaling/v1alpha1"
"github.com/aibrix/aibrix/pkg/controller/podautoscaler/metrics"
)
// TestHcpaScale tests the APA behavior. For now, APA implements HCPA algorithm.
func TestAPAScale(t *testing.T) {
readyPodCount :=... | @@ -0,0 +1,79 @@
+/*
+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 ag... | pkg/controller/podautoscaler/scaler/apa_test.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Add AIBrix Custom Autoscaling Algorithm APA | 223 | vllm-project/aibrix | 2,572 | Go | kr11 | |
"github.com/aibrix/aibrix/pkg/utils"
"github.com/go-playground/validator/v10"
)
type malformedRequest struct {
status int
msg string
}
func (mr *malformedRequest) Error() string {
return mr.msg
}
func decodeJSONBody(w http.ResponseWriter, r *http.Request, dst *utils.User) error {
ct := r.Header.Get("Conten... | No issues found. |
"github.com/aibrix/aibrix/pkg/utils"
"github.com/go-playground/validator/v10"
)
type malformedRequest struct {
status int
msg string
}
func (mr *malformedRequest) Error() string {
return mr.msg
}
func decodeJSONBody(w http.ResponseWriter, r *http.Request, dst *utils.User) error {
ct := r.Header.Get("Conten... | @@ -23,6 +23,9 @@ import (
"io"
"net/http"
"strings"
+
+ "github.com/aibrix/aibrix/pkg/utils"
+ "github.com/go-playground/validator/v10"
)
type malformedRequest struct {
@@ -34,7 +37,7 @@ func (mr *malformedRequest) Error() string {
return mr.msg
}
-func decodeJSONBody(w http.ResponseWriter, r *http.Requ... | pkg/users/helpers.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Add validation for username and rpm/tpm negative value | 241 | vllm-project/aibrix | 2,572 | Go | varungup90 | |
headers := []*configPb.HeaderValueOption{
{
Header: &configPb.HeaderValue{
Key: "x-went-into-req-headers",
RawValue: []byte("true"),
},
},
{
Header: &configPb.HeaderValue{
Key: "x-updated-rpm",
RawValue: []byte(fmt.Sprintf("%d", rpm)),
},
},
}
if routingStrategy != "" {
... | No issues found. | headers := []*configPb.HeaderValueOption{
{
Header: &configPb.HeaderValue{
Key: "x-went-into-req-headers",
RawValue: []byte("true"),
},
},
{
Header: &configPb.HeaderValue{
Key: "x-updated-rpm",
RawValue: []byte(fmt.Sprintf("%d", rpm)),
},
},
}
if routingStrategy != "" {
... | @@ -25,6 +25,7 @@ import (
"strings"
"time"
+ "github.com/google/uuid"
"github.com/redis/go-redis/v9"
openai "github.com/sashabaranov/go-openai"
"google.golang.org/grpc/codes"
@@ -38,7 +39,6 @@ import (
routing "github.com/aibrix/aibrix/pkg/plugins/gateway/routing_algorithms"
"github.com/aibrix/aibrix/p... | pkg/plugins/gateway/gateway.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Fix concurrency issue with gateway RPM plugin | 244 | vllm-project/aibrix | 2,572 | Go | varungup90 | |
# 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... | No issues found. | # 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,39 @@
+# 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/aibrix/metrics/metrics.py | 0 | Python | 1 | none | 16 | 40 | 40 | true | [Misc ]Add runtime api metrics | 251 | vllm-project/aibrix | 2,572 | Go | brosoul | |
}
func validateModelAdapter(instance *modelv1alpha1.ModelAdapter) error {
if instance.Spec.ArtifactURL == "" {
return fmt.Errorf("artifactURL is required")
}
if instance.Spec.PodSelector == nil {
return fmt.Errorf("podSelector is required")
}
if _, err := url.ParseRequestURI(instance.Spec.ArtifactURL); err ... | No issues found. | }
func validateModelAdapter(instance *modelv1alpha1.ModelAdapter) error {
if instance.Spec.ArtifactURL == "" {
return fmt.Errorf("artifactURL is required")
}
if instance.Spec.PodSelector == nil {
return fmt.Errorf("podSelector is required")
}
if _, err := url.ParseRequestURI(instance.Spec.ArtifactURL); err ... | @@ -127,3 +127,12 @@ func extractHuggingFacePath(artifactURL string) (string, error) {
return path, nil
}
+
+func stringInSlice(slice []string, str string) bool {
+ for _, v := range slice {
+ if v == str {
+ return true
+ }
+ }
+ return false
+} | pkg/controller/modeladapter/utils.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Improve model adapter reliability and stability | 257 | vllm-project/aibrix | 2,572 | Go | Jeffwan | |
*/
package routingalgorithms
import (
"context"
"math"
"github.com/aibrix/aibrix/pkg/cache"
ratelimiter "github.com/aibrix/aibrix/pkg/plugins/gateway/ratelimiter"
v1 "k8s.io/api/core/v1"
"k8s.io/klog/v2"
)
type throughputRouter struct {
ratelimiter ratelimiter.RateLimiter
cache *cache.Cache
}
func Ne... | No issues found. | */
package routingalgorithms
import (
"context"
"math"
"github.com/aibrix/aibrix/pkg/cache"
ratelimiter "github.com/aibrix/aibrix/pkg/plugins/gateway/ratelimiter"
v1 "k8s.io/api/core/v1"
"k8s.io/klog/v2"
)
type throughputRouter struct {
ratelimiter ratelimiter.RateLimiter
cache *cache.Cache
}
func Ne... | @@ -18,40 +18,61 @@ package routingalgorithms
import (
"context"
- "fmt"
"math"
+ "github.com/aibrix/aibrix/pkg/cache"
ratelimiter "github.com/aibrix/aibrix/pkg/plugins/gateway/ratelimiter"
v1 "k8s.io/api/core/v1"
"k8s.io/klog/v2"
)
type throughputRouter struct {
ratelimiter ratelimiter.RateLimiter... | pkg/plugins/gateway/algorithms/throughput.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Use vllm metrics for routing | 274 | vllm-project/aibrix | 2,572 | Go | varungup90 | |
for _, metricValue := range metricValues {
sumMetricValue += metricValue
}
c.collectionsMutex.Lock()
defer c.collectionsMutex.Unlock()
// Update metrics into the window for tracking
err := c.UpdateMetricIntoWindow(metricKey, now, sumMetricValue)
if err != nil {
return err
}
klog.InfoS("Update pod list me... | No issues found. | for _, metricValue := range metricValues {
sumMetricValue += metricValue
}
c.collectionsMutex.Lock()
defer c.collectionsMutex.Unlock()
// Update metrics into the window for tracking
err := c.UpdateMetricIntoWindow(metricKey, now, sumMetricValue)
if err != nil {
return err
}
klog.InfoS("Update pod list me... | @@ -21,57 +21,20 @@ import (
"fmt"
"sync"
+ corev1 "k8s.io/api/core/v1"
+
"github.com/aibrix/aibrix/pkg/controller/podautoscaler/aggregation"
"k8s.io/klog/v2"
- corev1 "k8s.io/api/core/v1"
-
"time"
)
const (
metricServerDefaultMetricWindow = time.Minute
)
-type PodMetricClient struct {
- fetcher ... | pkg/controller/podautoscaler/metrics/client.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Refactor AutoScaler: metricClient, context, reconcile | 308 | vllm-project/aibrix | 2,572 | Go | kr11 | |
# 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.
import asyncio
from aibrix.batch.constant import DEFAULT_JOB_POOL_SIZE
i... | No issues found. | # 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.
import asyncio
from aibrix.batch.constant import DEFAULT_JOB_POOL_SIZE
i... | @@ -26,6 +26,7 @@ def __init__(self):
"""
This is main entrance to bind all components to serve job requests.
"""
+ _storage.initialize_storage()
self._storage = _storage
self._job_manager = JobManager()
self._scheduler = JobScheduler(self._job_manager, DEFAU... | python/aibrix/aibrix/batch/driver.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [batch] use volcano TOS as batch storage | 344 | vllm-project/aibrix | 2,572 | Go | xinchen384 | |
assert.Error(t, err, "no pod has IP")
}
func TestWithNoIPPods(t *testing.T) {
c := cache.Cache{
Pods: map[string]*v1.Pod{
"p1": {
ObjectMeta: metav1.ObjectMeta{
Name: "p1",
},
},
"p2": {
ObjectMeta: metav1.ObjectMeta{
Name: "p2",
},
},
},
}
r1 := randomRouter{}
targetPod... | No issues found. | assert.Error(t, err, "no pod has IP")
}
func TestWithNoIPPods(t *testing.T) {
c := cache.Cache{
Pods: map[string]*v1.Pod{
"p1": {
ObjectMeta: metav1.ObjectMeta{
Name: "p1",
},
},
"p2": {
ObjectMeta: metav1.ObjectMeta{
Name: "p2",
},
},
},
}
r1 := randomRouter{}
targetPod... | @@ -0,0 +1,143 @@
+/*
+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/router_test.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Add check if no pods are present | 345 | vllm-project/aibrix | 2,572 | Go | varungup90 | |
// while allowing for customization in the specific stages mentioned above.
func (r *PodAutoscalerReconciler) reconcileCustomPA(ctx context.Context, pa autoscalingv1alpha1.PodAutoscaler) (ctrl.Result, error) {
paStatusOriginal := pa.Status.DeepCopy()
paType := pa.Spec.ScalingStrategy
scaleReference := fmt.Sprintf("%... | No issues found. | // while allowing for customization in the specific stages mentioned above.
func (r *PodAutoscalerReconciler) reconcileCustomPA(ctx context.Context, pa autoscalingv1alpha1.PodAutoscaler) (ctrl.Result, error) {
paStatusOriginal := pa.Status.DeepCopy()
paType := pa.Spec.ScalingStrategy
scaleReference := fmt.Sprintf("%... | @@ -210,7 +210,7 @@ func (r *PodAutoscalerReconciler) Run(ctx context.Context, errChan chan<- error)
for {
select {
case <-ticker.C:
- klog.Info("enqueue all autoscalers")
+ klog.V(4).Info("enqueue all autoscalers")
// periodically sync all autoscaling objects
if err := r.enqueuePodAutoscalers(ctx);... | pkg/controller/podautoscaler/podautoscaler_controller.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Add reference grant to support httprouting for different namespace | 347 | vllm-project/aibrix | 2,572 | Go | varungup90 | |
condition := GetPodReadyCondition(status)
return condition != nil && condition.Status == v1.ConditionTrue
}
// GetPodReadyCondition extracts the pod ready condition from the given status and returns that.
// Returns nil if the condition is not present.
func GetPodReadyCondition(status v1.PodStatus) *v1.PodCondition ... | No issues found. | condition := GetPodReadyCondition(status)
return condition != nil && condition.Status == v1.ConditionTrue
}
// GetPodReadyCondition extracts the pod ready condition from the given status and returns that.
// Returns nil if the condition is not present.
func GetPodReadyCondition(status v1.PodStatus) *v1.PodCondition ... | @@ -20,6 +20,8 @@ import (
"context"
"fmt"
+ "k8s.io/klog/v2"
+
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
@@ -128,9 +130,11 @@ func CountReadyPods(podList *v1.PodList) (int64, error) {
readyPodCount := 0
for _, pod := range podList.Items {
-... | pkg/utils/pod.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | optimize benchmark scripts for autoscaler, add more logs | 356 | vllm-project/aibrix | 2,572 | Go | kr11 | |
setEnvRoutingStrategy bool
message string
expectedValidation bool
}{
{
headerBasedRoutingStrategyEnabled: true,
routingStrategy: "",
setEnvRoutingStrategy: false,
message: "empty routing str... | No issues found. | setEnvRoutingStrategy bool
message string
expectedValidation bool
}{
{
headerBasedRoutingStrategyEnabled: true,
routingStrategy: "",
setEnvRoutingStrategy: false,
message: "empty routing str... | @@ -0,0 +1,106 @@
+/*
+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 agre... | pkg/plugins/gateway/gateway_test.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Validate routing strategy bug fix | 364 | vllm-project/aibrix | 2,572 | Go | varungup90 | |
c.collectionsMutex.Lock()
defer c.collectionsMutex.Unlock()
// Update metrics into the window for tracking
err := c.UpdateMetricIntoWindow(metricKey, now, sumMetricValue)
if err != nil {
return err
}
klog.InfoS("Update pod list metrics", "metricKey", metricKey, "valueNum", len(metricValues), "timestamp", now,... | No issues found. | c.collectionsMutex.Lock()
defer c.collectionsMutex.Unlock()
// Update metrics into the window for tracking
err := c.UpdateMetricIntoWindow(metricKey, now, sumMetricValue)
if err != nil {
return err
}
klog.InfoS("Update pod list metrics", "metricKey", metricKey, "valueNum", len(metricValues), "timestamp", now,... | @@ -26,6 +26,8 @@ import (
"github.com/aibrix/aibrix/pkg/controller/podautoscaler/aggregation"
"k8s.io/klog/v2"
+ autoscalingv1alpha1 "github.com/aibrix/aibrix/api/autoscaling/v1alpha1"
+
"time"
)
@@ -92,6 +94,14 @@ func (c *KPAMetricsClient) UpdateMetricIntoWindow(metricKey NamespaceNameMetric,
}
func (... | pkg/controller/podautoscaler/metrics/client.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Misc: add support to metricsSources property of podautoscaler | 371 | vllm-project/aibrix | 2,572 | Go | zhangjyr | |
func (m *ModelRouter) deleteModelAdapter(obj interface{}) {
modelAdapter := obj.(*modelv1alpha1.ModelAdapter)
m.deleteHTTPRoute(modelAdapter.Namespace, modelAdapter.Labels)
}
func (m *ModelRouter) createHTTPRoute(namespace string, labels map[string]string) {
modelName, ok := labels[modelIdentifier]
if !ok {
ret... | No issues found. |
func (m *ModelRouter) deleteModelAdapter(obj interface{}) {
modelAdapter := obj.(*modelv1alpha1.ModelAdapter)
m.deleteHTTPRoute(modelAdapter.Namespace, modelAdapter.Labels)
}
func (m *ModelRouter) createHTTPRoute(namespace string, labels map[string]string) {
modelName, ok := labels[modelIdentifier]
if !ok {
ret... | @@ -163,6 +163,9 @@ func (m *ModelRouter) createHTTPRoute(namespace string, labels map[string]string
},
},
},
+ Timeouts: &gatewayv1.HTTPRouteTimeouts{
+ Request: ptr.To(gatewayv1.Duration("120s")),
+ },
},
},
}, | pkg/controller/modelrouter/modelrouter_controller.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Add envoy gateway streaming support | 377 | vllm-project/aibrix | 2,572 | Go | varungup90 | |
var _ Scaler = (*KpaAutoscaler)(nil)
// NewKpaAutoscaler Initialize KpaAutoscaler: Referenced from `knative/pkg/autoscaler/scaling/autoscaler.go newAutoscaler`
func NewKpaAutoscaler(readyPodsCount int, spec *KpaScalingContext) (*KpaAutoscaler, error) {
if spec == nil {
return nil, errors.New("spec cannot be nil")
... | No issues found. | var _ Scaler = (*KpaAutoscaler)(nil)
// NewKpaAutoscaler Initialize KpaAutoscaler: Referenced from `knative/pkg/autoscaler/scaling/autoscaler.go newAutoscaler`
func NewKpaAutoscaler(readyPodsCount int, spec *KpaScalingContext) (*KpaAutoscaler, error) {
if spec == nil {
return nil, errors.New("spec cannot be nil")
... | @@ -59,6 +59,15 @@ If the metric no longer exceeds the panic threshold, exit the panic mode.
*/
+const (
+ KPALabelPrefix = "kpa." + scalingcontext.AutoscalingLabelPrefix
+ targetBurstCapacityLabel = KPALabelPrefix + "target-burst-capacity"
+ activationScaleLabel = KPALabelPrefix + "activation-scale"... | pkg/controller/podautoscaler/scaler/kpa.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Enable setting PodAutoscaler configuration via YAML labels | 409 | vllm-project/aibrix | 2,572 | Go | kr11 | |
noise ~ N(0, sigma^2)
Args:
input_requests (list): The list of all requests to be sent.
A (float, optional): The amplitude of the sine wave in the concurrency function. Defaults to 1.
B (float, optional): The vertical shift of the sine wave in the concurrency function. Defaults to 1... | No issues found. | noise ~ N(0, sigma^2)
Args:
input_requests (list): The list of all requests to be sent.
A (float, optional): The amplitude of the sine wave in the concurrency function. Defaults to 1.
B (float, optional): The vertical shift of the sine wave in the concurrency function. Defaults to 1... | @@ -0,0 +1,232 @@
+import logging
+import math
+import os
+import random
+import json
+from typing import Tuple, Optional, List, Any
+from transformers import PreTrainedTokenizerBase
+import matplotlib.pyplot as plt
+import numpy as np
+import argparse
+import csv
+
+
+def sample_sharegpt_requests(
+ dataset_pat... | benchmarks/generator/workload_generator.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | AIBrix Workload Generator / Scenario Simulator | 428 | vllm-project/aibrix | 2,572 | Go | happyandslow | |
TargetBurstCapacity: 2.0,
ActivationScale: 2,
PanicThreshold: 2.0,
StableWindow: 60 * time.Second,
PanicWindow: 10 * time.Second,
ScaleDownDelay: 30 * time.Minute,
}
metricsFetcher := &metrics.RestMetricsFetcher{}
kpaMetricsClient := metrics.NewKPAMetricsClient(metricsFetcher... | No issues found. | TargetBurstCapacity: 2.0,
ActivationScale: 2,
PanicThreshold: 2.0,
StableWindow: 60 * time.Second,
PanicWindow: 10 * time.Second,
ScaleDownDelay: 30 * time.Minute,
}
metricsFetcher := &metrics.RestMetricsFetcher{}
kpaMetricsClient := metrics.NewKPAMetricsClient(metricsFetcher... | @@ -20,12 +20,14 @@ import (
"testing"
"time"
+ "github.com/aibrix/aibrix/pkg/controller/podautoscaler/aggregation"
+ "github.com/aibrix/aibrix/pkg/controller/podautoscaler/algorithm"
+ scalingcontext "github.com/aibrix/aibrix/pkg/controller/podautoscaler/common"
+
autoscalingv1alpha1 "github.com/aibrix/aibrix/... | pkg/controller/podautoscaler/scaler/kpa_test.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Refactor Scaler: Resolve Issues with Metric Parameter Updates in Multiple KPAs | 437 | vllm-project/aibrix | 2,572 | Go | kr11 | |
func extractBucketBoundary(line string) string {
startIndex := strings.Index(line, `le="`)
if startIndex == -1 {
return ""
}
startIndex += len(`le="`)
endIndex := strings.Index(line[startIndex:], `"`)
if endIndex == -1 {
return ""
}
return line[startIndex : startIndex+endIndex]
}
// extractMetricValue extr... | No issues found. | func extractBucketBoundary(line string) string {
startIndex := strings.Index(line, `le="`)
if startIndex == -1 {
return ""
}
startIndex += len(`le="`)
endIndex := strings.Index(line[startIndex:], `"`)
if endIndex == -1 {
return ""
}
return line[startIndex : startIndex+endIndex]
}
// extractMetricValue extr... | @@ -24,6 +24,7 @@ import (
"github.com/prometheus/client_golang/api"
prometheusv1 "github.com/prometheus/client_golang/api/prometheus/v1"
+ dto "github.com/prometheus/client_model/go"
"github.com/prometheus/common/config"
)
@@ -159,3 +160,39 @@ func InitializePrometheusAPI(endpoint, username, password string... | pkg/metrics/utils.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Support metrics multi labels for different models | 450 | vllm-project/aibrix | 2,572 | Go | brosoul | |
model_name (str): Model name.
buckets (list): List of bucket boundaries.
new_requests (dict): Dictionary with new requests to update bucket values.
help_header: the flag to include HELP Header
Returns:
str: Prometheus-formatted histogram metric.
"""
global metrics_st... | No issues found. | model_name (str): Model name.
buckets (list): List of bucket boundaries.
new_requests (dict): Dictionary with new requests to update bucket values.
help_header: the flag to include HELP Header
Returns:
str: Prometheus-formatted histogram metric.
"""
global metrics_st... | @@ -399,7 +399,7 @@ def metrics():
metrics_output += generate_counter_gauge_metric(metric["name"], metric["type"], metric["description"],
model_name, metric["value"])
metrics_output += generate_counter_gauge_metric(metric["name"], metric["type"]... | development/app/app.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Fix multi models metric result in PromQL | 458 | vllm-project/aibrix | 2,572 | Go | brosoul | |
return tuple(make_serializable(item) for item in data)
elif isinstance(data, dict):
return {key: make_serializable(value) for key, value in data.items()}
elif isinstance(data, (np.integer, np.int64)): # Convert NumPy int types to int
return int(data)
elif isinstance(data, (np.floati... | No issues found. | return tuple(make_serializable(item) for item in data)
elif isinstance(data, dict):
return {key: make_serializable(value) for key, value in data.items()}
elif isinstance(data, (np.integer, np.int64)): # Convert NumPy int types to int
return int(data)
elif isinstance(data, (np.floati... | @@ -3,11 +3,10 @@
import os
import numpy as np
-import pandas as pd
import matplotlib.pyplot as plt
-from typing import Tuple, Optional, List, Union
-from transformers import (AutoTokenizer, PreTrainedTokenizer, PreTrainedTokenizerBase,
+from typing import List, Union, Any, Optional
+from transformers import (Au... | benchmarks/generator/utils.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Refactor generator to generate time-based traces | 478 | vllm-project/aibrix | 2,572 | Go | happyandslow | |
Returns:
str: Prometheus-formatted histogram metric.
"""
global metrics_state
# Initialize state if not already present
if metric_name not in metrics_state:
metrics_state[metric_name] = {
"buckets": {bucket: 0 for bucket in buckets}, # Bucket values
"total_... | No issues found. |
Returns:
str: Prometheus-formatted histogram metric.
"""
global metrics_state
# Initialize state if not already present
if metric_name not in metrics_state:
metrics_state[metric_name] = {
"buckets": {bucket: 0 for bucket in buckets}, # Bucket values
"total_... | @@ -426,14 +426,30 @@ def metrics():
success_total = overrides.get("success_total", total / replicas)
avg_prompt_throughput = overrides.get("avg_prompt_throughput", total / replicas if replicas > 0 else 0)
avg_generation_throughput = overrides.get("avg_generation_throughput", total / replicas if replicas... | development/app/app.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Add metrics that scheduling needed | 486 | vllm-project/aibrix | 2,572 | Go | brosoul | |
now := time.Now()
_ = kpaMetricsClient.UpdateMetricIntoWindow(now.Add(-60*time.Second), 10.0)
_ = kpaMetricsClient.UpdateMetricIntoWindow(now.Add(-50*time.Second), 11.0)
_ = kpaMetricsClient.UpdateMetricIntoWindow(now.Add(-40*time.Second), 12.0)
_ = kpaMetricsClient.UpdateMetricIntoWindow(now.Add(-30*time.Second),... | No issues found. | now := time.Now()
_ = kpaMetricsClient.UpdateMetricIntoWindow(now.Add(-60*time.Second), 10.0)
_ = kpaMetricsClient.UpdateMetricIntoWindow(now.Add(-50*time.Second), 11.0)
_ = kpaMetricsClient.UpdateMetricIntoWindow(now.Add(-40*time.Second), 12.0)
_ = kpaMetricsClient.UpdateMetricIntoWindow(now.Add(-30*time.Second),... | @@ -55,7 +55,6 @@ func TestKpaScale(t *testing.T) {
metricsFetcher := &metrics.RestMetricsFetcher{}
kpaMetricsClient := metrics.NewKPAMetricsClient(metricsFetcher, spec.StableWindow, spec.PanicWindow)
now := time.Now()
- metricKey := metrics.NewNamespaceNameMetric("test_ns", "llama-70b", spec.ScalingMetric)
_ =... | pkg/controller/podautoscaler/scaler/kpa_test.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | [Bug] handle metricKey creation with MetricsSources | 488 | vllm-project/aibrix | 2,572 | Go | nwangfw | |
delayWindow = aggregation.NewTimeWindow(spec.ScaleDownDelay, 1*time.Second)
}
// As KNative stated:
// We always start in the panic mode, if the deployment is scaled up over 1 pod.
// If the scale is 0 or 1, normal Autoscaler behavior is fine.
// When Autoscaler restarts we lose metric history, which caus... | No issues found. | delayWindow = aggregation.NewTimeWindow(spec.ScaleDownDelay, 1*time.Second)
}
// As KNative stated:
// We always start in the panic mode, if the deployment is scaled up over 1 pod.
// If the scale is 0 or 1, normal Autoscaler behavior is fine.
// When Autoscaler restarts we lose metric history, which caus... | @@ -249,10 +249,23 @@ func (k *KpaAutoscaler) Scale(originalReadyPodsCount int, metricKey metrics.Name
return ScaleResult{}
}
- // Use 1 if there are zero current pods.
- readyPodsCount := math.Max(1, float64(originalReadyPodsCount))
- maxScaleUp := math.Ceil(spec.MaxScaleUpRate * readyPodsCount)
- maxScaleDown ... | pkg/controller/podautoscaler/scaler/kpa.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | [Bug] Fix the way how podautoscaler handle 0 pods. | 508 | vllm-project/aibrix | 2,572 | Go | zhangjyr | |
from aibrix.downloader.base import get_downloader
from aibrix.downloader.tos import TOSDownloaderV1
TOS_MODULE = "aibrix.downloader.tos.tos"
ENVS_MODULE = "aibrix.downloader.tos.envs"
ENVS_DOWNLOADER_TOS_VERSION = "aibrix.downloader.base.envs.DOWNLOADER_TOS_VERSION"
DOWNLOADER_TOS_VERSION = "v1"
def mock_not_exsit_t... | No issues found. | from aibrix.downloader.base import get_downloader
from aibrix.downloader.tos import TOSDownloaderV1
TOS_MODULE = "aibrix.downloader.tos.tos"
ENVS_MODULE = "aibrix.downloader.tos.envs"
ENVS_DOWNLOADER_TOS_VERSION = "aibrix.downloader.base.envs.DOWNLOADER_TOS_VERSION"
DOWNLOADER_TOS_VERSION = "v1"
def mock_not_exsit_t... | @@ -0,0 +1,86 @@
+# 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/tests/downloader/test_downloader_tos_v1.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [perf] Refact tos downloader in Runtime | 510 | vllm-project/aibrix | 2,572 | Go | brosoul | |
// MetricSourceApplyConfiguration represents an declarative configuration of the MetricSource type for use
// with apply.
type MetricSourceApplyConfiguration struct {
MetricSourceType *v1alpha1.MetricSourceType `json:"metricSourceType,omitempty"`
ProtocolType *v1alpha1.ProtocolType `json:"protocolType,omitemp... | No issues found. | // MetricSourceApplyConfiguration represents an declarative configuration of the MetricSource type for use
// with apply.
type MetricSourceApplyConfiguration struct {
MetricSourceType *v1alpha1.MetricSourceType `json:"metricSourceType,omitempty"`
ProtocolType *v1alpha1.ProtocolType `json:"protocolType,omitemp... | @@ -17,12 +17,20 @@ limitations under the License.
package v1alpha1
+import (
+ v1alpha1 "github.com/aibrix/aibrix/api/autoscaling/v1alpha1"
+)
+
// MetricSourceApplyConfiguration represents an declarative configuration of the MetricSource type for use
// with apply.
type MetricSourceApplyConfiguration struct {... | pkg/client/applyconfiguration/autoscaling/v1alpha1/metricsource.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Refactor metric source for customized protocol, port and path | 511 | vllm-project/aibrix | 2,572 | Go | kr11 | |
"fmt"
"time"
"k8s.io/apimachinery/pkg/types"
v1 "k8s.io/api/core/v1"
autoscalingv1alpha1 "github.com/aibrix/aibrix/api/autoscaling/v1alpha1"
)
// NamespaceNameMetric contains the namespace, name and the metric name
type NamespaceNameMetric struct {
types.NamespacedName // target deployment namespace and name
... | No issues found. | "fmt"
"time"
"k8s.io/apimachinery/pkg/types"
v1 "k8s.io/api/core/v1"
autoscalingv1alpha1 "github.com/aibrix/aibrix/api/autoscaling/v1alpha1"
)
// NamespaceNameMetric contains the namespace, name and the metric name
type NamespaceNameMetric struct {
types.NamespacedName // target deployment namespace and name
... | @@ -30,8 +30,10 @@ import (
// NamespaceNameMetric contains the namespace, name and the metric name
type NamespaceNameMetric struct {
- types.NamespacedName
- MetricName string
+ types.NamespacedName // target deployment namespace and name
+ MetricName string
+ PaNamespace string
+ PaName ... | pkg/controller/podautoscaler/metrics/interface.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | clean memory scaler object when pa crd is deleted | 520 | vllm-project/aibrix | 2,572 | Go | kr11 | |
RunSpecs(t, "Metrics Suite")
}
// MetricFetcherRecorder records url used for fetching metrics.
type MetricFetcherRecorder struct {
RestMetricsFetcher
url string
}
func NewMetricFetcherRecorder() *MetricFetcherRecorder {
recorder := &MetricFetcherRecorder{}
recorder.RestMetricsFetcher.test_url_setter = func(url ... | No issues found. | RunSpecs(t, "Metrics Suite")
}
// MetricFetcherRecorder records url used for fetching metrics.
type MetricFetcherRecorder struct {
RestMetricsFetcher
url string
}
func NewMetricFetcherRecorder() *MetricFetcherRecorder {
recorder := &MetricFetcherRecorder{}
recorder.RestMetricsFetcher.test_url_setter = func(url ... | @@ -0,0 +1,108 @@
+/*
+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 agre... | pkg/controller/podautoscaler/metrics/client_test.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | [Bug] Accumulated bug fix on controller manager, mock app configuration, and gpu optimizer. | 522 | vllm-project/aibrix | 2,572 | Go | zhangjyr | |
pa := &autoscalingv1alpha1.PodAutoscaler{
Spec: autoscalingv1alpha1.PodAutoscalerSpec{
ScaleTargetRef: corev1.ObjectReference{
Kind: "Deployment",
Name: "example-deployment",
},
MinReplicas: nil, // expecting nil as default since it's a pointer and no value is assigned
MaxReplicas: 5,
MetricsS... | No issues found. | pa := &autoscalingv1alpha1.PodAutoscaler{
Spec: autoscalingv1alpha1.PodAutoscalerSpec{
ScaleTargetRef: corev1.ObjectReference{
Kind: "Deployment",
Name: "example-deployment",
},
MinReplicas: nil, // expecting nil as default since it's a pointer and no value is assigned
MaxReplicas: 5,
MetricsS... | @@ -129,7 +129,7 @@ func TestApaUpdateContext(t *testing.T) {
apaSpec := NewApaScalingContext()
err := apaSpec.UpdateByPaTypes(pa)
if err != nil {
- t.Errorf("Failed to update KpaScalingContext: %v", err)
+ t.Errorf("Failed to update ApaScalingContext: %v", err)
}
if apaSpec.MaxScaleUpRate != 32.1 {
t.Er... | pkg/controller/podautoscaler/scaler/apa_test.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Fix APA bugs in creation, add test and demo yaml | 536 | vllm-project/aibrix | 2,572 | Go | kr11 | |
"github.com/aibrix/aibrix/pkg/cache"
metrics "github.com/aibrix/aibrix/pkg/metrics"
v1 "k8s.io/api/core/v1"
"k8s.io/klog/v2"
)
type leastKvCacheRouter struct {
cache *cache.Cache
}
func NewLeastKvCacheRouter() Router {
cache, err := cache.GetCache()
if err != nil {
panic(err)
}
return leastKvCacheRouter{... | No issues found. |
"github.com/aibrix/aibrix/pkg/cache"
metrics "github.com/aibrix/aibrix/pkg/metrics"
v1 "k8s.io/api/core/v1"
"k8s.io/klog/v2"
)
type leastKvCacheRouter struct {
cache *cache.Cache
}
func NewLeastKvCacheRouter() Router {
cache, err := cache.GetCache()
if err != nil {
panic(err)
}
return leastKvCacheRouter{... | @@ -0,0 +1,96 @@
+/*
+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 ag... | pkg/plugins/gateway/algorithms/least_kv_cache.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | add request routers - least kv cache, least expected latency | 543 | vllm-project/aibrix | 2,572 | Go | Aspirin96 | |
models[modelName] = struct{}{}
c.PodToModelMapping[podName] = models
}
pods, ok := c.ModelToPodMapping[modelName]
if !ok {
c.ModelToPodMapping[modelName] = map[string]*v1.Pod{
podName: pod,
}
} else {
pods[podName] = pod
c.ModelToPodMapping[modelName] = pods
}
}
func (c *Cache) deletePodAndModelMa... | No issues found. | models[modelName] = struct{}{}
c.PodToModelMapping[podName] = models
}
pods, ok := c.ModelToPodMapping[modelName]
if !ok {
c.ModelToPodMapping[modelName] = map[string]*v1.Pod{
podName: pod,
}
} else {
pods[podName] = pod
c.ModelToPodMapping[modelName] = pods
}
}
func (c *Cache) deletePodAndModelMa... | @@ -755,11 +755,12 @@ func (c *Cache) updatePodMetrics() {
c.mu.Lock()
defer c.mu.Unlock()
- for _, pod := range c.Pods {
- // Only scrape healthy Pod
- if pod.Status.PodIP == "" || utils.IsPodTerminating(pod) || !utils.IsPodReady(pod) {
- continue
- }
+ readyPods := utils.FilterReadyPods(c.Pods)
+ if len(re... | pkg/cache/cache.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Handle terminating pod for request routing | 549 | vllm-project/aibrix | 2,572 | Go | varungup90 | |
Returns:
int: The concurrency value rounded to the nearest integer.
"""
trend = A * math.sin(omega * t) + B
noise = random.gauss(0, sigma)
return round(trend + noise)
assert length is not None or (duration_ms is not None and interval_ms is not None), \
"d... | No issues found. | Returns:
int: The concurrency value rounded to the nearest integer.
"""
trend = A * math.sin(omega * t) + B
noise = random.gauss(0, sigma)
return round(trend + noise)
assert length is not None or (duration_ms is not None and interval_ms is not None), \
"d... | @@ -9,8 +9,8 @@
from typing import List, Tuple, Dict, Any
from transformers import PreTrainedTokenizerBase
from datetime import timedelta
-from sample_request import (load_sharegpt_requests, sample_sharegpt_requests_len_range)
-from utils import (get_tokenizer, plot_workload, make_serializable, save_workload)
+from... | benchmarks/generator/workload_generator.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Add request length for traces | 569 | vllm-project/aibrix | 2,572 | Go | happyandslow | |
// Case 4: Invalid scheme
t.Run("invalid scheme", func(t *testing.T) {
err := validateArtifactURL("ftp://bucket/path")
assert.EqualError(t, err, "artifactURL must start with one of the following schemes: s3://, gcs://, huggingface://")
})
}
// Test for equalStringSlices function
func TestEqualStringSlices(t *te... | No issues found. | // Case 4: Invalid scheme
t.Run("invalid scheme", func(t *testing.T) {
err := validateArtifactURL("ftp://bucket/path")
assert.EqualError(t, err, "artifactURL must start with one of the following schemes: s3://, gcs://, huggingface://")
})
}
// Test for equalStringSlices function
func TestEqualStringSlices(t *te... | @@ -17,6 +17,7 @@ limitations under the License.
package modeladapter
import (
+ "fmt"
"os"
"testing"
@@ -25,6 +26,7 @@ import (
"k8s.io/utils/ptr"
modelv1alpha1 "github.com/aibrix/aibrix/api/model/v1alpha1"
+ "github.com/aibrix/aibrix/pkg/config"
)
// Test for validateModelAdapter function
@@ -236,... | pkg/controller/modeladapter/utils_test.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Support model registration flow using aibrix runtime api | 580 | vllm-project/aibrix | 2,572 | Go | Jeffwan | |
func (c *Cache) debugInfo() {
c.mu.RLock()
defer c.mu.RUnlock()
c.debugInfoLocked()
}
func (c *Cache) debugInfoLocked() {
for _, pod := range c.Pods {
klog.V(4).Infof("pod: %s, podIP: %v", pod.Name, pod.Status.PodIP)
}
for podName, models := range c.PodToModelMapping {
var modelList string
for modelName ... | No issues found. |
func (c *Cache) debugInfo() {
c.mu.RLock()
defer c.mu.RUnlock()
c.debugInfoLocked()
}
func (c *Cache) debugInfoLocked() {
for _, pod := range c.Pods {
klog.V(4).Infof("pod: %s, podIP: %v", pod.Name, pod.Status.PodIP)
}
for podName, models := range c.PodToModelMapping {
var modelList string
for modelName ... | @@ -126,17 +126,17 @@ var (
)
func getPodMetricRefreshInterval() time.Duration {
- value, exists := os.LookupEnv("AIBRIX_POD_METRIC_REFRESH_INTERVAL_MS")
- if exists {
+ value := LoadEnv("AIBRIX_POD_METRIC_REFRESH_INTERVAL_MS", "")
+ if value != "" {
intValue, err := strconv.Atoi(value)
if err != nil {
- kl... | pkg/cache/cache.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Update routers to use GetPodModelMetric api and misc cleanup in metri… | 590 | vllm-project/aibrix | 2,572 | Go | varungup90 | |
"context"
"fmt"
"math"
"math/rand"
"github.com/aibrix/aibrix/pkg/cache"
v1 "k8s.io/api/core/v1"
"k8s.io/klog/v2"
)
type leastBusyTimeRouter struct {
cache *cache.Cache
}
func NewLeastBusyTimeRouter() (Router, error) {
c, err := cache.GetCache()
if err != nil {
return nil, err
}
return leastBusyTimeRou... | No issues found. | "context"
"fmt"
"math"
"math/rand"
"github.com/aibrix/aibrix/pkg/cache"
v1 "k8s.io/api/core/v1"
"k8s.io/klog/v2"
)
type leastBusyTimeRouter struct {
cache *cache.Cache
}
func NewLeastBusyTimeRouter() (Router, error) {
c, err := cache.GetCache()
if err != nil {
return nil, err
}
return leastBusyTimeRou... | @@ -31,23 +31,23 @@ type leastBusyTimeRouter struct {
cache *cache.Cache
}
-func NewLeastBusyTimeRouter() Router {
- cacheFetched, err := cache.GetCache()
+func NewLeastBusyTimeRouter() (Router, error) {
+ c, err := cache.GetCache()
if err != nil {
- panic(err)
+ return nil, err
}
return leastBusyTimeRou... | pkg/plugins/gateway/algorithms/least_busy_time.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | [misc] Polish gateway code with better structure | 645 | vllm-project/aibrix | 2,572 | Go | Jeffwan | |
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RayClusterFleetCondition) DeepCopyInto(out *RayClusterFleetCondition) {
*out = *in
in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime)
in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTi... | No issues found. |
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RayClusterFleetCondition) DeepCopyInto(out *RayClusterFleetCondition) {
*out = *in
in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime)
in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTi... | @@ -129,7 +129,7 @@ func (in *KVCacheSpec) DeepCopyInto(out *KVCacheSpec) {
*out = *in
in.Metadata.DeepCopyInto(&out.Metadata)
in.Cache.DeepCopyInto(&out.Cache)
- out.Service = in.Service
+ in.Service.DeepCopyInto(&out.Service)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creatin... | api/orchestration/v1alpha1/zz_generated.deepcopy.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | fix api scheme | 674 | vllm-project/aibrix | 2,572 | Go | kerthcet | |
k8sClient, v1alpha1Client := initializeClient(context.Background(), t)
t.Cleanup(func() {
assert.NoError(t, v1alpha1Client.ModelV1alpha1().ModelAdapters("default").Delete(context.Background(), adapter.Name, v1.DeleteOptions{}))
wait.PollImmediate(1*time.Second, 30*time.Second,
func() (done bool, err error) {
... | No issues found. | k8sClient, v1alpha1Client := initializeClient(context.Background(), t)
t.Cleanup(func() {
assert.NoError(t, v1alpha1Client.ModelV1alpha1().ModelAdapters("default").Delete(context.Background(), adapter.Name, v1.DeleteOptions{}))
wait.PollImmediate(1*time.Second, 30*time.Second,
func() (done bool, err error) {
... | @@ -0,0 +1,93 @@
+package e2e
+
+import (
+ "context"
+ "fmt"
+ "testing"
+ "time"
+
+ "github.com/stretchr/testify/assert"
+ modelv1alpha1 "github.com/vllm-project/aibrix/api/model/v1alpha1"
+ v1alpha1 "github.com/vllm-project/aibrix/pkg/client/clientset/versioned"
+ apierrors "k8s.io/apimachinery/pkg/api/errors"
+ v1... | test/e2e/model_adapter_test.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Add model adapter e2e tests | 701 | vllm-project/aibrix | 2,572 | Go | varungup90 | |
func TestBaseModelInference(t *testing.T) {
initializeClient(context.Background(), t)
client := createOpenAIClient(gatewayURL, apiKey)
chatCompletion, err := client.Chat.Completions.New(context.TODO(), openai.ChatCompletionNewParams{
Messages: openai.F([]openai.ChatCompletionMessageParamUnion{
openai.UserMess... | No issues found. |
func TestBaseModelInference(t *testing.T) {
initializeClient(context.Background(), t)
client := createOpenAIClient(gatewayURL, apiKey)
chatCompletion, err := client.Chat.Completions.New(context.TODO(), openai.ChatCompletionNewParams{
Messages: openai.F([]openai.ChatCompletionMessageParamUnion{
openai.UserMess... | @@ -55,11 +55,10 @@ func TestBaseModelInferenceFailures(t *testing.T) {
expectErrCode int
}{
{
- name: "Invalid API Key",
- apiKey: "fake-api-key",
- modelName: modelName,
- // TODO: it is supposed to be 401. Let's handle such case and fix this.
- expectErrCode: 500,
+ name: "Inva... | test/e2e/e2e_test.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Process response headers in gateway | 703 | vllm-project/aibrix | 2,572 | Go | varungup90 | |
// Remove from all maps
for node := range nodeMap {
delete(h.histogram, node)
delete(h.nodeToCount, node)
delete(h.hitTokens, node)
delete(h.promptTokens, node)
delete(h.decodingSize, node)
delete(h.podAllocations, node)
}
}
func (h *SlidingWindowHistogram) removeOldEntries(currentTime time.Time) {
h.m... | No issues found. | // Remove from all maps
for node := range nodeMap {
delete(h.histogram, node)
delete(h.nodeToCount, node)
delete(h.hitTokens, node)
delete(h.promptTokens, node)
delete(h.decodingSize, node)
delete(h.podAllocations, node)
}
}
func (h *SlidingWindowHistogram) removeOldEntries(currentTime time.Time) {
h.m... | @@ -222,7 +222,7 @@ func (h *SlidingWindowHistogram) getPrefillCost(node *prefixcacheindexer.TreeNod
attnQuad = calculateAttnQuadV100(numTokens, nil)
}
prefillTime := (baseTime + attnQuad) / 0.9
- numPods := len(node.ModelToPods) // You might need to adjust this based on your actual GPU allocation tracking
+ num... | pkg/plugins/gateway/algorithms/prefix_cache_and_load.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Improve thread safety for TreeNode data structure and refactor related codes | 730 | vllm-project/aibrix | 2,572 | Go | gangmuk | |
# The peak value of the 'P99' column is: 1148, mean value of the 'P50' column is: 45.12682926829268
# The peak value of the 'P99' column is: 32000, mean value of the 'P50' column is: 1291.0731707317073
# The peak value of the 'P99' column is: 32000, mean value of the 'P50' column is: 63.951219512195124
# The peak value... | No issues found. | # The peak value of the 'P99' column is: 1148, mean value of the 'P50' column is: 45.12682926829268
# The peak value of the 'P99' column is: 32000, mean value of the 'P50' column is: 1291.0731707317073
# The peak value of the 'P99' column is: 32000, mean value of the 'P50' column is: 63.951219512195124
# The peak value... | @@ -0,0 +1,142 @@
+import pandas as pd
+import csv
+
+#############################
+########### maas ###########
+#############################
+
+# Read the CSV data into a DataFrame
+# data = """
+# Time,Total,Success,5xx Error,4xx Error
+# 2024-10-14 14:04:00,31.6,31.2,,0.387
+# 2024-10-14 14:06:00,32.1,31.6,,0.47... | benchmarks/generator/peak_analysis.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Reconfigure workload generator for predefined synthetic patterns | 771 | vllm-project/aibrix | 2,572 | Go | happyandslow | |
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 distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the spe... | No issues found. | 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 distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the spe... | @@ -0,0 +1,59 @@
+/*
+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 agree... | pkg/plugins/gateway/prefixcacheindexer/tokenizer/tiktoken.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Use string based tokenizer in prefix cache | 774 | vllm-project/aibrix | 2,572 | Go | varungup90 | |
// early reject if no pods are ready to accept request for a model
pods, err := s.cache.GetPodsForModel(model)
if len(pods) == 0 || len(utils.FilterReadyPods(pods)) == 0 || err != nil {
klog.ErrorS(err, "no ready pod available", "requestID", requestID, "model", model)
return generateErrorResponse(envoyTypePb.Sta... | No issues found. | // early reject if no pods are ready to accept request for a model
pods, err := s.cache.GetPodsForModel(model)
if len(pods) == 0 || len(utils.FilterReadyPods(pods)) == 0 || err != nil {
klog.ErrorS(err, "no ready pod available", "requestID", requestID, "model", model)
return generateErrorResponse(envoyTypePb.Sta... | @@ -24,7 +24,6 @@ import (
"fmt"
"io"
"net/http"
- "slices"
"strconv"
"strings"
"sync"
@@ -243,7 +242,7 @@ func (s *Server) HandleRequestHeaders(ctx context.Context, requestID string, req
}
}
- routingStrategy, routingStrategyEnabled := GetRoutingStrategy(h.RequestHeaders.Headers.Headers)
+ routingSt... | pkg/plugins/gateway/gateway.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Make stream include usage as optional | 788 | vllm-project/aibrix | 2,572 | Go | varungup90 | |
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 distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS... | No issues found. | 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 distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS... | @@ -17,14 +17,40 @@ limitations under the License.
package main
import (
+ "flag"
+
+ "github.com/vllm-project/aibrix/pkg/cache"
"github.com/vllm-project/aibrix/pkg/metadata"
"github.com/vllm-project/aibrix/pkg/utils"
+ "k8s.io/client-go/rest"
+ "k8s.io/client-go/tools/clientcmd"
"k8s.io/klog/v2"
)
func m... | cmd/metadata/main.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Add /v1/models endpoint to gateway | 802 | vllm-project/aibrix | 2,572 | Go | varungup90 | |
Data: []ModelInfo{},
}
for _, model := range modelNames {
modelInfo := ModelInfo{
ID: model,
Created: time.Now().Unix(),
Object: "model",
OwnedBy: "aibrix",
}
response.Data = append(response.Data, modelInfo)
}
jsonBytes, _ := json.Marshal(response)
return jsonBytes
}
func TestBuildMode... | No issues found. | Data: []ModelInfo{},
}
for _, model := range modelNames {
modelInfo := ModelInfo{
ID: model,
Created: time.Now().Unix(),
Object: "model",
OwnedBy: "aibrix",
}
response.Data = append(response.Data, modelInfo)
}
jsonBytes, _ := json.Marshal(response)
return jsonBytes
}
func TestBuildMode... | @@ -0,0 +1,106 @@
+/*
+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/metadata/model_test.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Support OpenAI api style /v1/models response | 829 | vllm-project/aibrix | 2,572 | Go | Jeffwan | |
/*
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 agreed to in writing, software
d... | No issues found. | /*
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 agreed to in writing, software
d... | @@ -0,0 +1,22 @@
+/*
+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 agree... | pkg/plugins/gateway/cache/store.go | 0 | Go | 1 | none | 16 | 23 | 23 | true | [API] [Misc]: Support LRU cache with TTL for prefix cache indexer | 905 | vllm-project/aibrix | 2,572 | Go | vie-serendipity | |
/*
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
d... | No issues found. | /*
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
d... | @@ -26,4 +26,6 @@ type Pod struct {
Models *utils.Registry[string] // Model/adapter names that the pod is running
Metrics utils.SyncMap[string, metrics.MetricValue] // Pod metrics (metric_name -> value)
ModelMetrics utils.SyncMap[string, metrics.MetricValue] // Pod-model metrics (mod... | pkg/cache/pod.go | 0 | Go | 1 | none | 16 | 32 | 32 | true | [Misc] Add pods stats example: running requests. | 918 | vllm-project/aibrix | 2,572 | Go | zhangjyr | |
}
// Check if we need to update the status.
if r.inconsistentModelAdapterStatus(oldInstance.Status, instance.Status) {
condition := NewCondition(string(modelv1alpha1.ModelAdapterConditionReady), metav1.ConditionTrue,
ModelAdapterAvailable, fmt.Sprintf("ModelAdapter %s is ready", klog.KObj(instance)))
if err ... | No issues found. | }
// Check if we need to update the status.
if r.inconsistentModelAdapterStatus(oldInstance.Status, instance.Status) {
condition := NewCondition(string(modelv1alpha1.ModelAdapterConditionReady), metav1.ConditionTrue,
ModelAdapterAvailable, fmt.Sprintf("ModelAdapter %s is ready", klog.KObj(instance)))
if err ... | @@ -96,13 +96,15 @@ const (
LoadLoraRuntimeAPIPath = "/v1/lora_adapter/load"
UnloadLoraAdapterPath = "/v1/unload_lora_adapter"
UnloadLoraRuntimeAPIPath = "/v1/lora_adapter/unload"
+
+ // DefaultModelAdapterSchedulerPolicy is the default scheduler policy for ModelAdapter Controller.
+ DefaultModelAdapterSched... | pkg/controller/modeladapter/modeladapter_controller.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | [CLI] feature(modeladapter): make modeladapter controller scheduler policy be configured | 921 | vllm-project/aibrix | 2,572 | Go | googs1025 | |
return ctrlResult, err
}
// Check if we need to update the status.
if r.inconsistentModelAdapterStatus(oldInstance.Status, instance.Status) {
condition := NewCondition(string(modelv1alpha1.ModelAdapterConditionReady), metav1.ConditionTrue,
ModelAdapterAvailable, fmt.Sprintf("ModelAdapter %s is ready", klog.K... | No issues found. | return ctrlResult, err
}
// Check if we need to update the status.
if r.inconsistentModelAdapterStatus(oldInstance.Status, instance.Status) {
condition := NewCondition(string(modelv1alpha1.ModelAdapterConditionReady), metav1.ConditionTrue,
ModelAdapterAvailable, fmt.Sprintf("ModelAdapter %s is ready", klog.K... | @@ -230,9 +230,12 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
Watches(&corev1.Pod{}, handler.EnqueueRequestsFromMapFunc(lookupLinkedModelAdapterInNamespace(mgr.GetClient())),
builder.WithPredicates(podWithLabelFilter(ModelAdapterPodTemplateLabelKey, ModelAdapterPodTemplateLabelValue, ModelId... | pkg/controller/modeladapter/modeladapter_controller.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | [BUG] return directly when error occurs while adding the controller | 937 | vllm-project/aibrix | 2,572 | Go | Iceber | |
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/manager"
)
// Borrowed logic from Kruise
// Original source: https://github.com/openkrui... | No issues found. | "k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/manager"
)
// Borrowed logic from Kruise
// Original source: https://github.com/openkrui... | @@ -17,6 +17,9 @@ limitations under the License.
package controller
import (
+ "context"
+ "fmt"
+
"github.com/vllm-project/aibrix/pkg/config"
"github.com/vllm-project/aibrix/pkg/controller/kvcache"
"github.com/vllm-project/aibrix/pkg/controller/modeladapter"
@@ -25,8 +28,13 @@ import (
"github.com/vllm-pro... | pkg/controller/controller.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | [Misc]: move crd check in Initialize part | 949 | vllm-project/aibrix | 2,572 | Go | googs1025 | |
// https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken
const encoding = "cl100k_base"
func TokenizeInputText(text string) ([]int, error) {
// if you don't want download dictionary at runtime, you can use offline loader
tiktoken.SetBpeLoader(tiktoken_loader.NewOfflineLoader())
tke, err := tiktoken... | No issues found. | // https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken
const encoding = "cl100k_base"
func TokenizeInputText(text string) ([]int, error) {
// if you don't want download dictionary at runtime, you can use offline loader
tiktoken.SetBpeLoader(tiktoken_loader.NewOfflineLoader())
tke, err := tiktoken... | @@ -74,10 +74,10 @@ func TrimMessage(message string) string {
return message
}
-// CheckEnvExists checks if an environment variable exists.
+// LookupEnv retrieves an environment variable and returns whether it exists.
// It returns the value and a boolean indicating its existence.
-func CheckEnvExists(envVar str... | pkg/utils/util.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | [Bug] avoid frequent lookup of the routing strategy env | 956 | vllm-project/aibrix | 2,572 | Go | Iceber | |
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestStrategyRequiresCache(t *testing.T) {
req := "this is test message"
targetPod := getTargetPodFromChatCompletion(t, req, "least-request")
assert.NotEmpty(t, targetPod, "least request target pod is empty")
}
func TestRandomRoutin... | No issues found. | "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestStrategyRequiresCache(t *testing.T) {
req := "this is test message"
targetPod := getTargetPodFromChatCompletion(t, req, "least-request")
assert.NotEmpty(t, targetPod, "least request target pod is empty")
}
func TestRandomRoutin... | @@ -59,7 +59,7 @@ func TestRandomRouting(t *testing.T) {
stddev := math.Sqrt(sumSquared/float64(len(histogram)) - mean*mean)
assert.True(t, stddev/mean < 0.2,
- "stand deviation of pod distribution should be less than 20%%, but got %f, mean %f", stddev, mean)
+ "standard deviation of pod distribution should be ... | test/e2e/routing_strategy_test.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Add httproute status check for response header errors | 957 | vllm-project/aibrix | 2,572 | Go | varungup90 | |
r := ratelimiter.NewRedisAccountRateLimiter("aibrix", redisClient, 1*time.Minute)
// Initialize the routers
routing.Init()
return &Server{
redisClient: redisClient,
ratelimiter: r,
client: client,
requestCountTracker: map[string]int{},
cache: c,
}
}
func (s *... | No issues found. | r := ratelimiter.NewRedisAccountRateLimiter("aibrix", redisClient, 1*time.Minute)
// Initialize the routers
routing.Init()
return &Server{
redisClient: redisClient,
ratelimiter: r,
client: client,
requestCountTracker: map[string]int{},
cache: c,
}
}
func (s *... | @@ -17,7 +17,6 @@ limitations under the License.
package gateway
import (
- "context"
"errors"
"fmt"
"io"
@@ -37,7 +36,6 @@ import (
"github.com/vllm-project/aibrix/pkg/plugins/gateway/ratelimiter"
"github.com/vllm-project/aibrix/pkg/types"
"github.com/vllm-project/aibrix/pkg/utils"
- healthPb "google.g... | pkg/plugins/gateway/gateway.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Add graceful shutdown for gateway and add liveness/readiness probes | 962 | vllm-project/aibrix | 2,572 | Go | varungup90 | |
"context"
"fmt"
"net/url"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/validation/field"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
modelapi "github.com/vllm-project/aibrix/api/model/v1alpha1"
"... | No issues found. | "context"
"fmt"
"net/url"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/validation/field"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
modelapi "github.com/vllm-project/aibrix/api/model/v1alpha1"
"... | @@ -33,8 +33,8 @@ import (
type ModelAdapterWebhook struct{}
-// SetupBackendRuntimeWebhook will setup the manager to manage the webhooks
-func SetupBackendRuntimeWebhook(mgr ctrl.Manager) error {
+// SetupModelAdapterWebhook will setup the manager to manage the ModelAdapter webhook
+func SetupModelAdapterWebhook(... | pkg/webhook/modeladapter_webhook.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | cmd/controllers: add readyz check for the webhook | 969 | vllm-project/aibrix | 2,572 | Go | Iceber | |
const (
loraName = "text2sql-lora-2"
)
func TestModelAdapter(t *testing.T) {
adapter := createModelAdapterConfig("text2sql-lora-2", "llama2-7b")
k8sClient, v1alpha1Client := initializeClient(context.Background(), t)
t.Cleanup(func() {
assert.NoError(t, v1alpha1Client.ModelV1alpha1().ModelAdapters("default").Del... | No issues found. | const (
loraName = "text2sql-lora-2"
)
func TestModelAdapter(t *testing.T) {
adapter := createModelAdapterConfig("text2sql-lora-2", "llama2-7b")
k8sClient, v1alpha1Client := initializeClient(context.Background(), t)
t.Cleanup(func() {
assert.NoError(t, v1alpha1Client.ModelV1alpha1().ModelAdapters("default").Del... | @@ -49,7 +49,6 @@ func TestModelAdapter(t *testing.T) {
}
return false, nil
}))
-
})
// create model adapter
@@ -63,6 +62,7 @@ func TestModelAdapter(t *testing.T) {
// delete pod and ensure model adapter is rescheduled
t.Log("deleting pod instance to force model adapter rescheduling")
assert.N... | test/e2e/model_adapter_test.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | E2E CI fix to ensure all pods are ready | 972 | vllm-project/aibrix | 2,572 | Go | varungup90 | |
/*
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... | No issues found. | /*
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... | @@ -25,15 +25,17 @@ import (
)
var (
- redis_host = LoadEnv("REDIS_HOST", "localhost")
- redis_port = LoadEnv("REDIS_PORT", "6379")
+ redis_host = LoadEnv("REDIS_HOST", "localhost")
+ redis_port = LoadEnv("REDIS_PORT", "6379")
+ redis_password = LoadEnv("REDIS_PASSWORD", "")
)
func GetRedisClient() *red... | pkg/utils/redis.go | 0 | Go | 1 | none | 16 | 48 | 48 | true | Update add redis pass for client | 990 | vllm-project/aibrix | 2,572 | Go | weapons97 | |
:param prompt: The user prompt to be converted.
:param session_id: Optional session ID for conversation history.
:param history: Optional history dictionary to store conversation.
:param history_lock: Optional threading lock for thread safety.
:return: A list containing chat completion messages.
... | No issues found. | :param prompt: The user prompt to be converted.
:param session_id: Optional session ID for conversation history.
:param history: Optional history dictionary to store conversation.
:param history_lock: Optional threading lock for thread safety.
:return: A list containing chat completion messages.
... | @@ -1,4 +1,6 @@
import json
+import openai
+import threading
from typing import List, Any, Dict
def load_workload(input_path: str) -> List[Any]:
@@ -14,33 +16,81 @@ def load_workload(input_path: str) -> List[Any]:
# Function to wrap the prompt into OpenAI's chat completion message format.
def prepare_prompt(prom... | benchmarks/client/utils.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Adding callback patterns for generator client | 993 | vllm-project/aibrix | 2,572 | Go | happyandslow | |
v1 "k8s.io/api/core/v1"
"k8s.io/klog/v2"
)
var (
RouterThroughput types.RoutingAlgorithm = "throughput"
)
func init() {
RegisterDelayedConstructor(RouterThroughput, NewThroughputRouter)
}
type throughputRouter struct {
cache cache.Cache
}
func NewThroughputRouter() (types.Router, error) {
c, err := cache.Get... | No issues found. |
v1 "k8s.io/api/core/v1"
"k8s.io/klog/v2"
)
var (
RouterThroughput types.RoutingAlgorithm = "throughput"
)
func init() {
RegisterDelayedConstructor(RouterThroughput, NewThroughputRouter)
}
type throughputRouter struct {
cache cache.Cache
}
func NewThroughputRouter() (types.Router, error) {
c, err := cache.Get... | @@ -17,16 +17,15 @@ limitations under the License.
package routingalgorithms
import (
- "fmt"
"math"
"math/rand"
"github.com/vllm-project/aibrix/pkg/cache"
"github.com/vllm-project/aibrix/pkg/metrics"
"github.com/vllm-project/aibrix/pkg/types"
- "github.com/vllm-project/aibrix/pkg/utils"
+
v1 "k8s.io/... | pkg/plugins/gateway/algorithms/throughput.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | [Misc] fix: Optimizing Route method of the gateway algorithms | 1,001 | vllm-project/aibrix | 2,572 | Go | googs1025 | |
Expect(err).To(BeNil())
Expect(pods.Len()).To(Equal(1))
Expect(utils.CountRoutablePods(pods.All())).To(Equal(1))
})
It("should deletePod clear pod, model, and modelAdapter entrys", func() {
cache := newCache()
pod := getReadyPod("p1", "default", "m1", 0)
cache.addPod(pod)
cache.addModelAdapter(getNewMo... | No issues found. | Expect(err).To(BeNil())
Expect(pods.Len()).To(Equal(1))
Expect(utils.CountRoutablePods(pods.All())).To(Equal(1))
})
It("should deletePod clear pod, model, and modelAdapter entrys", func() {
cache := newCache()
pod := getReadyPod("p1", "default", "m1", 0)
cache.addPod(pod)
cache.addModelAdapter(getNewMo... | @@ -40,11 +40,12 @@ var dummyPod = &v1.Pod{
},
}
-func getReadyPod(podName string, modelName string, id int) *v1.Pod {
+func getReadyPod(podName, podNamespcae string, modelName string, id int) *v1.Pod {
pod := &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
- Name: podName,
- Labels: make(map[string]string),
+ ... | pkg/cache/cache_test.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | [Bug] fix: update metaPods cache to use namespace/name as the key | 1,015 | vllm-project/aibrix | 2,572 | Go | googs1025 | |
unMatchedTokens)
assert.Equal(t, 0, len(matchPods))
}
func Test_RadixMatchPrefix(t *testing.T) {
t.SkipNow()
tests := []*struct {
name string
inputText string
setupCache func() *LPRadixCache
model string
pods []*v1.Pod
matchTokens []int
unMatchTokens []int
matchP... | No issues found. | unMatchedTokens)
assert.Equal(t, 0, len(matchPods))
}
func Test_RadixMatchPrefix(t *testing.T) {
t.SkipNow()
tests := []*struct {
name string
inputText string
setupCache func() *LPRadixCache
model string
pods []*v1.Pod
matchTokens []int
unMatchTokens []int
matchP... | @@ -17,6 +17,7 @@ limitations under the License.
package prefixcacheindexer
import (
+ "sync"
"testing"
"time"
@@ -127,3 +128,48 @@ func Test_RadixMatchPrefix(t *testing.T) {
})
}
}
+
+func Test_LPRadixCacheConcurrency(t *testing.T) {
+ cache := NewLPRadixCache(2) // assuming 2 GPUs
+ model := "m1"
+ po... | pkg/utils/prefixcacheindexer/tree_test.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | [Fix] Removing redundant locks in prefix cache and load router function | 1,024 | vllm-project/aibrix | 2,572 | Go | gangmuk | |
// Perform the Chi-Squared test
chi2Stat, df, err := chiSquaredGoodnessOfFit(occurrence, float64(iterration/len(occurrence)))
assert.NoError(t, err, "chi-squared test failed %v", err)
assert.Equal(t, 2, df, "degrees of freedom should be 2")
// Using a lower 1% significance level to make sure the null hypothesis ... | No issues found. |
// Perform the Chi-Squared test
chi2Stat, df, err := chiSquaredGoodnessOfFit(occurrence, float64(iterration/len(occurrence)))
assert.NoError(t, err, "chi-squared test failed %v", err)
assert.Equal(t, 2, df, "degrees of freedom should be 2")
// Using a lower 1% significance level to make sure the null hypothesis ... | @@ -19,7 +19,6 @@ package e2e
import (
"context"
"fmt"
- "math"
"math/rand"
"net/http"
"testing"
@@ -49,17 +48,33 @@ func TestRandomRouting(t *testing.T) {
assert.True(t, len(histogram) > 1, "target pod distribution should be more than 1")
- // Calculate the variance of the distribution stored in the h... | test/e2e/routing_strategy_test.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | [BUG] Use more accurate chi-squared test for randomness validation in e2e test. | 1,027 | vllm-project/aibrix | 2,572 | Go | zhangjyr | |
total_prompts_count += len(flat_prompts_data)
# Store config data for overall prefix calculation
all_prompts_for_sharing.extend(prompts)
all_prompts_token_counts.extend(token_counts)
all_prefix_lengths.extend([prefix_length] * len(prompts))
# Store stats for this config
total_num_r... | No issues found. | total_prompts_count += len(flat_prompts_data)
# Store config data for overall prefix calculation
all_prompts_for_sharing.extend(prompts)
all_prompts_token_counts.extend(token_counts)
all_prefix_lengths.extend([prefix_length] * len(prompts))
# Store stats for this config
total_num_r... | @@ -40,14 +40,14 @@ def prepare_prompts(tokenizer, config):
all_prompts = []
prompts_token_counts = [] # Store token counts for each prompt
- for i in tqdm(range(num_prefix), desc=f"Preparing prompts for config {config['id']}"):
+ for i in range(num_prefix):
shared_length_mean = int(prom... | benchmarks/generator/dataset-generator/synthetic_prefix_sharing_dataset.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Support multiple configs in synthetic shared dataset | 1,033 | vllm-project/aibrix | 2,572 | Go | happyandslow | |
assert.NoError(t, err)
assert.False(t, slices.Contains([]string{p2, p3, p4}, p1))
}
func getReadyPods() []*v1.Pod {
return []*v1.Pod{
{
ObjectMeta: metav1.ObjectMeta{Name: "p1"},
Status: v1.PodStatus{
PodIP: "1.1.1.1",
Conditions: []v1.PodCondition{
{
Type: v1.PodReady,
Status: v1... | No issues found. | assert.NoError(t, err)
assert.False(t, slices.Contains([]string{p2, p3, p4}, p1))
}
func getReadyPods() []*v1.Pod {
return []*v1.Pod{
{
ObjectMeta: metav1.ObjectMeta{Name: "p1"},
Status: v1.PodStatus{
PodIP: "1.1.1.1",
Conditions: []v1.PodCondition{
{
Type: v1.PodReady,
Status: v1... | @@ -18,16 +18,16 @@ package routingalgorithms
import (
"context"
- "fmt"
"slices"
"testing"
"github.com/stretchr/testify/assert"
"github.com/vllm-project/aibrix/pkg/cache"
- metrics "github.com/vllm-project/aibrix/pkg/metrics"
+ "github.com/vllm-project/aibrix/pkg/metrics"
"github.com/vllm-project/aibr... | pkg/plugins/gateway/algorithms/prefix_cache_test.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | use atomic.Int32c instead of use Int32 type | 1,035 | vllm-project/aibrix | 2,572 | Go | googs1025 | |
def sample(self):
return self.samples[np.random.randint(0, len(self.samples))]
def analyze_dataset(dataset: Dict[str, Any], tokenizer: AutoTokenizer):
token_lengths = []
turns_counts = []
for session in dataset:
for prompt in session["prompts"]:
text = prompt
... | No issues found. |
def sample(self):
return self.samples[np.random.randint(0, len(self.samples))]
def analyze_dataset(dataset: Dict[str, Any], tokenizer: AutoTokenizer):
token_lengths = []
turns_counts = []
for session in dataset:
for prompt in session["prompts"]:
text = prompt
... | @@ -6,13 +6,52 @@
from synthetic_prompt import generate_synthetic_prompt
from util import save_dataset_jsonl
-
-def sample_normal(mean: int, std: int):
- sample = np.random.normal(mean, std)
- return sample
+class NormalSampler:
+ def __init__(self, mean: float, std: float) -> None:
+ self.mean = fl... | benchmarks/generator/dataset-generator/multiturn_prefix_sharing_dataset.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Add Pareto Sampler for Multiturn Dataset Generation | 1,038 | vllm-project/aibrix | 2,572 | Go | happyandslow | |
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 a... | No issues found. | 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 a... | @@ -29,6 +29,11 @@ import (
func main() {
redisClient := utils.GetRedisClient()
+ defer func() {
+ if err := redisClient.Close(); err != nil {
+ klog.Warningf("Error closing Redis client: %v", err)
+ }
+ }()
klog.Info("starting cache")
stopCh := make(chan struct{}) | cmd/metadata/main.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | [Misc] fix: add miss Close() for redis client | 1,056 | vllm-project/aibrix | 2,572 | Go | googs1025 | |
// You can also add volumeMounts, env vars, etc. if needed.
Resources: kvCache.Spec.Metadata.Redis.Runtime.Resources,
Env: envs,
},
},
},
}
return pod
}
// buildRedisService constructs a Kubernetes Service object for the Redis instance
// associated with the given KVCache custom resour... | No issues found. | // You can also add volumeMounts, env vars, etc. if needed.
Resources: kvCache.Spec.Metadata.Redis.Runtime.Resources,
Env: envs,
},
},
},
}
return pod
}
// buildRedisService constructs a Kubernetes Service object for the Redis instance
// associated with the given KVCache custom resour... | @@ -22,6 +22,7 @@ import (
orchestrationv1alpha1 "github.com/vllm-project/aibrix/api/orchestration/v1alpha1"
"github.com/vllm-project/aibrix/pkg/constants"
corev1 "k8s.io/api/core/v1"
+ rbacv1 "k8s.io/api/rbac/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
)
@@ -113,3... | pkg/controller/kvcache/backends/common.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | Support watcher pod rbac in kvcache controller | 1,071 | vllm-project/aibrix | 2,572 | Go | Jeffwan | |
RoCEVer=$(cat /sys/class/infiniband/$d/ports/$p/gid_attrs/types/$g 2>/dev/null | grep -o "[Vv].*")
echo "[scan_devices] RoCE version for $d:$p:$g = $RoCEVer"
if [ "${RoCEVer,,}" != "v2" ]; then
echo "[scan_devices] Skipped: Not RoCEv2"
... | No issues found. | RoCEVer=$(cat /sys/class/infiniband/$d/ports/$p/gid_attrs/types/$g 2>/dev/null | grep -o "[Vv].*")
echo "[scan_devices] RoCE version for $d:$p:$g = $RoCEVer"
if [ "${RoCEVer,,}" != "v2" ]; then
echo "[scan_devices] Skipped: Not RoCEv2"
... | @@ -0,0 +1,116 @@
+#!/usr/bin/env bash
+
+devs=()
+ports=()
+idxes=()
+rdmaIdx=""
+rdmaRate=""
+rdmaErr=""
+
+function scan_devices() {
+ allocDevs=()
+ echo "[scan_devices] Start scanning RDMA devices..."
+ for d in $(ls /sys/class/infiniband/) ; do
+ echo "[scan_devices] Found Infiniband device: $d"
+... | hack/rdma/search-gid.sh | 0 | Shell | 1 | none | 16 | 51 | 51 | true | Add rdma gid search scripts | 1,072 | vllm-project/aibrix | 2,572 | Go | Jeffwan | |
}
func (m *ModelRouter) deleteRouteFromRayClusterFleet(obj interface{}) {
fleet, ok := obj.(*orchestrationv1alpha1.RayClusterFleet)
if !ok {
tombstone, ok := obj.(cache.DeletedFinalStateUnknown)
if !ok {
return
}
fleet, ok = tombstone.Obj.(*orchestrationv1alpha1.RayClusterFleet)
if !ok {
return
}
... | No issues found. | }
func (m *ModelRouter) deleteRouteFromRayClusterFleet(obj interface{}) {
fleet, ok := obj.(*orchestrationv1alpha1.RayClusterFleet)
if !ok {
tombstone, ok := obj.(cache.DeletedFinalStateUnknown)
if !ok {
return
}
fleet, ok = tombstone.Obj.(*orchestrationv1alpha1.RayClusterFleet)
if !ok {
return
}
... | @@ -248,12 +248,14 @@ func (m *ModelRouter) createHTTPRoute(namespace string, labels map[string]string
},
}
err = m.Client.Create(context.Background(), &httpRoute)
- if err != nil && !apierrors.IsAlreadyExists(err) {
- klog.Errorln(err)
- return
- }
-
- if err == nil {
+ if err != nil {
+ if apierrors.IsAlrea... | pkg/controller/modelrouter/modelrouter_controller.go | 0 | Go | 1 | none | 16 | 51 | 51 | true | [Misc] chore: change Scheduler interface describe in modeladapter controller | 1,075 | vllm-project/aibrix | 2,572 | Go | googs1025 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.