From d0dbb2fe99d03482e7a00cf3e1a22be4338068e5 Mon Sep 17 00:00:00 2001 From: tzwang Date: Thu, 29 Aug 2024 10:48:17 +0800 Subject: [PATCH] added createDeployTask apis Former-commit-id: e3e9a463528086432ea8cc0401a76edf249e5983 --- desc/inference/inference.api | 34 +++++++++++++++++++ desc/pcm.api | 6 ++++ .../inference/deployinstancelistlogic.go | 2 ++ .../scheduler/service/inference/inference.go | 1 + internal/storeLink/modelarts.go | 4 +++ internal/storeLink/octopus.go | 4 +++ internal/storeLink/shuguangai.go | 4 +++ 7 files changed, 55 insertions(+) diff --git a/desc/inference/inference.api b/desc/inference/inference.api index b80d31aa..ec793a70 100644 --- a/desc/inference/inference.api +++ b/desc/inference/inference.api @@ -176,4 +176,38 @@ type ( GetDeployTasksByTypeResp { List interface{} `json:"list"` } + + CreateDeployTaskReq { + TaskName string `form:"taskName"` + TaskDesc string `form:"taskDesc"` + ModelName string `form:"modelName"` + ModelType string `form:"modelType"` + AdapterClusterMap map[string]string `form:"adapterClusterMap"` + } + + CreateDeployTaskResp { + + } + + GetAdaptersByModelReq { + ModelName string `form:"modelName"` + ModelType string `form:"modelType"` + } + + GetAdaptersByModelResp { + Adapters []AdapterAvail `json:"adapters"` + } + + AdapterAvail { + AdapterId string `json:"adapterId"` + AdapterName string `json:"taskName"` + Clusters []ClusterAvail `json:"clusters"` + } + + ClusterAvail { + ClusterId string `json:"clusterId"` + ClusterName string `json:"clusterName"` + } + + ) diff --git a/desc/pcm.api b/desc/pcm.api index 9f068aa7..f075d178 100644 --- a/desc/pcm.api +++ b/desc/pcm.api @@ -971,6 +971,12 @@ service pcm { @handler GetDeployTasksByType get /inference/getDeployTasksByType (GetDeployTasksByTypeReq) returns (GetDeployTasksByTypeResp) + + @handler CreateDeployTask + get /inference/createDeployTask (CreateDeployTaskReq) returns (CreateDeployTaskResp) + + @handler GetAdaptersByModel + get /inference/getAdaptersByModel (GetAdaptersByModelReq) returns (GetAdaptersByModelResp) } @server( diff --git a/internal/logic/inference/deployinstancelistlogic.go b/internal/logic/inference/deployinstancelistlogic.go index 4e4c7c37..dc79c645 100644 --- a/internal/logic/inference/deployinstancelistlogic.go +++ b/internal/logic/inference/deployinstancelistlogic.go @@ -96,6 +96,7 @@ func (l *DeployInstanceListLogic) GenerateDeployTasks(tasklist []*models.AiDeplo deployTask := &DeployTask{ Id: t.Id, Name: t.Name, + Desc: t.Desc, Instances: list, } tasks = append(tasks, deployTask) @@ -106,5 +107,6 @@ func (l *DeployInstanceListLogic) GenerateDeployTasks(tasklist []*models.AiDeplo type DeployTask struct { Id int64 `json:"id,string"` Name string `json:"name,string"` + Desc string `json:"desc,string"` Instances []*models.AiInferDeployInstance `json:"instances,string"` } diff --git a/internal/scheduler/service/inference/inference.go b/internal/scheduler/service/inference/inference.go index 4695ec07..7c60ea2b 100644 --- a/internal/scheduler/service/inference/inference.go +++ b/internal/scheduler/service/inference/inference.go @@ -18,6 +18,7 @@ type ICluster interface { StopInferDeployInstance(ctx context.Context, id string) bool GetInferDeployInstance(ctx context.Context, id string) (*DeployInstance, error) CreateInferDeployInstance(ctx context.Context, option *option.InferOption) (string, error) + CheckModelExistence(ctx context.Context, name string, mtype string) bool } type IInference interface { diff --git a/internal/storeLink/modelarts.go b/internal/storeLink/modelarts.go index 50f96398..d22d9ab7 100644 --- a/internal/storeLink/modelarts.go +++ b/internal/storeLink/modelarts.go @@ -543,3 +543,7 @@ func (m *ModelArtsLink) GetInferResult(ctx context.Context, url string, file mul func (m *ModelArtsLink) CreateInferDeployInstance(ctx context.Context, option *option.InferOption) (string, error) { return "", nil } + +func (m *ModelArtsLink) CheckModelExistence(ctx context.Context, name string, mtype string) bool { + return false +} diff --git a/internal/storeLink/octopus.go b/internal/storeLink/octopus.go index 0b2fc3fd..83c7198e 100644 --- a/internal/storeLink/octopus.go +++ b/internal/storeLink/octopus.go @@ -1251,3 +1251,7 @@ func (o *OctopusLink) CreateInferDeployInstance(ctx context.Context, option *opt return resp.Payload.Id, nil } + +func (o *OctopusLink) CheckModelExistence(ctx context.Context, name string, mtype string) bool { + return false +} diff --git a/internal/storeLink/shuguangai.go b/internal/storeLink/shuguangai.go index a756de3f..7923ef2b 100644 --- a/internal/storeLink/shuguangai.go +++ b/internal/storeLink/shuguangai.go @@ -885,3 +885,7 @@ func (s *ShuguangAi) GetInferResult(ctx context.Context, url string, file multip func (s *ShuguangAi) CreateInferDeployInstance(ctx context.Context, option *option.InferOption) (string, error) { return "", nil } + +func (s *ShuguangAi) CheckModelExistence(ctx context.Context, name string, mtype string) bool { + return false +}