added createDeployTask apis

Former-commit-id: e3e9a463528086432ea8cc0401a76edf249e5983
This commit is contained in:
tzwang 2024-08-29 10:48:17 +08:00
parent cfd0a6e168
commit d0dbb2fe99
7 changed files with 55 additions and 0 deletions

View File

@ -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"`
}
)

View File

@ -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(

View File

@ -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"`
}

View File

@ -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 {

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}