修改deleteTrainingjob rpc
This commit is contained in:
parent
a6c0e5dfbf
commit
988d143d71
|
@ -323,10 +323,13 @@ type (
|
|||
/******************DeleteTrainingJob start*************************/
|
||||
type (
|
||||
DeleteTrainingJobReq {
|
||||
Project_id string `json:"total"`
|
||||
Training_job_id string `json:"total"`
|
||||
Project_id string `json:"project_id"`
|
||||
Training_job_id string `json:"training_job_id"`
|
||||
}
|
||||
DeleteTrainingJobResp {
|
||||
Is_success bool `json:"is_success"`
|
||||
Error_message string `json:"error_message"`
|
||||
Error_code string `json:"error_code"`
|
||||
}
|
||||
)
|
||||
/******************DeleteTrainingJob end*************************/
|
||||
|
@ -359,7 +362,6 @@ type Scheduler {
|
|||
Type string `json:"type,optional" copier:"Type"`
|
||||
}
|
||||
|
||||
|
||||
type ServiceConfig {
|
||||
CustomSpec CustomSpec `json:"customSpec,optional" copier:"CustomSpec"`
|
||||
Envs map[string]string `json:"envs,optional" copier:"Envs"`
|
||||
|
|
|
@ -62,6 +62,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|||
Path: "/DeleteAlgorithm",
|
||||
Handler: DeleteAlgorithmHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/CreateTrainingJob",
|
||||
Handler: CreateTrainingJobHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/CreateExportTask",
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/AIComputing/modelarts/rpc/modelarts"
|
||||
"PCM/common/tool"
|
||||
"PCM/common/xerr"
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"PCM/adaptor/AIComputing/AICore/api/internal/svc"
|
||||
"PCM/adaptor/AIComputing/AICore/api/internal/types"
|
||||
|
@ -24,7 +29,13 @@ func NewDeleteTrainingJobLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
|||
}
|
||||
|
||||
func (l *DeleteTrainingJobLogic) DeleteTrainingJob(req *types.DeleteTrainingJobReq) (resp *types.DeleteTrainingJobResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return
|
||||
modelartsReq := &modelarts.DeleteTrainingJobReq{}
|
||||
err = copier.CopyWithOption(modelartsReq, req, copier.Option{Converters: tool.Converters})
|
||||
deleteTrainingJobResp, err := l.svcCtx.ModelArtsRpc.DeleteTrainingJob(l.ctx, modelartsReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("Failed to delete training job"), "Failed to delete training job err : %v ,req:%+v", err, req)
|
||||
}
|
||||
resp = &types.DeleteTrainingJobResp{}
|
||||
err = copier.CopyWithOption(&resp, &deleteTrainingJobResp, copier.Option{Converters: tool.Converters})
|
||||
return resp, nil
|
||||
}
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/AIComputing/modelarts/rpc/modelarts"
|
||||
"PCM/common/tool"
|
||||
"PCM/common/xerr"
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"PCM/adaptor/AIComputing/AICore/api/internal/svc"
|
||||
"PCM/adaptor/AIComputing/AICore/api/internal/types"
|
||||
|
@ -24,7 +29,16 @@ func NewListNotebookLogic(ctx context.Context, svcCtx *svc.ServiceContext) *List
|
|||
}
|
||||
|
||||
func (l *ListNotebookLogic) ListNotebook(req *types.ListNotebookReq) (resp *types.ListNotebookResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
modelartsReq := &modelarts.ListNotebookReq{}
|
||||
err = copier.CopyWithOption(modelartsReq, req, copier.Option{Converters: tool.Converters})
|
||||
|
||||
return
|
||||
listNotebookResp, err := l.svcCtx.ModelArtsRpc.ListNotebook(l.ctx, modelartsReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("Failed to get notebook list"), "Failed to get notebook list err : %v ,req:%+v", err, req)
|
||||
}
|
||||
|
||||
resp = &types.ListNotebookResp{}
|
||||
err = copier.CopyWithOption(&resp, &listNotebookResp, copier.Option{Converters: tool.Converters})
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
|
|
@ -43,8 +43,8 @@ type CreateDataSetResp struct {
|
|||
}
|
||||
|
||||
type ImportTaskDataReq struct {
|
||||
ProjectId string `json:"projectId"`
|
||||
DatasetId string `json:"datasetId"`
|
||||
ProjectId string `json:"project_id"`
|
||||
DatasetId string `json:"dataset_id"`
|
||||
ImportPath string `json:"importPath"`
|
||||
}
|
||||
|
||||
|
@ -63,8 +63,8 @@ type CreateExportTaskResp struct {
|
|||
}
|
||||
|
||||
type ListImportTasksReq struct {
|
||||
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"`
|
||||
}
|
||||
|
@ -75,23 +75,26 @@ type ListImportTasksResp struct {
|
|||
}
|
||||
|
||||
type ImportTasks struct {
|
||||
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 struct {
|
||||
}
|
||||
|
||||
type Annotations struct {
|
||||
|
@ -319,150 +322,28 @@ type ListTrainingJobsresp struct {
|
|||
}
|
||||
|
||||
type DeleteTrainingJobReq struct {
|
||||
Project_id string `json:"total"`
|
||||
Training_job_id string `json:"total"`
|
||||
Project_id string `json:"project_id"`
|
||||
Training_job_id string `json:"training_job_id"`
|
||||
}
|
||||
|
||||
type DeleteTrainingJobResp struct {
|
||||
}
|
||||
|
||||
type AlgorithmResponse struct {
|
||||
MetadataAlRp MetadataAlRp `json:"metadata,optional"`
|
||||
JobConfigAlRp JobConfigAlRp `json:"job_config,optional"`
|
||||
ResourceRequirementsAlRp []ResourceRequirements `json:"resourceRequirements,optional"`
|
||||
AdvancedConfigAlRp AdvancedConfigAl `json:"advanced_config,optional"`
|
||||
}
|
||||
|
||||
type MetadataAlRp struct {
|
||||
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 struct {
|
||||
Tags map[string]string `json:"tags,optional"`
|
||||
}
|
||||
|
||||
type JobConfigAlRp struct {
|
||||
CodeDir string `json:"code_dir,optional"`
|
||||
BootFile string `json:"boot_file,optional"`
|
||||
Command string `json:"command,optional"`
|
||||
ParametersAlRq []ParametersAlRq `json:"parameters,optional"`
|
||||
ParametersCustomization bool `json:"parameters_customization,optional"`
|
||||
InputsAlRq []InputsAlRq `json:"inputs,optional"`
|
||||
OutputsAl []OutputsAl `json:"outputs,optional"`
|
||||
EngineAlRq EngineAlRq `json:"engine,optional"`
|
||||
}
|
||||
|
||||
type ParametersAlRq struct {
|
||||
Name string `json:"name,optional"`
|
||||
Description string `json:"description,optional"`
|
||||
I18NDescription I18NDescription `json:"i18n_description,optional"`
|
||||
Value string `json:"value,optional"`
|
||||
Constraint ConstraintAlRq `json:"constraint,optional"`
|
||||
}
|
||||
|
||||
type I18NDescription struct {
|
||||
Language string `json:"language,optional"`
|
||||
Description string `json:"description,optional"`
|
||||
}
|
||||
|
||||
type ConstraintAlRq struct {
|
||||
Type string `son:"type,optional"`
|
||||
Editable bool `json:"editable,optional"`
|
||||
Required bool `json:"required,optional"`
|
||||
Sensitive bool `json:"sensitive,optional"`
|
||||
ValidType string `json:"valid_type,optional"`
|
||||
ValidRange []string `json:"valid_range,optional"`
|
||||
}
|
||||
|
||||
type EngineAlRq struct {
|
||||
EngineId string `json:"engine_id,optional"`
|
||||
EngineName string `json:"engine_name,optional"`
|
||||
EngineVersion string `json:"engine_version,optional"`
|
||||
ImageUrl string `json:"image_url,optional"`
|
||||
}
|
||||
|
||||
type InputsAlRq struct {
|
||||
Name string `json:"name,optional"`
|
||||
Description string `json:"description,optional"`
|
||||
RemoteConstraints []*RemoteConstraints `json:"remote_constraints,optional"`
|
||||
}
|
||||
|
||||
type OutputsAl struct {
|
||||
Name string `json:"name,optional"`
|
||||
Description string `json:"description,optional"`
|
||||
}
|
||||
|
||||
type ResourceRequirements struct {
|
||||
Key string `json:"key,optional"`
|
||||
Value []string `json:"value,optional"`
|
||||
Operator string `json:"operator,optional"`
|
||||
}
|
||||
|
||||
type AdvancedConfigAl struct {
|
||||
AutoSearch AutoSearch `json:"auto_search,optional"`
|
||||
}
|
||||
|
||||
type AutoSearch struct {
|
||||
SkipSearchParams string `json:"skip_search_params,optional"`
|
||||
RewardAttrs []RewardAttrs `json:"reward_attrs,optional"`
|
||||
SearchParams []SearchParams `json:"search_params,optional"`
|
||||
AlgoConfigs []AlgoConfigs `json:"algo_configs,optional"`
|
||||
}
|
||||
|
||||
type AlgoConfigs struct {
|
||||
Name string `json:"name,optional"`
|
||||
AutoSearchAlgoConfigParameterAlRp []AutoSearchAlgoConfigParameterAlRp `json:"params,optional"`
|
||||
}
|
||||
|
||||
type AutoSearchAlgoConfigParameterAlRp struct {
|
||||
Key string `json:"key,optional"`
|
||||
Value string `json:"value,optional"`
|
||||
Type string `json:"type,optional"`
|
||||
}
|
||||
|
||||
type RewardAttrs struct {
|
||||
Name string `json:"name,optional"`
|
||||
Mode string `json:"mode,optional"`
|
||||
Regex string `json:"regex,optional"`
|
||||
}
|
||||
|
||||
type SearchParams struct {
|
||||
Name string `json:"name,optional"`
|
||||
ParamType string `json:"param_type,optional"`
|
||||
LowerBound string `json:"lower_bound,optional"`
|
||||
UpperBound string `json:"upper_bound,optional"`
|
||||
DiscretePointsNum string `json:"discrete_points_num,optional"`
|
||||
DiscreteValues []string `json:"discrete_values,optional"`
|
||||
Is_success bool `json:"is_success"`
|
||||
Error_message string `json:"error_message"`
|
||||
Error_code string `json:"error_code"`
|
||||
}
|
||||
|
||||
type CreateServiceReq struct {
|
||||
WorkspaceId string `json:"workspaceId,optional" copier:"WorkspaceId"`
|
||||
Schedule Scheduler `json:"schedule,optional" copier:"Schedule"`
|
||||
ClusterId string `json:"clusterId,optional" copier:"ClusterId"`
|
||||
InferType string `json:"inferType,optional" copier:"InferType"`
|
||||
InferType string `json:"inferType" copier:"InferType"`
|
||||
VpcId string `json:"vpcId,optional" copier:"VpcId"`
|
||||
ServiceName string `json:"serviceName,optional" copier:"ServiceName"`
|
||||
Description string `json:"description,optional" copier:"Description"`
|
||||
SecurityGroupId string `json:"securityGroupId,optional" copier:"SecurityGroupId"`
|
||||
SubnetNetworkId string `json:"subnetNetworkId,optional" copier:"SubnetNetworkId"`
|
||||
Config []ServiceConfig `json:"config,optional" copier:"Config"`
|
||||
ProjectId string `json:"projectId,optional" copier:"ProjectId"`
|
||||
Config []ServiceConfig `json:"config" copier:"Config"`
|
||||
ProjectId string `json:"projectId" copier:"ProjectId"`
|
||||
}
|
||||
|
||||
type CreateServiceResp struct {
|
||||
|
@ -480,9 +361,9 @@ type Scheduler struct {
|
|||
type ServiceConfig struct {
|
||||
CustomSpec CustomSpec `json:"customSpec,optional" copier:"CustomSpec"`
|
||||
Envs map[string]string `json:"envs,optional" copier:"Envs"`
|
||||
Specification string `json:"specification,optional" copier:"Specification"`
|
||||
Specification string `json:"specification" copier:"Specification"`
|
||||
Weight int32 `json:"weight,optional" copier:"Weight"`
|
||||
ModelId string `json:"modelId,optional" copier:"ModelId"`
|
||||
ModelId string `json:"modelId" copier:"ModelId"`
|
||||
SrcPath string `json:"srcPath,optional" copier:"SrcPath"`
|
||||
ReqUri string `json:"reqUri,optional" copier:"ReqUri"`
|
||||
MappingType string `json:"mappingType,optional" copier:"MappingType"`
|
||||
|
@ -490,7 +371,7 @@ type ServiceConfig struct {
|
|||
Nodes []string `json:"nodes,optional" copier:"Nodes"`
|
||||
SrcType string `json:"srcType,optional" copier:"SrcType"`
|
||||
DestPath string `json:"destPath,optional" copier:"DestPath"`
|
||||
InstanceCount int32 `json:"instanceCount,optional" copier:"InstanceCount"`
|
||||
InstanceCount int32 `json:"instanceCount" copier:"InstanceCount"`
|
||||
}
|
||||
|
||||
type CustomSpec struct {
|
||||
|
@ -651,6 +532,131 @@ type Cluster struct {
|
|||
OrderId string `json:"order_id,omitempty" copier:"OrderId"`
|
||||
}
|
||||
|
||||
type AlgorithmResponse struct {
|
||||
MetadataAlRp MetadataAlRp `json:"metadata,optional"`
|
||||
JobConfigAlRp JobConfigAlRp `json:"job_config,optional"`
|
||||
ResourceRequirementsAlRp []ResourceRequirements `json:"resourceRequirements,optional"`
|
||||
AdvancedConfigAlRp AdvancedConfigAl `json:"advanced_config,optional"`
|
||||
}
|
||||
|
||||
type MetadataAlRp struct {
|
||||
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 struct {
|
||||
Tags map[string]string `json:"tags,optional"`
|
||||
}
|
||||
|
||||
type JobConfigAlRp struct {
|
||||
CodeDir string `json:"code_dir,optional"`
|
||||
BootFile string `json:"boot_file,optional"`
|
||||
Command string `json:"command,optional"`
|
||||
ParametersAlRq []ParametersAlRq `json:"parameters,optional"`
|
||||
ParametersCustomization bool `json:"parameters_customization,optional"`
|
||||
InputsAlRq []InputsAlRq `json:"inputs,optional"`
|
||||
OutputsAl []OutputsAl `json:"outputs,optional"`
|
||||
EngineAlRq EngineAlRq `json:"engine,optional"`
|
||||
}
|
||||
|
||||
type ParametersAlRq struct {
|
||||
Name string `json:"name,optional"`
|
||||
Description string `json:"description,optional"`
|
||||
I18NDescription I18NDescription `json:"i18n_description,optional"`
|
||||
Value string `json:"value,optional"`
|
||||
Constraint ConstraintAlRq `json:"constraint,optional"`
|
||||
}
|
||||
|
||||
type I18NDescription struct {
|
||||
Language string `json:"language,optional"`
|
||||
Description string `json:"description,optional"`
|
||||
}
|
||||
|
||||
type ConstraintAlRq struct {
|
||||
Type string `son:"type,optional"`
|
||||
Editable bool `json:"editable,optional"`
|
||||
Required bool `json:"required,optional"`
|
||||
Sensitive bool `json:"sensitive,optional"`
|
||||
ValidType string `json:"valid_type,optional"`
|
||||
ValidRange []string `json:"valid_range,optional"`
|
||||
}
|
||||
|
||||
type EngineAlRq struct {
|
||||
EngineId string `json:"engine_id,optional"`
|
||||
EngineName string `json:"engine_name,optional"`
|
||||
EngineVersion string `json:"engine_version,optional"`
|
||||
ImageUrl string `json:"image_url,optional"`
|
||||
}
|
||||
|
||||
type InputsAlRq struct {
|
||||
Name string `json:"name,optional"`
|
||||
Description string `json:"description,optional"`
|
||||
RemoteConstraints []*RemoteConstraints `json:"remote_constraints,optional"`
|
||||
}
|
||||
|
||||
type OutputsAl struct {
|
||||
Name string `json:"name,optional"`
|
||||
Description string `json:"description,optional"`
|
||||
}
|
||||
|
||||
type ResourceRequirements struct {
|
||||
Key string `json:"key,optional"`
|
||||
Value []string `json:"value,optional"`
|
||||
Operator string `json:"operator,optional"`
|
||||
}
|
||||
|
||||
type AdvancedConfigAl struct {
|
||||
AutoSearch AutoSearch `json:"auto_search,optional"`
|
||||
}
|
||||
|
||||
type AutoSearch struct {
|
||||
SkipSearchParams string `json:"skip_search_params,optional"`
|
||||
RewardAttrs []RewardAttrs `json:"reward_attrs,optional"`
|
||||
SearchParams []SearchParams `json:"search_params,optional"`
|
||||
AlgoConfigs []AlgoConfigs `json:"algo_configs,optional"`
|
||||
}
|
||||
|
||||
type AlgoConfigs struct {
|
||||
Name string `json:"name,optional"`
|
||||
AutoSearchAlgoConfigParameterAlRp []AutoSearchAlgoConfigParameterAlRp `json:"params,optional"`
|
||||
}
|
||||
|
||||
type AutoSearchAlgoConfigParameterAlRp struct {
|
||||
Key string `json:"key,optional"`
|
||||
Value string `json:"value,optional"`
|
||||
Type string `json:"type,optional"`
|
||||
}
|
||||
|
||||
type RewardAttrs struct {
|
||||
Name string `json:"name,optional"`
|
||||
Mode string `json:"mode,optional"`
|
||||
Regex string `json:"regex,optional"`
|
||||
}
|
||||
|
||||
type SearchParams struct {
|
||||
Name string `json:"name,optional"`
|
||||
ParamType string `json:"param_type,optional"`
|
||||
LowerBound string `json:"lower_bound,optional"`
|
||||
UpperBound string `json:"upper_bound,optional"`
|
||||
DiscretePointsNum string `json:"discrete_points_num,optional"`
|
||||
DiscreteValues []string `json:"discrete_values,optional"`
|
||||
}
|
||||
|
||||
type ListAlgorithmsReq struct {
|
||||
ProjectId string `json:"project_id"`
|
||||
Offset int32 `json:"offset,optional"`
|
||||
|
@ -672,6 +678,8 @@ type DeleteAlgorithmReq struct {
|
|||
}
|
||||
|
||||
type DeleteAlgorithmResp struct {
|
||||
Msg string `json:"msg"`
|
||||
Code int32 `json:"code"`
|
||||
}
|
||||
|
||||
type MetadataAlRq struct {
|
||||
|
@ -1013,3 +1021,74 @@ type Schedule struct {
|
|||
Time_unit string `json:"time_unit"`
|
||||
Duration int32 `json:"duration"`
|
||||
}
|
||||
|
||||
type CreateTrainingJobReq struct {
|
||||
Kind string `json:"kind"`
|
||||
Metadatas MetadataS `json:"metadata"`
|
||||
Algorithms Algorithms `json:"algorithm"`
|
||||
Specs Specs `json:"spec"`
|
||||
ProjectId string `json:"projectId"`
|
||||
}
|
||||
|
||||
type CreateTrainingJobResp struct {
|
||||
Kind string `json:"kind"`
|
||||
Metadatas MetadataS `json:"metadata"`
|
||||
Status Status `json:"status"`
|
||||
Specs Specs `json:"spec"`
|
||||
Algorithms Algorithms `json:"algorithm"`
|
||||
}
|
||||
|
||||
type MetadataS struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
WorkspaceId string `json:"workspaceId"`
|
||||
}
|
||||
|
||||
type EngineCreateTraining struct {
|
||||
EngineId string `json:"engineId"`
|
||||
EngineName string `json:"engineName"`
|
||||
EngineVersion string `json:"engineVersion"`
|
||||
}
|
||||
|
||||
type ConstraintCreateTraining struct {
|
||||
Type string `json:"type"`
|
||||
Editable bool `json:"editable"`
|
||||
Required bool `json:"required"`
|
||||
Sensitive bool `json:"sensitive"`
|
||||
ValidType string `json:"validType"`
|
||||
}
|
||||
|
||||
type ParametersTrainJob struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Value string `json:"value"`
|
||||
ConstraintCreateTraining ConstraintCreateTraining `json:"constraint"`
|
||||
}
|
||||
|
||||
type PoliciesCreateTraining struct {
|
||||
}
|
||||
|
||||
type Algorithms struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
CodeDir string `json:"codeDir"`
|
||||
BootFile string `json:"bootFile"`
|
||||
EngineCreateTraining EngineCreateTraining `json:"engine"`
|
||||
ParametersTrainJob []ParametersTrainJob `json:"parameters"`
|
||||
PoliciesCreateTraining PoliciesCreateTraining `json:"policies"`
|
||||
}
|
||||
|
||||
type ResourceCreateTraining struct {
|
||||
FlavorId string `json:"flavorId"`
|
||||
NodeCount int32 `json:"nodeCount"`
|
||||
}
|
||||
|
||||
type LogExportPathCreateTrainingJob struct {
|
||||
}
|
||||
|
||||
type Specs struct {
|
||||
ResourceCreateTraining ResourceCreateTraining `json:"resource"`
|
||||
LogExportPathCreateTrainingJob LogExportPathCreateTrainingJob `json:"logExportPath"`
|
||||
IsHostedLog bool `json:"isHostedLog"`
|
||||
}
|
||||
|
|
|
@ -2,13 +2,11 @@ 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"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
@ -32,13 +30,18 @@ func (l *DeleteTrainingJobLogic) DeleteTrainingJob(in *modelarts.DeleteTrainingJ
|
|||
var resp modelarts.DeleteTrainingJobResp
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v2/" + in.ProjectId + "/training-jobs/" + in.TrainingJobId
|
||||
token := common.GetToken()
|
||||
body, err := tool.HttpClient(tool.DELETE, url, strings.NewReader(``), token)
|
||||
statusCode, err := tool.HttpClientStatusCode(tool.DELETE, url, nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
json.Unmarshal(body, &resp)
|
||||
if &resp == nil {
|
||||
return nil, err
|
||||
|
||||
resp.ErrorCode = strconv.FormatInt(int64(statusCode), 10)
|
||||
resp.ErrorMessage = err.Error()
|
||||
if statusCode == 202 {
|
||||
resp.IsSuccess = true
|
||||
} else {
|
||||
resp.IsSuccess = false
|
||||
}
|
||||
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -180,9 +180,9 @@ type (
|
|||
Packages = modelarts.Packages
|
||||
Parameter = modelarts.Parameter
|
||||
ParameterS = modelarts.ParameterS
|
||||
Parameters = modelarts.Parameters
|
||||
ParametersAlRp = modelarts.ParametersAlRp
|
||||
ParametersAlRq = modelarts.ParametersAlRq
|
||||
ParametersTrainJob = modelarts.ParametersTrainJob
|
||||
Password = modelarts.Password
|
||||
Policies = modelarts.Policies
|
||||
PoliciesCreateTraining = modelarts.PoliciesCreateTraining
|
||||
|
@ -217,7 +217,7 @@ type (
|
|||
ShowServiceResp = modelarts.ShowServiceResp
|
||||
SourceInfo = modelarts.SourceInfo
|
||||
Spec = modelarts.Spec
|
||||
Spec1 = modelarts.Spec1
|
||||
Specs = modelarts.Specs
|
||||
StartNotebookParam = modelarts.StartNotebookParam
|
||||
StartNotebookReq = modelarts.StartNotebookReq
|
||||
StartNotebookResp = modelarts.StartNotebookResp
|
||||
|
|
|
@ -554,7 +554,9 @@ message DeleteTrainingJobReq{
|
|||
string training_job_id =2;
|
||||
}
|
||||
message DeleteTrainingJobResp{
|
||||
|
||||
bool is_success =1;
|
||||
string error_message =2;
|
||||
string error_code =3;
|
||||
}
|
||||
/******************DeleteTrainingJob end*************************/
|
||||
|
||||
|
|
|
@ -35,6 +35,21 @@ func HttpClient(method string, url string, payload io.Reader, token string) ([]b
|
|||
return body, err
|
||||
}
|
||||
|
||||
func HttpClientStatusCode(method string, url string, payload io.Reader, token string) (int, error) {
|
||||
request, err := http.NewRequest(method, url, payload)
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
request.Header.Add("User-Agent", "API Explorer")
|
||||
request.Header.Add("x-auth-token", token)
|
||||
|
||||
client := &http.Client{}
|
||||
res, err := client.Do(request)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
return res.StatusCode, err
|
||||
}
|
||||
|
||||
func HttpClientWithQueries[T any](method string, url string, payload io.Reader, token string, param T) ([]byte, error) {
|
||||
request, err := http.NewRequest(method, url, payload)
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
|
|
Loading…
Reference in New Issue