数据集导入接口提交
This commit is contained in:
parent
35727486b0
commit
fdd6fb6943
|
@ -0,0 +1,49 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/AIComputing/modelarts/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"PCM/adaptor/AIComputing/modelarts/rpc/internal/svc"
|
||||
"PCM/adaptor/AIComputing/modelarts/rpc/modelarts"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateAlgorithmLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewCreateAlgorithmLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateAlgorithmLogic {
|
||||
return &CreateAlgorithmLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// CreateAlgorithm 创建算法
|
||||
func (l *CreateAlgorithmLogic) CreateAlgorithm(in *modelarts.CreateAlgorithmReq) (*modelarts.CreateAlgorithmResp, error) {
|
||||
var resp modelarts.CreateAlgorithmResp
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v2/" + in.ProjectId + "/algorithms"
|
||||
reqByte, err := json.Marshal(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
token := common.GetToken()
|
||||
body, err := tool.HttpClient(tool.POST, url, payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
json.Unmarshal(body, &resp)
|
||||
if &resp == nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
|
@ -542,6 +542,7 @@ message DeleteTrainingJobResp{
|
|||
}
|
||||
/******************DeleteTrainingJob end*************************/
|
||||
|
||||
|
||||
/******************DeleteTrainingJobConfig start*************************/
|
||||
message DeleteTrainingJobConfigReq{
|
||||
string project_id =1;
|
||||
|
@ -554,6 +555,8 @@ message DeleteTrainingJobConfigResp{
|
|||
}
|
||||
|
||||
/******************DeleteTrainingJobConfig end*************************/
|
||||
|
||||
|
||||
/******************ListTrainingJobConfig start*************************/
|
||||
message ListTrainingJobConfigReq{
|
||||
string project_id =1;
|
||||
|
@ -583,9 +586,182 @@ message ConfigResponse{
|
|||
string user_image_url =8;
|
||||
string user_command =9;
|
||||
}
|
||||
|
||||
/******************ListTrainingJobConfig end*************************/
|
||||
|
||||
|
||||
/******************CreateAlgorithm start*************************/
|
||||
message CreateAlgorithmReq{
|
||||
MetadataAlRq metadata = 1;
|
||||
JobConfigAl job_config = 2;
|
||||
repeated ResourceRequirements resource_requirements = 3;
|
||||
AdvancedConfigAl advanced_config = 4;
|
||||
string project_id =5;
|
||||
}
|
||||
message ResourceRequirements{
|
||||
string key=1;
|
||||
repeated string value=2;
|
||||
string operator=3;
|
||||
}
|
||||
|
||||
message AdvancedConfigAl {
|
||||
auto_search auto_search =1;
|
||||
}
|
||||
|
||||
message MetadataAlRq {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string description = 3;
|
||||
string workspace_id = 4;
|
||||
string ai_project = 5;
|
||||
}
|
||||
|
||||
message ConstraintAlRq {
|
||||
string type = 1;
|
||||
bool editable = 2;
|
||||
bool required = 3;
|
||||
bool sensitive = 4;
|
||||
string valid_type = 5;
|
||||
repeated string valid_range= 6;
|
||||
}
|
||||
|
||||
message ParametersAlRq {
|
||||
string name = 1;
|
||||
string description = 2;
|
||||
i18n_description i18n_description = 3;
|
||||
string value = 4;
|
||||
ConstraintAlRq constraint = 5;
|
||||
}
|
||||
|
||||
message InputsAlRq {
|
||||
string name = 1;
|
||||
string description = 2;
|
||||
repeated remote_constraints remote_constraints =3;
|
||||
}
|
||||
|
||||
message remote_constraints{
|
||||
string data_type =1;
|
||||
repeated attributesAlRq attributes=2;
|
||||
}
|
||||
|
||||
message attributesAlRq{
|
||||
map<string,string> attributes =1;
|
||||
}
|
||||
|
||||
message OutputsAl {
|
||||
string name = 1;
|
||||
string description = 2;
|
||||
}
|
||||
|
||||
message EngineAlRq {
|
||||
string engine_id = 1;
|
||||
string engine_name = 2;
|
||||
string engine_version = 3;
|
||||
string image_url =4;
|
||||
}
|
||||
|
||||
message Children {
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message CodeTree {
|
||||
string name = 1;
|
||||
repeated Children children = 2;
|
||||
}
|
||||
|
||||
message JobConfigAl {
|
||||
string code_dir = 1;
|
||||
string boot_file = 2;
|
||||
string command = 3;
|
||||
repeated ParametersAlRq parameters = 4;
|
||||
bool parameters_customization = 5;
|
||||
repeated InputsAlRq inputs = 6;
|
||||
repeated OutputsAl outputs = 7;
|
||||
EngineAlRq engine = 8;
|
||||
}
|
||||
|
||||
|
||||
//出参
|
||||
message CreateAlgorithmResp{
|
||||
MetadataAlRp metadata = 1;
|
||||
ShareInfoAlRp share_info = 2;
|
||||
JobConfigAl job_config = 3;
|
||||
repeated ResourceRequirements resource_requirements= 4;
|
||||
AdvancedConfigAl advanced_config = 5;
|
||||
}
|
||||
message MetadataAlRp {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string description = 3;
|
||||
int32 create_time = 4;
|
||||
string workspace_id = 5;
|
||||
string ai_project = 6;
|
||||
string user_name = 7;
|
||||
string domain_id = 8;
|
||||
string source = 9;
|
||||
string api_version = 10;
|
||||
bool is_valid = 11;
|
||||
string state = 12;
|
||||
int32 size = 13;
|
||||
repeated TagsAlRp tags = 14;
|
||||
repeated string attr_list = 15;
|
||||
int32 version_num = 16;
|
||||
int32 update_time = 17;
|
||||
}
|
||||
message TagsAlRp{
|
||||
map<string,string> tags =1;
|
||||
}
|
||||
|
||||
message ShareInfoAlRp {
|
||||
}
|
||||
|
||||
message ConstraintAlRp {
|
||||
string type = 1;
|
||||
bool editable = 2;
|
||||
bool required = 3;
|
||||
bool sensitive = 4;
|
||||
string valid_type = 5;
|
||||
repeated string valid_range = 6;
|
||||
}
|
||||
|
||||
message ParametersAlRp {
|
||||
string name = 1;
|
||||
string description = 2;
|
||||
i18n_description i18n_description = 3;
|
||||
string value = 4;
|
||||
ConstraintAlRp constraint = 5;
|
||||
}
|
||||
|
||||
|
||||
message InputsAlRp {
|
||||
string name = 1;
|
||||
string access_method = 2;
|
||||
}
|
||||
|
||||
message OutputsAlRp {
|
||||
string name = 1;
|
||||
string access_method = 2;
|
||||
bool prefetch_to_local = 3;
|
||||
}
|
||||
|
||||
message ImageInfo {
|
||||
string cpu_image_url = 1;
|
||||
string gpu_image_url = 2;
|
||||
string image_version = 3;
|
||||
}
|
||||
|
||||
message EngineAlRp {
|
||||
string engine_id = 1;
|
||||
string engine_name = 2;
|
||||
string engine_version = 3;
|
||||
bool v1_compatible = 4;
|
||||
string run_user = 5;
|
||||
ImageInfo image_info = 6;
|
||||
bool image_source = 7;
|
||||
}
|
||||
/******************CreateAlgorithm end*************************/
|
||||
|
||||
|
||||
|
||||
/******************Task(export) Start*************************/
|
||||
message ExportTaskReq{
|
||||
string annotation_format = 1; //标注格式
|
||||
|
@ -1304,6 +1480,8 @@ service ModelArts {
|
|||
rpc DeleteTrainingJobConfig(DeleteTrainingJobConfigReq) returns (DeleteTrainingJobConfigResp);
|
||||
// ListTrainingJobConfig 查询训练作业参数
|
||||
rpc ListTrainingJobConfig(ListTrainingJobConfigReq) returns (ListTrainingJobConfigResp);
|
||||
// CreateAlgorithm 创建算法
|
||||
rpc CreateAlgorithm(CreateAlgorithmReq) returns (CreateAlgorithmResp);
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue