Skip to content

Commit

Permalink
fix jointinference bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tangming1996 committed Oct 17, 2024
1 parent cdefbe3 commit c5882cf
Show file tree
Hide file tree
Showing 16 changed files with 1,586 additions and 204 deletions.
2 changes: 1 addition & 1 deletion build/crds/sedna.io_datasets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.6.2
creationTimestamp: null
name: datasets.sedna.io
spec:
Expand Down
2 changes: 1 addition & 1 deletion build/crds/sedna.io_featureextractionservices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.6.2
creationTimestamp: null
name: featureextractionservices.sedna.io
spec:
Expand Down
2 changes: 1 addition & 1 deletion build/crds/sedna.io_federatedlearningjobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.6.2
creationTimestamp: null
name: federatedlearningjobs.sedna.io
spec:
Expand Down
2 changes: 1 addition & 1 deletion build/crds/sedna.io_incrementallearningjobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.6.2
creationTimestamp: null
name: incrementallearningjobs.sedna.io
spec:
Expand Down
1,300 changes: 1,299 additions & 1 deletion build/crds/sedna.io_jointinferenceservices.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/crds/sedna.io_lifelonglearningjobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.6.2
creationTimestamp: null
name: lifelonglearningjobs.sedna.io
spec:
Expand Down
2 changes: 1 addition & 1 deletion build/crds/sedna.io_models.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.6.2
creationTimestamp: null
name: models.sedna.io
spec:
Expand Down
2 changes: 1 addition & 1 deletion build/crds/sedna.io_objectsearchservices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.6.2
creationTimestamp: null
name: objectsearchservices.sedna.io
spec:
Expand Down
2 changes: 1 addition & 1 deletion build/crds/sedna.io_objecttrackingservices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.6.2
creationTimestamp: null
name: objecttrackingservices.sedna.io
spec:
Expand Down
2 changes: 1 addition & 1 deletion build/crds/sedna.io_reidjobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.6.2
creationTimestamp: null
name: reidjobs.sedna.io
spec:
Expand Down
2 changes: 1 addition & 1 deletion build/crds/sedna.io_videoanalyticsjobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.6.2
creationTimestamp: null
name: videoanalyticsjobs.sedna.io
spec:
Expand Down
35 changes: 31 additions & 4 deletions pkg/apis/sedna/v1alpha1/jointinferenceservice_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1alpha1

import (
autoscalingv1beta2 "k8s.io/api/autoscaling/v2beta2"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand All @@ -40,26 +41,52 @@ type JointInferenceService struct {
type JointInferenceServiceSpec struct {
EdgeWorker EdgeWorker `json:"edgeWorker"`
CloudWorker CloudWorker `json:"cloudWorker"`
HPA HPA `json:"hpa"`
}

// HPA describes the desired functionality of the HorizontalPodAutoscaler.
type HPA struct {
MinReplicas int32 `json:"minReplicas"`
MaxReplicas int32 `json:"maxReplicas"`
Metrics []Metric `json:"metrics"`
// minReplicas is the lower limit for the number of replicas to which the autoscaler
// can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the
// alpha feature gate HPAScaleToZero is enabled and at least one Object or External
// metric is configured. Scaling is active as long as at least one metric value is
// available.
// +optional
MinReplicas *int32 `json:"minReplicas,omitempty"`

// maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up.
// It cannot be less that minReplicas.
MaxReplicas int32 `json:"maxReplicas"`

// metrics contains the specifications for which to use to calculate the
// desired replica count (the maximum replica count across all metrics will
// be used). The desired replica count is calculated multiplying the
// ratio between the target value and the current value by the current
// number of pods. Ergo, metrics used must decrease as the pod count is
// increased, and vice-versa. See the individual metric source types for
// more information about how each type of metric must respond.
// +optional
Metrics []autoscalingv1beta2.MetricSpec `json:"metrics,omitempty"`

// behavior configures the scaling behavior of the target
// in both Up and Down directions (scaleUp and scaleDown fields respectively).
// If not set, the default HPAScalingRules for scale up and scale down are used.
// +optional
Behavior *autoscalingv1beta2.HorizontalPodAutoscalerBehavior `json:"behavior,omitempty"`
}

// EdgeWorker describes the data a edge worker should have
type EdgeWorker struct {
Model SmallModel `json:"model"`
HardExampleMining HardExampleMining `json:"hardExampleMining"`
Template v1.PodTemplateSpec `json:"template"`
HPA HPA `json:"hpa"`
}

// CloudWorker describes the data a cloud worker should have
type CloudWorker struct {
Model BigModel `json:"model"`
Template v1.PodTemplateSpec `json:"template"`
HPA HPA `json:"hpa"`
}

// SmallModel describes the small model
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func (c *Controller) addDeployment(obj interface{}) {
c.enqueueByDeployment(deployment)
}

//deleteDeployment enqueues the FeatureExtractionService obj When a deleteDeployment is deleted
// deleteDeployment enqueues the FeatureExtractionService obj When a deleteDeployment is deleted
func (c *Controller) deleteDeployment(obj interface{}) {
deployment, ok := obj.(*appsv1.Deployment)

Expand Down Expand Up @@ -513,7 +513,7 @@ func (c *Controller) createFeatureExtractionWorker(service *sednav1.FeatureExtra
}

// Create FE deployment AND related pods (as part of the deployment creation)
_, err = runtime.CreateDeploymentWithTemplate(c.kubeClient, service, &service.Spec.DeploymentSpec, &workerParam, FEPort)
_, err = runtime.CreateDeploymentWithTemplate(c.kubeClient, service, &service.Spec.DeploymentSpec, &workerParam)
if err != nil {
return fmt.Errorf("failed to create feature extraction deployment: %w", err)
}
Expand Down
Loading

0 comments on commit c5882cf

Please sign in to comment.