core端删除算法

This commit is contained in:
lee 2023-03-09 17:30:47 +08:00
parent f145b2748a
commit 3b8c75fb2e
5 changed files with 103 additions and 135 deletions

View File

@ -58,8 +58,8 @@ type CreateDataSetResp {
/******************ImportTask start*************************/
type (
ImportTaskDataReq {
ProjectId string `json:"projectId"`
DatasetId string `json:"datasetId"`
ProjectId string `json:"project_id"`
DatasetId string `json:"dataset_id"`
ImportPath string `json:"importPath"`
}
ImportTaskDataResp {
@ -89,8 +89,8 @@ type (
/******************taskList start*************************/
type (
ListImportTasksReq {
ProjectId string `json:"projectId"`
DatasetId string `json:"datasetId"`
ProjectId string `json:"project_id"`
DatasetId string `json:"dataset_id"`
Limit int32 `json:"limit,optional"`
Offset int32 `json:"offset,optional"`
}
@ -100,23 +100,25 @@ type (
}
)
type ImportTasks {
Status string `json:"status,omitempty"`
TaskId string `json:"task_id,omitempty"`
DatasetId string `json:"dataset_id,omitempty"`
ImportPath string `json:"import_path,omitempty"`
ImportType int32 `json:"import_type,omitempty"`
TotalSampleCount uint32 `json:"total_sample_count,omitempty"`
ImportedSampleCount uint32 `json:"imported_sample_count,omitempty"`
AnnotatedSampleCount uint32 `json:"annotated_sample_count,omitempty"`
TotalSubSampleCount uint32 `json:"total_sub_sample_count,omitempty"`
ImportedSubSampleCount uint32 `json:"imported_sub_sample_count,omitempty"`
TotalFileSize uint32 `json:"total_file_size,omitempty"`
FinishedFileCount uint32 `json:"finished_file_count,omitempty"`
FinishedFileSize uint32 `json:"finished_file_size,omitempty"`
TotalFileCount uint32 `json:"total_file_count,omitempty"`
CreateTime uint32 `json:"create_time,omitempty"`
ElapsedTime uint32 `json:"elapsed_time,omitempty"`
AnnotationFormatConfig []interface{} `json:"annotation_format_config"`
Status string `json:"status,optional"`
TaskId string `json:"task_id,optional"`
DatasetId string `json:"dataset_id,optional"`
ImportPath string `json:"import_path,optional"`
ImportType int32 `json:"import_type,optional"`
TotalSampleCount uint32 `json:"total_sample_count,optional"`
ImportedSampleCount uint32 `json:"imported_sample_count,optional"`
AnnotatedSampleCount uint32 `json:"annotated_sample_count,optional"`
TotalSubSampleCount uint32 `json:"total_sub_sample_count,optional"`
ImportedSubSampleCount uint32 `json:"imported_sub_sample_count,optional"`
TotalFileSize uint32 `json:"total_file_size,optional"`
FinishedFileCount uint32 `json:"finished_file_count,optional"`
FinishedFileSize uint32 `json:"finished_file_size,optional"`
TotalFileCount uint32 `json:"total_file_count,optional"`
CreateTime uint64 `json:"create_time,optional"`
ElapsedTime uint32 `json:"elapsed_time,optional"`
AnnotationFormatConfig []Annotation_format_config `json:"annotation_format_config,optional"`
}
type Annotation_format_config {
}
/******************taskList end*************************/
/******************ListTrainingJobs start*************************/
@ -329,6 +331,7 @@ type (
)
/******************DeleteTrainingJob end*************************/
/******************Create Service Start*************************/
type (
CreateServiceReq {
@ -543,7 +546,7 @@ type Cluster {
PeriodType string `json:"period_type,omitempty" copier:"PeriodType"`
OrderId string `json:"order_id,omitempty" copier:"OrderId"`
}
/******************List Clusters End*************************/
/******************List Clusters end*************************/
/******************ListAlgorithms start*************************/
type AlgorithmResponse {
@ -554,23 +557,24 @@ type AlgorithmResponse {
}
type MetadataAlRp {
Id string `json:"id,optional"`
Name string `json:"name,optional"`
Description string `json:"description,optional"`
CreateTime int32 `json:"create_time,optional"`
WorkspaceId string `json:"workspace_id,optional"`
AiProject string `json:"ai_project,optional"`
UserName string `json:"user_name,optional"`
DomainId string `json:"domain_id,optional"`
Source string `json:"source,optional"`
ApiVersion string `json:"api_version,optional"`
IsValid bool `json:"is_valid,optional"`
State string `son:"state,optional"`
Size int32 `json:"size,optional"`
Tags []*TagsAlRp `json:"tags,optional"`
AttrList []string `json:"attr_list,optional"`
VersionNum int32 `json:"version_num,optional"`
UpdateTime int32 `json:"update_time,optional"`
Id string `json:"id,optional"`
Name string `json:"name,optional"`
Description string `json:"description,optional"`
CreateTime uint64 `json:"create_time,optional"`
WorkspaceId string `json:"workspace_id,optional"`
AiProject string `json:"ai_project,optional"`
UserName string `json:"user_name,optional"`
DomainId string `json:"domain_id,optional"`
Source string `json:"source,optional"`
ApiVersion string `json:"api_version,optional"`
IsValid bool `json:"is_valid,optional"`
State string `son:"state,optional"`
Size int32 `json:"size,optional"`
Tags []*TagsAlRp `json:"tags,optional"`
AttrList []string `json:"attr_list,optional"`
VersionNum int32 `json:"version_num,optional"`
UpdateTime uint64 `json:"update_time,optional"`
}
type TagsAlRp {
@ -670,14 +674,14 @@ type SearchParams {
type (
ListAlgorithmsReq {
ProjectId string `json:"project_id"`
Offset int32 `json:"offset,optional"`
Limit int32 `json:"limit,optional"`
SortBy string `json:"sort_by,optional"`
Order string `json:"order,optional"`
GroupBy string `json:"group_by,optional"`
Searches string `json:"searches,optional"`
WorkspaceId string `json:"workspace_id,optional"`
ProjectId string `json:"project_id"`
Offset int32 `json:"offset,optional"`
Limit int32 `json:"limit"`
// SortBy string `json:"sort_by,optional"`
// Order string `json:"order,optional"`
// GroupBy string `json:"group_by,optional"`
// Searches string `json:"searches,optional"`
// WorkspaceId string `json:"workspace_id,optional"`
}
ListAlgorithmsResp {
Total int32 `json:"total,optional"`
@ -689,34 +693,21 @@ type (
}
)
/******************ListAlgorithms End*************************/
/******************ListAlgorithms end*************************/
/******************DeleteAlgorithm Start*************************/
/******************DeleteAlgorithm start*************************/
type (
DeleteAlgorithmReq {
ProjectId string `json:"project_id" copier:"ProjectId"`
AlgorithmId string `json:"algorithm_id" copier:"AlgorithmId"`
}
DeleteAlgorithmResp {
Msg string `json:"msg"`
Code int32 `json:"code"`
}
)
/******************DeleteAlgorithm End*************************/
/******************Show Algorithm By Uuid start*************************/
type (
ShowAlgorithmByUuidReq {
ProjectId string `json:"project_id" copier:"ProjectId"`
AlgorithmId string `json:"algorithm_id" copier:"AlgorithmId"`
}
ShowAlgorithmByUuidResp {
Metadata MetadataAlRq `json:"metadata" copier:"Metadata"`
JobConfig JobConfigAl `json:"job_config" copier:"JobConfig"`
ResourceRequirements []ResourceRequirements `json:"resource_requirements" copier:"ResourceRequirements"`
AdvancedConfig AdvancedConfigAl `json:"advanced_config" copier:"AdvancedConfig"`
}
)
/******************Show Algorithm By Uuid end*************************/
/******************DeleteAlgorithm end*************************/
/******************CreateAlgorithm start*************************/
type MetadataAlRq {
@ -755,7 +746,19 @@ type (
AdvancedConfigCARp AdvancedConfigAl `json:"advanced_config,optional"`
}
)
/******************CreateAlgorithm end*************************/
/******************CreateTrainingJob end*************************/
/******************Delete dataset start*************************/
type DeleteDataSetReq {
DatasetId string `json:"datasetId"`
ProjectId string `json:"projectId"`
}
type DeleteDataSetResp {
}
/******************Delete dataset end*************************/
/******************Notebook Type start*************************/
type (
@ -1034,6 +1037,8 @@ service AICore-api {
get /listDataSet (listDataSetReq) returns (listDataSetResp)
@handler CreateDataSetHandler
post /createDataSet (CreateDataSetReq) returns (CreateDataSetResp)
@handler DeleteDataSetHandler
delete /deleteDataSet (DeleteDataSetReq) returns (DeleteDataSetResp)
// creat task 创建导入任务
@handler CreateTaskHandler
post /CreateTask (ImportTaskDataReq) returns (ImportTaskDataResp)
@ -1055,14 +1060,11 @@ service AICore-api {
// DeleteAlgorithm 删除算法
@handler DeleteAlgorithm
delete /DeleteAlgorithm (DeleteAlgorithmReq) returns (DeleteAlgorithmResp)
// ShowAlgorithmByUuid 展示算法详情
@handler ShowAlgorithmByUuid
get /ShowAlgorithmByUuid (ShowAlgorithmByUuidReq) returns (ShowAlgorithmByUuidResp)
// // CreateTrainingJob 创建训练作业
// @handler CreateTrainingJobHandler
// post /CreateTrainingJob (CreateTrainingJobReq) returns (CreateTrainingJobResp)
// creat export task 创建导任务
// creat export task 创建导任务
@handler CreateExportTaskHandler
post /CreateExportTask (CreateExportTaskReq) returns (CreateExportTaskResp)

View File

@ -38,5 +38,9 @@ func (l *DeleteAlgorithmLogic) DeleteAlgorithm(req *types.DeleteAlgorithmReq) (r
}
resp = &types.DeleteAlgorithmResp{}
err = copier.CopyWithOption(&resp, &DeleteAlgorithmResp, copier.Option{Converters: tool.Converters})
if resp == nil {
resp.Msg = "Success"
resp.Code = 200
}
return resp, nil
}

View File

@ -43,5 +43,8 @@ func (l *DeleteAlgorithmsLogic) DeleteAlgorithms(in *modelarts.DeleteAlgorithmsR
return nil, err
}
json.Unmarshal(body, &resp)
resp.Code = 200
resp.Msg = "success"
return &resp, nil
}

View File

@ -37,55 +37,12 @@ func (l *GetImportTaskListLogic) GetImportTaskList(in *modelarts.ListImportTasks
offset := strconv.Itoa(int(in.Offset))
var resp modelarts.ListImportTasksResp
token := common.GetToken()
//c := http.Client{Timeout: time.Duration(3) * time.Second}
reqUrl, err := tool.HttpClient(tool.GET, "https://modelarts.cn-north-4.myhuaweicloud.com/v2/"+projectId+"/datasets/"+datasetId+"/import-tasks?"+limit+"&"+offset, strings.NewReader(``), token)
reqUrl, err := tool.HttpClient(tool.GET, "https://modelarts.cn-north-4.myhuaweicloud.com/v2/"+projectId+"/datasets/"+datasetId+"/import-tasks?limit="+limit+"&offset="+offset, strings.NewReader(``), token)
json.Unmarshal(reqUrl, &resp)
//reqUrl.Header.Add("X-Auth-Token", token)
//reqUrl.Header.Add("User-Agent", "API Explorer")
//reqUrl.Header.Add("Content-Type", "application/json;charset=UTF-8")
//respUrl, err := c.Do(reqUrl)
if err != nil {
log.Fatal(err)
}
//defer respUrl.Body.Close()
//body, err := ioutil.ReadAll(respUrl.Body)
//jsonResult, err := simplejson.NewJson(body)
//if jsonResult.Get("total_count").MustInt() == 0 {
// resp.TotalCount = 0
// resp.ImportTasks = nil
// return &resp, nil
//}
//var Jobs []*modelarts.ImportTasks
//taskList := jsonResult.Get("import_tasks")
//rows, err := taskList.Array()
//for index := range rows {
// task := taskList.GetIndex(index)
// var job modelarts.ImportTasks
// var dataSource modelarts.DataSource
// //var demo modelarts.AnnotationFormatConfig
// job.Status = task.Get("status").MustString()
// job.TaskId = task.Get("task_id").MustString()
// job.DatasetId = task.Get("dataset_id").MustString()
// job.ImportPath = task.Get("import_path").MustString()
// job.ImportType = int32(task.Get("import_type").MustInt())
// job.TotalSampleCount = uint32(task.Get("total_sample_count").MustInt())
// job.ImportedSampleCount = uint32(task.Get("imported_sample_count").MustInt())
// job.AnnotatedSampleCount = uint32(task.Get("annotated_sample_count").MustInt())
// job.CreateTime = uint32(task.Get("annotated_sample_count").MustInt())
// job.ElapsedTime = uint32(task.Get("elapsed_time").MustInt())
// dataList := task.Get("data_source")
// dataSource.DataType = int32(dataList.Get("data_type").MustInt())
// dataSource.DataPath = dataList.Get("data_path").MustString()
// if err != nil {
// log.Fatal(err)
// }
// job.DataSource = &dataSource
// Jobs = append(Jobs, &job)
//}
//
//resp.TotalCount = uint32(jsonResult.Get("total_count").MustInt())
//resp.ImportTasks = Jobs
return &resp, nil
}

View File

@ -93,44 +93,44 @@ message ImportTaskDataResp{
/******************ListImportTasks Start*************************/
//
message ListImportTasksReq{
string dataset_id = 1; // @gotags: copier:"Dataset_id"
string project_id = 2; // @gotags: copier:"Project_id"
string dataset_id = 1; // @gotags: copier:"DatasetId"
string project_id = 2; // @gotags: copier:"ProjectId"
int32 limit = 3; // @gotags: copier:"Limit"
int32 offset = 4; // @gotags: copier:"Offset"
}
message ListImportTasksResp{
uint32 total_count = 1; //@gotags: copier:"Total_count"
repeated Import_tasks import_tasks = 2; //@gotags: copier:"Import_tasks"
uint32 total_count = 1; //@gotags: copier:"TotalCount"
repeated Import_tasks import_tasks = 2; //@gotags: copier:"ImportTasks"
}
message Import_tasks{
uint32 annotated_sample_count = 1; //@gotags: copier:"Annotated_sample_count"
uint32 create_time = 2; //@gotags: copier:"Create_time"
string dataset_id = 3; //@gotags: copier:"Dataset_id"
uint32 elapsed_time = 4; //@gotags: copier:"Elapsed_time"
uint32 annotated_sample_count = 1; //@gotags: copier:"AnnotatedSampleCount"
uint64 create_time = 2; //@gotags: copier:"CreateTime"
string dataset_id = 3; //@gotags: copier:"DatasetId"
uint32 elapsed_time = 4; //@gotags: copier:"ElapsedTime"
string error_code = 5; //@gotags: copier:"Error_code"
string error_msg = 6; //@gotags: copier:"Error_msg"
uint32 finished_file_count = 7; //@gotags: copier:"Finished_file_count"
uint32 finished_file_size = 8; //@gotags: copier:"Finished_file_size"
string import_path = 9; //@gotags: copier:"Import_path"
int32 import_type = 10; //@gotags: copier:"Import_type"
uint32 imported_sample_count = 11; //@gotags: copier:"Imported_sample_count"
uint32 imported_sub_sample_count = 12; //@gotags: copier:"Imported_sub_sample_count"
uint32 finished_file_count = 7; //@gotags: copier:"FinishedFileCount"
uint32 finished_file_size = 8; //@gotags: copier:"FinishedFileSize"
string import_path = 9; //@gotags: copier:"ImportPath"
int32 import_type = 10; //@gotags: copier:"ImportType"
uint32 imported_sample_count = 11; //@gotags: copier:"ImportedSampleCount"
uint32 imported_sub_sample_count = 12; //@gotags: copier:"ImportedSubSampleCount"
string processor_task_id = 13; //@gotags: copier:"Processor_task_id"
int32 processor_task_status = 14; //@gotags: copier:"Processor_task_status"
string status = 15; //@gotags: copier:"Status"
string task_id = 16; //@gotags: copier:"Task_id"
uint32 total_file_count = 17; //@gotags: copier:"Total_file_count"
uint32 total_file_size = 18; //@gotags: copier:"Total_file_size"
uint32 total_sample_count = 19; //@gotags: copier:"Total_sample_count"
uint32 total_sub_sample_count = 20; //@gotags: copier:"Total_sub_sample_count"
string task_id = 16; //@gotags: copier:"TaskId"
uint32 total_file_count = 17; //@gotags: copier:"TotalFileCount"
uint32 total_file_size = 18; //@gotags: copier:"TotalFileSize"
uint32 total_sample_count = 19; //@gotags: copier:"TotalSampleCount"
uint32 total_sub_sample_count = 20; //@gotags: copier:"TotalSubSampleCount"
uint32 unconfirmed_sample_count = 21; //@gotags: copier:"Unconfirmed_sample_count"
uint32 update_ms = 22; //@gotags: copier:"Update_ms"
uint64 update_ms = 22; //@gotags: copier:"Update_ms"
Data_source data_source = 23; //@gotags: copier:"Data_source"
File_statistics file_statistics = 24; //@gotags: copier:"File_statistics"
repeated Annotation_format_config annotation_format_config = 25; //@gotags: copier:"Annotation_format_config"
repeated Annotation_format_config annotation_format_config = 25; //@gotags: copier:"AnnotationFormatConfig"
}
message Annotation_format_config{
@ -841,6 +841,8 @@ message DeleteAlgorithmsReq{
}
message DeleteAlgorithmsResp{
string msg =1; // @gotags: copier:"Msg"
int32 code =2; // @gotags: copier:"Code"
}
/******************Delete Algorithms end*************************/