From 1845514b8b0d7706dc4e2e12c836da7e6fee9287 Mon Sep 17 00:00:00 2001 From: TymonXie <847250484@qq.com> Date: Tue, 26 Jan 2021 18:55:36 +0800 Subject: [PATCH] Add API-related part for incrementallearning job 1.add crd and crd sample for incrementallearning job 2.add incrementallearningjob_types.go, and update register.go 3.update zz_generated.deepcopy.go and client dir --- .../incrementallearningjob_v1alpha1.yaml | 67 ++++ .../incrementallearningjob_v1alpha1.yaml | 285 +++++++++++++++++ .../v1alpha1/incrementallearningjob_types.go | 154 ++++++++++ pkg/apis/neptune/v1alpha1/model_types.go | 4 +- pkg/apis/neptune/v1alpha1/register.go | 2 + .../neptune/v1alpha1/zz_generated.deepcopy.go | 288 ++++++++++++++++++ .../fake/fake_incrementallearningjob.go | 126 ++++++++ .../v1alpha1/fake/fake_neptune_client.go | 4 + .../neptune/v1alpha1/generated_expansion.go | 2 + .../v1alpha1/incrementallearningjob.go | 179 +++++++++++ .../typed/neptune/v1alpha1/neptune_client.go | 5 + .../informers/externalversions/generic.go | 2 + .../v1alpha1/incrementallearningjob.go | 74 +++++ .../neptune/v1alpha1/interface.go | 7 + .../neptune/v1alpha1/expansion_generated.go | 8 + .../v1alpha1/incrementallearningjob.go | 83 +++++ pkg/globalmanager/federatedlearningjob.go | 2 +- pkg/globalmanager/jointinferenceservice.go | 4 +- 18 files changed, 1291 insertions(+), 5 deletions(-) create mode 100644 build/crd-samples/neptune/incrementallearningjob_v1alpha1.yaml create mode 100644 build/crds/neptune/incrementallearningjob_v1alpha1.yaml create mode 100644 pkg/apis/neptune/v1alpha1/incrementallearningjob_types.go create mode 100644 pkg/client/clientset/versioned/typed/neptune/v1alpha1/fake/fake_incrementallearningjob.go create mode 100644 pkg/client/clientset/versioned/typed/neptune/v1alpha1/incrementallearningjob.go create mode 100644 pkg/client/informers/externalversions/neptune/v1alpha1/incrementallearningjob.go create mode 100644 pkg/client/listers/neptune/v1alpha1/incrementallearningjob.go diff --git a/build/crd-samples/neptune/incrementallearningjob_v1alpha1.yaml b/build/crd-samples/neptune/incrementallearningjob_v1alpha1.yaml new file mode 100644 index 0000000..f80741c --- /dev/null +++ b/build/crd-samples/neptune/incrementallearningjob_v1alpha1.yaml @@ -0,0 +1,67 @@ +apiVersion: neptune.io/v1alpha1 +kind: IncrementalLearningJob +metadata: + name: helmet-detection-demo +spec: + initialModel: + name: "initial-model" + dataset: + name: "incremental-dataset" + trainProb: 0.8 + trainSpec: + workerSpec: + scriptDir: "/code_il" + scriptBootFile: "train.py" + frameworkType: "tensorflow" + frameworkVersion: "1.15" + parameters: + - key: "batch_size" + value: "32" + - key: "learning_rate" + value: "0.001" + - key: "max_epochs" + value: "100" + + trigger: + checkPeriodSeconds: 60 + timer: + start: 02:00 + end: 04:00 + condition: + operator: ">" + threshold: 500 + metric: num_of_samples + evalSpec: + workerSpec: + scriptDir: "/code_il" + scriptBootFile: "eval.py" + frameworkType: "tensorflow" + frameworkVersion: "1.15" + parameters: + - key: "input_shape" + value: "352,640" + - key: "class_names" + value: "helmet,helmet-on,person,helmet-off" + + deploySpec: + model: + name: "inference-model" + trigger: + condition: + operator: ">" + threshold: 0.1 + metric: precision_delta + nodeName: "edge0" + hardExampleMining: + name: "IBT" + workerSpec: + scriptDir: "/code_il" + scriptBootFile: "eval.py" + frameworkType: "tensorflow" + frameworkVersion: "1.15" + parameters: + - key: "nms_threshold" + value: "0.6" + + nodeName: "cloud0" + outputDir: "/output" diff --git a/build/crds/neptune/incrementallearningjob_v1alpha1.yaml b/build/crds/neptune/incrementallearningjob_v1alpha1.yaml new file mode 100644 index 0000000..e60d0c6 --- /dev/null +++ b/build/crds/neptune/incrementallearningjob_v1alpha1.yaml @@ -0,0 +1,285 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: incrementallearningjobs.neptune.io +spec: + group: neptune.io + names: + kind: IncrementalLearningJob + plural: incrementallearningjobs + shortNames: + - il + scope: Namespaced + versions: + - name: v1alpha1 + subresources: + # status enables the status subresource. + status: {} + served: true + storage: true + schema: + openAPIV3Schema: + type: object + properties: + spec: + type: object + required: + - dataset + - nodeName + - outputDir + - initialModel + - trainSpec + properties: + dataset: + type: object + required: + - name + - trainProb + properties: + name: + type: string + trainProb: + type: number + nodeName: + type: string + outputDir: + type: string + initialModel: + type: object + required: + - name + properties: + name: + type: string + trainSpec: + type: object + required: + - workerSpec + - trigger + properties: + workerSpec: + type: object + required: + - scriptDir + - scriptBootFile + - frameworkType + - frameworkVersion + properties: + scriptDir: + type: string + scriptBootFile: + type: string + frameworkType: + type: string + frameworkVersion: + type: string + parameters: + type: array + items: + type: object + required: + - key + - value + properties: + key: + type: string + value: + type: string + trigger: + type: object + properties: + checkPeriodSeconds: + type: integer + timer: + type: object + required: + - start + - end + properties: + start: + type: string + end: + type: string + condition: + type: object + required: + - operator + - threshold + - metric + properties: + operator: + type: string + enum: [">=",">","=","==","<=","<","ge","gt","eq","le","lt"] + threshold: + type: number + metric: + type: string + evalSpec: + type: object + required: + - workerSpec + properties: + workerSpec: + type: object + required: + - scriptDir + - scriptBootFile + - frameworkType + - frameworkVersion + properties: + scriptDir: + type: string + scriptBootFile: + type: string + frameworkType: + type: string + frameworkVersion: + type: string + parameters: + type: array + items: + type: object + required: + - key + - value + properties: + key: + type: string + value: + type: string + deploySpec: + type: object + required: + - model + - trigger + - nodeName + - workerSpec + - hardExampleMining + properties: + model: + type: object + required: + - name + properties: + name: + type: string + nodeName: + type: string + hardExampleMining: + type: object + required: + - name + properties: + name: + type: string + workerSpec: + type: object + required: + - scriptDir + - scriptBootFile + - frameworkType + - frameworkVersion + properties: + scriptDir: + type: string + scriptBootFile: + type: string + frameworkType: + type: string + frameworkVersion: + type: string + parameters: + type: array + items: + type: object + required: + - key + - value + properties: + key: + type: string + value: + type: string + + trigger: + type: object + properties: + checkPeriodSeconds: + type: integer + timer: + type: object + required: + - start + - end + properties: + start: + type: string + end: + type: string + condition: + type: object + required: + - operator + - threshold + - metric + properties: + operator: + type: string + enum: [">=",">","=","==","<=","<","ge","gt","eq","le","lt"] + threshold: + type: number + metric: + type: string + + status: + type: object + properties: + conditions: + type: array + items: + type: object + properties: + type: + type: string + status: + type: string + lastHeartbeatTime: + type: string + format: date-time + lastTransitionTime: + type: string + format: date-time + reason: + type: string + message: + type: string + data: + type: string + stage: + type: string + startTime: + type: string + format: date-time + completionTime: + type: string + format: date-time + active: + type: integer + succeeded: + type: integer + failed: + type: integer + + + additionalPrinterColumns: + - name: stage + type: string + description: The status of the incremental job + jsonPath: ".status.conditions[-1].stage" + - name: status + type: string + description: The status of the incremental job + jsonPath: ".status.conditions[-1].type" + - name: Age + type: date + jsonPath: .metadata.creationTimestamp diff --git a/pkg/apis/neptune/v1alpha1/incrementallearningjob_types.go b/pkg/apis/neptune/v1alpha1/incrementallearningjob_types.go new file mode 100644 index 0000000..5d4ceb1 --- /dev/null +++ b/pkg/apis/neptune/v1alpha1/incrementallearningjob_types.go @@ -0,0 +1,154 @@ +package v1alpha1 + +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// IncrementalLearningJob describes the data that a incrementallearningjob resource should have +type IncrementalLearningJob struct { + metav1.TypeMeta `json:",inline"` + + metav1.ObjectMeta `json:"metadata"` + + Spec ILJobSpec `json:"spec"` + Status ILJobStatus `json:"status"` +} + +// ILJobSpec is a description of a incrementallearningjob +type ILJobSpec struct { + Dataset ILDataset `json:"dataset"` + OutputDir string `json:"outputDir"` + NodeName string `json:"nodeName"` + InitialModel InitialModel `json:"initialModel"` + TrainSpec TrainSpec `json:"trainSpec"` + EvalSpec EvalSpec `json:"evalSpec"` + DeploySpec DeploySpec `json:"deploySpec"` +} + +// TrainSpec describes the data an train worker should have +type TrainSpec struct { + WorkerSpec CommonWorkerSpec `json:"workerSpec"` + Trigger Trigger `json:"trigger"` +} + +// EvalSpec describes the data an eval worker should have +type EvalSpec struct { + WorkerSpec CommonWorkerSpec `json:"workerSpec"` +} + +// DeploySpec describes the deploy model to be updated +type DeploySpec struct { + Model DeployModel `json:"model"` + Trigger Trigger `json:"trigger"` + NodeName string `json:"nodeName"` + WorkerSpec CommonWorkerSpec `json:"workerSpec"` + HardExampleMining HardExampleMining `json:"hardExampleMining"` +} + +type Trigger struct { + CheckPeriodSeconds int `json:"checkPeriodSeconds,omitempty"` + Timer *Timer `json:"timer,omitempty"` + Condition Condition `json:"condition"` +} + +type Timer struct { + Start string `json:"start"` + End string `json:"end"` +} + +type Condition struct { + Operator string `json:"operator"` + Threshold float64 `json:"threshold"` + Metric string `json:"metric"` +} + +type ILDataset struct { + Name string `json:"name"` + TrainProb float64 `json:"trainProb"` +} + +type InitialModel struct { + Name string `json:"name"` +} + +type DeployModel struct { + Name string `json:"name"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// IncrementalLearningJobList is a list of IncrementalLearningJobs. +type IncrementalLearningJobList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + Items []IncrementalLearningJob `json:"items"` +} + +// ILJobStatus represents the current state of a incrementallearning job +type ILJobStatus struct { + // The latest available observations of a incrementllearning job's current state. + // +optional + Conditions []ILJobCondition `json:"conditions,omitempty"` + + // Represents time when the job was acknowledged by the job controller. + // It is not guaranteed to be set in happens-before order across separate operations. + // It is represented in RFC3339 form and is in UTC. + // +optional + StartTime *metav1.Time `json:"startTime,omitempty"` + + // Represents time when the job was completed. It is not guaranteed to + // be set in happens-before order across separate operations. + // It is represented in RFC3339 form and is in UTC. + // +optional + CompletionTime *metav1.Time `json:"completionTime,omitempty"` +} + +type ILJobStageConditionType string + +// These are valid stage conditions of a job. +const ( + ILJobStageCondWaiting ILJobStageConditionType = "Waiting" + ILJobStageCondReady ILJobStageConditionType = "Ready" + ILJobStageCondStarting ILJobStageConditionType = "Starting" + ILJobStageCondRunning ILJobStageConditionType = "Running" + ILJobStageCondCompleted ILJobStageConditionType = "Completed" + ILJobStageCondFailed ILJobStageConditionType = "Failed" +) + +// ILJobCondition describes current state of a job. +// see https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties for details. +type ILJobCondition struct { + // Type of job condition, Complete or Failed. + Type ILJobStageConditionType `json:"type"` + // Status of the condition, one of True, False, Unknown. + Status v1.ConditionStatus `json:"status"` + // Stage of the condition + Stage ILJobStage `json:"stage"` + // last time we got an update on a given condition + // +optional + LastHeartbeatTime metav1.Time `json:"lastHeartbeatTime,omitempty"` + // Last time the condition transit from one status to another. + // +optional + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` + // (brief) reason for the condition's last transition. + // +optional + Reason string `json:"reason,omitempty"` + // Human readable message indicating details about last transition. + // +optional + Message string `json:"message,omitempty"` + // The json data related to this condition + // +optional + Data string `json:"data,omitempty"` +} + +// ILJobStage is a label for the stage of a job at the current time. +type ILJobStage string + +const ( + ILJobTrain ILJobStage = "Train" + ILJobEval ILJobStage = "Eval" + ILJobDeploy ILJobStage = "Deploy" +) diff --git a/pkg/apis/neptune/v1alpha1/model_types.go b/pkg/apis/neptune/v1alpha1/model_types.go index 3b5ac00..af7ce53 100644 --- a/pkg/apis/neptune/v1alpha1/model_types.go +++ b/pkg/apis/neptune/v1alpha1/model_types.go @@ -19,8 +19,8 @@ type Model struct { // ModelSpec is a description of a model type ModelSpec struct { - ModelURL string `json:"url"` - Format string `json:"format"` + URL string `json:"url"` + Format string `json:"format"` } // ModelStatus represents information about the status of a model diff --git a/pkg/apis/neptune/v1alpha1/register.go b/pkg/apis/neptune/v1alpha1/register.go index 91b3f0f..d8536b7 100644 --- a/pkg/apis/neptune/v1alpha1/register.go +++ b/pkg/apis/neptune/v1alpha1/register.go @@ -39,6 +39,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &JointInferenceServiceList{}, &FederatedLearningJob{}, &FederatedLearningJobList{}, + &IncrementalLearningJob{}, + &IncrementalLearningJobList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil diff --git a/pkg/apis/neptune/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/neptune/v1alpha1/zz_generated.deepcopy.go index 2817aad..ad4cc23 100644 --- a/pkg/apis/neptune/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/neptune/v1alpha1/zz_generated.deepcopy.go @@ -98,6 +98,22 @@ func (in *CommonWorkerSpec) DeepCopy() *CommonWorkerSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Condition) DeepCopyInto(out *Condition) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition. +func (in *Condition) DeepCopy() *Condition { + if in == nil { + return nil + } + out := new(Condition) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Dataset) DeepCopyInto(out *Dataset) { *out = *in @@ -195,6 +211,42 @@ func (in *DatasetStatus) DeepCopy() *DatasetStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployModel) DeepCopyInto(out *DeployModel) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployModel. +func (in *DeployModel) DeepCopy() *DeployModel { + if in == nil { + return nil + } + out := new(DeployModel) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeploySpec) DeepCopyInto(out *DeploySpec) { + *out = *in + out.Model = in.Model + in.Trigger.DeepCopyInto(&out.Trigger) + in.WorkerSpec.DeepCopyInto(&out.WorkerSpec) + in.HardExampleMining.DeepCopyInto(&out.HardExampleMining) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploySpec. +func (in *DeploySpec) DeepCopy() *DeploySpec { + if in == nil { + return nil + } + out := new(DeploySpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *EdgeWorker) DeepCopyInto(out *EdgeWorker) { *out = *in @@ -214,6 +266,23 @@ func (in *EdgeWorker) DeepCopy() *EdgeWorker { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EvalSpec) DeepCopyInto(out *EvalSpec) { + *out = *in + in.WorkerSpec.DeepCopyInto(&out.WorkerSpec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EvalSpec. +func (in *EvalSpec) DeepCopy() *EvalSpec { + if in == nil { + return nil + } + out := new(EvalSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *FLJobCondition) DeepCopyInto(out *FLJobCondition) { *out = *in @@ -369,6 +438,169 @@ func (in *HardExampleMining) DeepCopy() *HardExampleMining { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ILDataset) DeepCopyInto(out *ILDataset) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ILDataset. +func (in *ILDataset) DeepCopy() *ILDataset { + if in == nil { + return nil + } + out := new(ILDataset) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ILJobCondition) DeepCopyInto(out *ILJobCondition) { + *out = *in + in.LastHeartbeatTime.DeepCopyInto(&out.LastHeartbeatTime) + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ILJobCondition. +func (in *ILJobCondition) DeepCopy() *ILJobCondition { + if in == nil { + return nil + } + out := new(ILJobCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ILJobSpec) DeepCopyInto(out *ILJobSpec) { + *out = *in + out.Dataset = in.Dataset + out.InitialModel = in.InitialModel + in.TrainSpec.DeepCopyInto(&out.TrainSpec) + in.EvalSpec.DeepCopyInto(&out.EvalSpec) + in.DeploySpec.DeepCopyInto(&out.DeploySpec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ILJobSpec. +func (in *ILJobSpec) DeepCopy() *ILJobSpec { + if in == nil { + return nil + } + out := new(ILJobSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ILJobStatus) DeepCopyInto(out *ILJobStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]ILJobCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.StartTime != nil { + in, out := &in.StartTime, &out.StartTime + *out = (*in).DeepCopy() + } + if in.CompletionTime != nil { + in, out := &in.CompletionTime, &out.CompletionTime + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ILJobStatus. +func (in *ILJobStatus) DeepCopy() *ILJobStatus { + if in == nil { + return nil + } + out := new(ILJobStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IncrementalLearningJob) DeepCopyInto(out *IncrementalLearningJob) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IncrementalLearningJob. +func (in *IncrementalLearningJob) DeepCopy() *IncrementalLearningJob { + if in == nil { + return nil + } + out := new(IncrementalLearningJob) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *IncrementalLearningJob) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IncrementalLearningJobList) DeepCopyInto(out *IncrementalLearningJobList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]IncrementalLearningJob, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IncrementalLearningJobList. +func (in *IncrementalLearningJobList) DeepCopy() *IncrementalLearningJobList { + if in == nil { + return nil + } + out := new(IncrementalLearningJobList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *IncrementalLearningJobList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InitialModel) DeepCopyInto(out *InitialModel) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InitialModel. +func (in *InitialModel) DeepCopy() *InitialModel { + if in == nil { + return nil + } + out := new(InitialModel) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *JointInferenceService) DeepCopyInto(out *JointInferenceService) { *out = *in @@ -648,6 +880,40 @@ func (in *SmallModel) DeepCopy() *SmallModel { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Timer) DeepCopyInto(out *Timer) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Timer. +func (in *Timer) DeepCopy() *Timer { + if in == nil { + return nil + } + out := new(Timer) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TrainSpec) DeepCopyInto(out *TrainSpec) { + *out = *in + in.WorkerSpec.DeepCopyInto(&out.WorkerSpec) + in.Trigger.DeepCopyInto(&out.Trigger) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrainSpec. +func (in *TrainSpec) DeepCopy() *TrainSpec { + if in == nil { + return nil + } + out := new(TrainSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TrainingWorker) DeepCopyInto(out *TrainingWorker) { *out = *in @@ -682,3 +948,25 @@ func (in *TrainingWorkerSpec) DeepCopy() *TrainingWorkerSpec { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Trigger) DeepCopyInto(out *Trigger) { + *out = *in + if in.Timer != nil { + in, out := &in.Timer, &out.Timer + *out = new(Timer) + **out = **in + } + out.Condition = in.Condition + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Trigger. +func (in *Trigger) DeepCopy() *Trigger { + if in == nil { + return nil + } + out := new(Trigger) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/client/clientset/versioned/typed/neptune/v1alpha1/fake/fake_incrementallearningjob.go b/pkg/client/clientset/versioned/typed/neptune/v1alpha1/fake/fake_incrementallearningjob.go new file mode 100644 index 0000000..988441d --- /dev/null +++ b/pkg/client/clientset/versioned/typed/neptune/v1alpha1/fake/fake_incrementallearningjob.go @@ -0,0 +1,126 @@ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1alpha1 "github.com/edgeai-neptune/neptune/pkg/apis/neptune/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeIncrementalLearningJobs implements IncrementalLearningJobInterface +type FakeIncrementalLearningJobs struct { + Fake *FakeNeptuneV1alpha1 + ns string +} + +var incrementallearningjobsResource = schema.GroupVersionResource{Group: "neptune.io", Version: "v1alpha1", Resource: "incrementallearningjobs"} + +var incrementallearningjobsKind = schema.GroupVersionKind{Group: "neptune.io", Version: "v1alpha1", Kind: "IncrementalLearningJob"} + +// Get takes name of the incrementalLearningJob, and returns the corresponding incrementalLearningJob object, and an error if there is any. +func (c *FakeIncrementalLearningJobs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.IncrementalLearningJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(incrementallearningjobsResource, c.ns, name), &v1alpha1.IncrementalLearningJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.IncrementalLearningJob), err +} + +// List takes label and field selectors, and returns the list of IncrementalLearningJobs that match those selectors. +func (c *FakeIncrementalLearningJobs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.IncrementalLearningJobList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(incrementallearningjobsResource, incrementallearningjobsKind, c.ns, opts), &v1alpha1.IncrementalLearningJobList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.IncrementalLearningJobList{ListMeta: obj.(*v1alpha1.IncrementalLearningJobList).ListMeta} + for _, item := range obj.(*v1alpha1.IncrementalLearningJobList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested incrementalLearningJobs. +func (c *FakeIncrementalLearningJobs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(incrementallearningjobsResource, c.ns, opts)) + +} + +// Create takes the representation of a incrementalLearningJob and creates it. Returns the server's representation of the incrementalLearningJob, and an error, if there is any. +func (c *FakeIncrementalLearningJobs) Create(ctx context.Context, incrementalLearningJob *v1alpha1.IncrementalLearningJob, opts v1.CreateOptions) (result *v1alpha1.IncrementalLearningJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(incrementallearningjobsResource, c.ns, incrementalLearningJob), &v1alpha1.IncrementalLearningJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.IncrementalLearningJob), err +} + +// Update takes the representation of a incrementalLearningJob and updates it. Returns the server's representation of the incrementalLearningJob, and an error, if there is any. +func (c *FakeIncrementalLearningJobs) Update(ctx context.Context, incrementalLearningJob *v1alpha1.IncrementalLearningJob, opts v1.UpdateOptions) (result *v1alpha1.IncrementalLearningJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(incrementallearningjobsResource, c.ns, incrementalLearningJob), &v1alpha1.IncrementalLearningJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.IncrementalLearningJob), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeIncrementalLearningJobs) UpdateStatus(ctx context.Context, incrementalLearningJob *v1alpha1.IncrementalLearningJob, opts v1.UpdateOptions) (*v1alpha1.IncrementalLearningJob, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(incrementallearningjobsResource, "status", c.ns, incrementalLearningJob), &v1alpha1.IncrementalLearningJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.IncrementalLearningJob), err +} + +// Delete takes name of the incrementalLearningJob and deletes it. Returns an error if one occurs. +func (c *FakeIncrementalLearningJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(incrementallearningjobsResource, c.ns, name), &v1alpha1.IncrementalLearningJob{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeIncrementalLearningJobs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(incrementallearningjobsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.IncrementalLearningJobList{}) + return err +} + +// Patch applies the patch and returns the patched incrementalLearningJob. +func (c *FakeIncrementalLearningJobs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IncrementalLearningJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(incrementallearningjobsResource, c.ns, name, pt, data, subresources...), &v1alpha1.IncrementalLearningJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.IncrementalLearningJob), err +} diff --git a/pkg/client/clientset/versioned/typed/neptune/v1alpha1/fake/fake_neptune_client.go b/pkg/client/clientset/versioned/typed/neptune/v1alpha1/fake/fake_neptune_client.go index 7b0e435..be11ad6 100644 --- a/pkg/client/clientset/versioned/typed/neptune/v1alpha1/fake/fake_neptune_client.go +++ b/pkg/client/clientset/versioned/typed/neptune/v1alpha1/fake/fake_neptune_client.go @@ -20,6 +20,10 @@ func (c *FakeNeptuneV1alpha1) FederatedLearningJobs(namespace string) v1alpha1.F return &FakeFederatedLearningJobs{c, namespace} } +func (c *FakeNeptuneV1alpha1) IncrementalLearningJobs(namespace string) v1alpha1.IncrementalLearningJobInterface { + return &FakeIncrementalLearningJobs{c, namespace} +} + func (c *FakeNeptuneV1alpha1) JointInferenceServices(namespace string) v1alpha1.JointInferenceServiceInterface { return &FakeJointInferenceServices{c, namespace} } diff --git a/pkg/client/clientset/versioned/typed/neptune/v1alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/neptune/v1alpha1/generated_expansion.go index 205e98c..c9e59e1 100644 --- a/pkg/client/clientset/versioned/typed/neptune/v1alpha1/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/neptune/v1alpha1/generated_expansion.go @@ -6,6 +6,8 @@ type DatasetExpansion interface{} type FederatedLearningJobExpansion interface{} +type IncrementalLearningJobExpansion interface{} + type JointInferenceServiceExpansion interface{} type ModelExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/neptune/v1alpha1/incrementallearningjob.go b/pkg/client/clientset/versioned/typed/neptune/v1alpha1/incrementallearningjob.go new file mode 100644 index 0000000..daccfb2 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/neptune/v1alpha1/incrementallearningjob.go @@ -0,0 +1,179 @@ +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + "time" + + v1alpha1 "github.com/edgeai-neptune/neptune/pkg/apis/neptune/v1alpha1" + scheme "github.com/edgeai-neptune/neptune/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// IncrementalLearningJobsGetter has a method to return a IncrementalLearningJobInterface. +// A group's client should implement this interface. +type IncrementalLearningJobsGetter interface { + IncrementalLearningJobs(namespace string) IncrementalLearningJobInterface +} + +// IncrementalLearningJobInterface has methods to work with IncrementalLearningJob resources. +type IncrementalLearningJobInterface interface { + Create(ctx context.Context, incrementalLearningJob *v1alpha1.IncrementalLearningJob, opts v1.CreateOptions) (*v1alpha1.IncrementalLearningJob, error) + Update(ctx context.Context, incrementalLearningJob *v1alpha1.IncrementalLearningJob, opts v1.UpdateOptions) (*v1alpha1.IncrementalLearningJob, error) + UpdateStatus(ctx context.Context, incrementalLearningJob *v1alpha1.IncrementalLearningJob, opts v1.UpdateOptions) (*v1alpha1.IncrementalLearningJob, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.IncrementalLearningJob, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.IncrementalLearningJobList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IncrementalLearningJob, err error) + IncrementalLearningJobExpansion +} + +// incrementalLearningJobs implements IncrementalLearningJobInterface +type incrementalLearningJobs struct { + client rest.Interface + ns string +} + +// newIncrementalLearningJobs returns a IncrementalLearningJobs +func newIncrementalLearningJobs(c *NeptuneV1alpha1Client, namespace string) *incrementalLearningJobs { + return &incrementalLearningJobs{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the incrementalLearningJob, and returns the corresponding incrementalLearningJob object, and an error if there is any. +func (c *incrementalLearningJobs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.IncrementalLearningJob, err error) { + result = &v1alpha1.IncrementalLearningJob{} + err = c.client.Get(). + Namespace(c.ns). + Resource("incrementallearningjobs"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of IncrementalLearningJobs that match those selectors. +func (c *incrementalLearningJobs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.IncrementalLearningJobList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.IncrementalLearningJobList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("incrementallearningjobs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested incrementalLearningJobs. +func (c *incrementalLearningJobs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("incrementallearningjobs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a incrementalLearningJob and creates it. Returns the server's representation of the incrementalLearningJob, and an error, if there is any. +func (c *incrementalLearningJobs) Create(ctx context.Context, incrementalLearningJob *v1alpha1.IncrementalLearningJob, opts v1.CreateOptions) (result *v1alpha1.IncrementalLearningJob, err error) { + result = &v1alpha1.IncrementalLearningJob{} + err = c.client.Post(). + Namespace(c.ns). + Resource("incrementallearningjobs"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(incrementalLearningJob). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a incrementalLearningJob and updates it. Returns the server's representation of the incrementalLearningJob, and an error, if there is any. +func (c *incrementalLearningJobs) Update(ctx context.Context, incrementalLearningJob *v1alpha1.IncrementalLearningJob, opts v1.UpdateOptions) (result *v1alpha1.IncrementalLearningJob, err error) { + result = &v1alpha1.IncrementalLearningJob{} + err = c.client.Put(). + Namespace(c.ns). + Resource("incrementallearningjobs"). + Name(incrementalLearningJob.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(incrementalLearningJob). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *incrementalLearningJobs) UpdateStatus(ctx context.Context, incrementalLearningJob *v1alpha1.IncrementalLearningJob, opts v1.UpdateOptions) (result *v1alpha1.IncrementalLearningJob, err error) { + result = &v1alpha1.IncrementalLearningJob{} + err = c.client.Put(). + Namespace(c.ns). + Resource("incrementallearningjobs"). + Name(incrementalLearningJob.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(incrementalLearningJob). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the incrementalLearningJob and deletes it. Returns an error if one occurs. +func (c *incrementalLearningJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("incrementallearningjobs"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *incrementalLearningJobs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("incrementallearningjobs"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched incrementalLearningJob. +func (c *incrementalLearningJobs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IncrementalLearningJob, err error) { + result = &v1alpha1.IncrementalLearningJob{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("incrementallearningjobs"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/neptune/v1alpha1/neptune_client.go b/pkg/client/clientset/versioned/typed/neptune/v1alpha1/neptune_client.go index b44895c..d31623f 100644 --- a/pkg/client/clientset/versioned/typed/neptune/v1alpha1/neptune_client.go +++ b/pkg/client/clientset/versioned/typed/neptune/v1alpha1/neptune_client.go @@ -12,6 +12,7 @@ type NeptuneV1alpha1Interface interface { RESTClient() rest.Interface DatasetsGetter FederatedLearningJobsGetter + IncrementalLearningJobsGetter JointInferenceServicesGetter ModelsGetter } @@ -29,6 +30,10 @@ func (c *NeptuneV1alpha1Client) FederatedLearningJobs(namespace string) Federate return newFederatedLearningJobs(c, namespace) } +func (c *NeptuneV1alpha1Client) IncrementalLearningJobs(namespace string) IncrementalLearningJobInterface { + return newIncrementalLearningJobs(c, namespace) +} + func (c *NeptuneV1alpha1Client) JointInferenceServices(namespace string) JointInferenceServiceInterface { return newJointInferenceServices(c, namespace) } diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 38bb8fe..000d1dd 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -41,6 +41,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Neptune().V1alpha1().Datasets().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("federatedlearningjobs"): return &genericInformer{resource: resource.GroupResource(), informer: f.Neptune().V1alpha1().FederatedLearningJobs().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("incrementallearningjobs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Neptune().V1alpha1().IncrementalLearningJobs().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("jointinferenceservices"): return &genericInformer{resource: resource.GroupResource(), informer: f.Neptune().V1alpha1().JointInferenceServices().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("models"): diff --git a/pkg/client/informers/externalversions/neptune/v1alpha1/incrementallearningjob.go b/pkg/client/informers/externalversions/neptune/v1alpha1/incrementallearningjob.go new file mode 100644 index 0000000..672079b --- /dev/null +++ b/pkg/client/informers/externalversions/neptune/v1alpha1/incrementallearningjob.go @@ -0,0 +1,74 @@ +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + neptunev1alpha1 "github.com/edgeai-neptune/neptune/pkg/apis/neptune/v1alpha1" + versioned "github.com/edgeai-neptune/neptune/pkg/client/clientset/versioned" + internalinterfaces "github.com/edgeai-neptune/neptune/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/edgeai-neptune/neptune/pkg/client/listers/neptune/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// IncrementalLearningJobInformer provides access to a shared informer and lister for +// IncrementalLearningJobs. +type IncrementalLearningJobInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.IncrementalLearningJobLister +} + +type incrementalLearningJobInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewIncrementalLearningJobInformer constructs a new informer for IncrementalLearningJob type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIncrementalLearningJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredIncrementalLearningJobInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredIncrementalLearningJobInformer constructs a new informer for IncrementalLearningJob type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredIncrementalLearningJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NeptuneV1alpha1().IncrementalLearningJobs(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NeptuneV1alpha1().IncrementalLearningJobs(namespace).Watch(context.TODO(), options) + }, + }, + &neptunev1alpha1.IncrementalLearningJob{}, + resyncPeriod, + indexers, + ) +} + +func (f *incrementalLearningJobInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredIncrementalLearningJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *incrementalLearningJobInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&neptunev1alpha1.IncrementalLearningJob{}, f.defaultInformer) +} + +func (f *incrementalLearningJobInformer) Lister() v1alpha1.IncrementalLearningJobLister { + return v1alpha1.NewIncrementalLearningJobLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/neptune/v1alpha1/interface.go b/pkg/client/informers/externalversions/neptune/v1alpha1/interface.go index 24c86c5..0e36d93 100644 --- a/pkg/client/informers/externalversions/neptune/v1alpha1/interface.go +++ b/pkg/client/informers/externalversions/neptune/v1alpha1/interface.go @@ -12,6 +12,8 @@ type Interface interface { Datasets() DatasetInformer // FederatedLearningJobs returns a FederatedLearningJobInformer. FederatedLearningJobs() FederatedLearningJobInformer + // IncrementalLearningJobs returns a IncrementalLearningJobInformer. + IncrementalLearningJobs() IncrementalLearningJobInformer // JointInferenceServices returns a JointInferenceServiceInformer. JointInferenceServices() JointInferenceServiceInformer // Models returns a ModelInformer. @@ -39,6 +41,11 @@ func (v *version) FederatedLearningJobs() FederatedLearningJobInformer { return &federatedLearningJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } +// IncrementalLearningJobs returns a IncrementalLearningJobInformer. +func (v *version) IncrementalLearningJobs() IncrementalLearningJobInformer { + return &incrementalLearningJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + // JointInferenceServices returns a JointInferenceServiceInformer. func (v *version) JointInferenceServices() JointInferenceServiceInformer { return &jointInferenceServiceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/pkg/client/listers/neptune/v1alpha1/expansion_generated.go b/pkg/client/listers/neptune/v1alpha1/expansion_generated.go index 2d77eb7..d250b6f 100644 --- a/pkg/client/listers/neptune/v1alpha1/expansion_generated.go +++ b/pkg/client/listers/neptune/v1alpha1/expansion_generated.go @@ -18,6 +18,14 @@ type FederatedLearningJobListerExpansion interface{} // FederatedLearningJobNamespaceLister. type FederatedLearningJobNamespaceListerExpansion interface{} +// IncrementalLearningJobListerExpansion allows custom methods to be added to +// IncrementalLearningJobLister. +type IncrementalLearningJobListerExpansion interface{} + +// IncrementalLearningJobNamespaceListerExpansion allows custom methods to be added to +// IncrementalLearningJobNamespaceLister. +type IncrementalLearningJobNamespaceListerExpansion interface{} + // JointInferenceServiceListerExpansion allows custom methods to be added to // JointInferenceServiceLister. type JointInferenceServiceListerExpansion interface{} diff --git a/pkg/client/listers/neptune/v1alpha1/incrementallearningjob.go b/pkg/client/listers/neptune/v1alpha1/incrementallearningjob.go new file mode 100644 index 0000000..8a0fbaa --- /dev/null +++ b/pkg/client/listers/neptune/v1alpha1/incrementallearningjob.go @@ -0,0 +1,83 @@ +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/edgeai-neptune/neptune/pkg/apis/neptune/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// IncrementalLearningJobLister helps list IncrementalLearningJobs. +// All objects returned here must be treated as read-only. +type IncrementalLearningJobLister interface { + // List lists all IncrementalLearningJobs in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.IncrementalLearningJob, err error) + // IncrementalLearningJobs returns an object that can list and get IncrementalLearningJobs. + IncrementalLearningJobs(namespace string) IncrementalLearningJobNamespaceLister + IncrementalLearningJobListerExpansion +} + +// incrementalLearningJobLister implements the IncrementalLearningJobLister interface. +type incrementalLearningJobLister struct { + indexer cache.Indexer +} + +// NewIncrementalLearningJobLister returns a new IncrementalLearningJobLister. +func NewIncrementalLearningJobLister(indexer cache.Indexer) IncrementalLearningJobLister { + return &incrementalLearningJobLister{indexer: indexer} +} + +// List lists all IncrementalLearningJobs in the indexer. +func (s *incrementalLearningJobLister) List(selector labels.Selector) (ret []*v1alpha1.IncrementalLearningJob, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.IncrementalLearningJob)) + }) + return ret, err +} + +// IncrementalLearningJobs returns an object that can list and get IncrementalLearningJobs. +func (s *incrementalLearningJobLister) IncrementalLearningJobs(namespace string) IncrementalLearningJobNamespaceLister { + return incrementalLearningJobNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// IncrementalLearningJobNamespaceLister helps list and get IncrementalLearningJobs. +// All objects returned here must be treated as read-only. +type IncrementalLearningJobNamespaceLister interface { + // List lists all IncrementalLearningJobs in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.IncrementalLearningJob, err error) + // Get retrieves the IncrementalLearningJob from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.IncrementalLearningJob, error) + IncrementalLearningJobNamespaceListerExpansion +} + +// incrementalLearningJobNamespaceLister implements the IncrementalLearningJobNamespaceLister +// interface. +type incrementalLearningJobNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all IncrementalLearningJobs in the indexer for a given namespace. +func (s incrementalLearningJobNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.IncrementalLearningJob, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.IncrementalLearningJob)) + }) + return ret, err +} + +// Get retrieves the IncrementalLearningJob from the indexer for a given namespace and name. +func (s incrementalLearningJobNamespaceLister) Get(name string) (*v1alpha1.IncrementalLearningJob, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("incrementallearningjob"), name) + } + return obj.(*v1alpha1.IncrementalLearningJob), nil +} diff --git a/pkg/globalmanager/federatedlearningjob.go b/pkg/globalmanager/federatedlearningjob.go index a2e43af..197970c 100644 --- a/pkg/globalmanager/federatedlearningjob.go +++ b/pkg/globalmanager/federatedlearningjob.go @@ -398,7 +398,7 @@ func (fc *FederatedController) createPod(job *neptunev1.FederatedLearningJob) (a return active, fmt.Errorf("failed to get model %s: %w", modelName, err) } - modelPath := model.Spec.ModelURL + modelPath := model.Spec.URL participantsCount := strconv.Itoa(len(job.Spec.TrainingWorkers)) // convert crd to json, and put them into env of container diff --git a/pkg/globalmanager/jointinferenceservice.go b/pkg/globalmanager/jointinferenceservice.go index a9800b3..8acc968 100644 --- a/pkg/globalmanager/jointinferenceservice.go +++ b/pkg/globalmanager/jointinferenceservice.go @@ -420,7 +420,7 @@ func (jc *JointInferenceServiceController) createCloudPod(service *neptunev1.Joi cloudModelName, err) } - cloudModelPath = cloudModel.Spec.ModelURL + cloudModelPath = cloudModel.Spec.URL // convert crd to json, and put them into env of container cloudModelJSON, _ := json.Marshal(cloudModel) @@ -471,7 +471,7 @@ func (jc *JointInferenceServiceController) createEdgePod(service *neptunev1.Join return fmt.Errorf("failed to get edge model %s: %w", edgeModelName, err) } - edgeModelPath := edgeModel.Spec.ModelURL + edgeModelPath := edgeModel.Spec.URL // get bigModelIP from nodeName in cloudWorker bigModelIP, err := GetNodeIPByName(jc.kubeClient, service.Spec.CloudWorker.NodeName)