🐛 Fixed

This commit is contained in:
devad 2023-11-01 16:51:49 +08:00
parent f6fd0505d2
commit 724c7c4cc0
64 changed files with 4101 additions and 3407 deletions

3
.gitignore vendored
View File

@ -25,5 +25,4 @@ configs/tenanter.yaml
log/
/go_build_gitlink_org_cn_JCCE_PCM
etc/pcmmodelarts-cloudream2.yaml
etc/pcmmodelarts-njaci.yaml
etc/

View File

@ -2,6 +2,8 @@ rpc-gen:
goctl rpc protoc ./pb/*.proto --go_out=./ --go-grpc_out=./ --zrpc_out=. -m
protoc-go-inject-tag -input="modelarts/*.pb.go" -remove_tag_comment
Generate:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o pcm-modelarts pcmmodelarts.go
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o pcm-modelarts pcmmodelarts.go
Generate-ARM64:
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GOARM=7 go build -o pcm-modelarts pcmmodelarts.go

View File

@ -4,14 +4,25 @@ ListenOn: 0.0.0.0:2002
Timeout: 50000
ModelArtsConf:
AK:
SK:
Endpoint:
ProjectId:
DomainId:
SwrEndpoint:
SwrApiEndpoint:
JobLogsPath:
JobLogsPath: ""
CloudBrain2:
AK: ""
SK: ""
Endpoint: ""
ProjectId: ""
DomainId: ""
SwrEndpoint: ""
SwrApiEndpoint: ""
Platform: ""
Njaci:
AK: ""
SK: ""
Endpoint: ""
ProjectId: ""
DomainId: ""
SwrEndpoint: ""
SwrApiEndpoint: ""
Platform: ""
# core rpc
PcmCoreRpcConf:

View File

@ -1,6 +1,12 @@
package config
type ModelArtsConf struct {
CloudBrain2 Conf `json:"CloudBrain2"`
Njaci Conf `json:"Njaci"`
JobLogsPath string `json:"JobLogsPath"`
}
type Conf struct {
AK string `json:"AK"`
SK string `json:"SK"`
Endpoint string `json:"Endpoint"`
@ -8,5 +14,5 @@ type ModelArtsConf struct {
DomainId string `json:"DomainId"`
SwrEndpoint string `json:"SwrEndpoint"`
SwrApiEndpoint string `json:"SwrApiEndpoint"`
JobLogsPath string `json:"JobLogsPath"`
Platform string `json:"Platform"`
}

View File

@ -28,11 +28,14 @@ func NewCreateNamespaceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *C
// CreateNamespace 创建组织
func (l *CreateNamespaceLogic) CreateNamespace(in *modelarts.NamespaceReq) (*modelarts.Resp, error) {
apiUrl := "v2/manage/namespaces"
swrUrl := l.svcCtx.Config.ModelArtsConf.SwrApiEndpoint
url := swrUrl + apiUrl
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
url := platform.SwrEndpoint + apiUrl
var resp modelarts.Resp
reqByte, err := json.Marshal(in)
body, err := util.SendRequest("POST", url, bytes.NewBuffer(reqByte))
body, err := util.SendRequest("POST", url, bytes.NewBuffer(reqByte), in.Platform)
if err != nil {
return nil, err
}

View File

@ -29,10 +29,15 @@ func NewCreateRepoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Create
// 在组织下创建镜像仓库
func (l *CreateRepoLogic) CreateRepo(in *modelarts.CreateRepoReq) (*modelarts.Resp, error) {
var resp modelarts.Resp
swrUrl := l.svcCtx.Config.ModelArtsConf.SwrApiEndpoint
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
swrUrl := platform.SwrApiEndpoint
url := swrUrl + fmt.Sprintf("v2/manage/namespaces/%s/repos", in.Namespace)
reqByte, err := json.Marshal(in)
body, err := util.SendRequest("POST", url, bytes.NewBuffer(reqByte))
body, err := util.SendRequest("POST", url, bytes.NewBuffer(reqByte), in.Platform)
if err != nil {
return nil, err
}

View File

@ -27,10 +27,13 @@ func NewDeleteNamespacesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
// 删除组织
func (l *DeleteNamespacesLogic) DeleteNamespaces(in *modelarts.NamespaceReq) (*modelarts.Resp, error) {
var resp modelarts.Resp
swrUrl := l.svcCtx.Config.ModelArtsConf.SwrApiEndpoint
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
swrUrl := platform.SwrApiEndpoint
url := swrUrl + "v2/manage/namespaces/" + in.Namespace
body, err := util.SendRequest("DELETE", url, nil)
body, err := util.SendRequest("DELETE", url, nil, in.Platform)
if err != nil {
return nil, err
}

View File

@ -30,11 +30,15 @@ func NewDeleteRepoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Delete
func (l *DeleteRepoLogic) DeleteRepo(in *modelarts.DeleteRepoReq) (*modelarts.Resp, error) {
var resp modelarts.Resp
swrUrl := l.svcCtx.Config.ModelArtsConf.SwrApiEndpoint
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
swrUrl := platform.SwrApiEndpoint
url := swrUrl + fmt.Sprintf("v2/manage/namespaces/%s/repos/%s", in.Namespace, in.Repository)
reqByte, err := json.Marshal(in)
body, _ := util.SendRequest("DELETE", url, bytes.NewBuffer(reqByte))
body, _ := util.SendRequest("DELETE", url, bytes.NewBuffer(reqByte), in.Platform)
if err != nil {
return nil, err
}

View File

@ -29,10 +29,14 @@ func NewDeleteRepoTagLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Del
// 删除指定tag的镜像
func (l *DeleteRepoTagLogic) DeleteRepoTag(in *modelarts.DeleteRepoTagReq) (*modelarts.Resp, error) {
var resp modelarts.Resp
swrUrl := l.svcCtx.Config.ModelArtsConf.SwrApiEndpoint
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
swrUrl := platform.SwrApiEndpoint
url := swrUrl + fmt.Sprintf("v2/manage/namespaces/%s/repos/%s/tags/%s", in.Namespace, in.Repository, in.Tag)
reqByte, err := json.Marshal(in)
body, _ := util.SendRequest("DELETE", url, bytes.NewBuffer(reqByte))
body, _ := util.SendRequest("DELETE", url, bytes.NewBuffer(reqByte), in.Platform)
if err != nil {
return nil, err
}

View File

@ -28,11 +28,14 @@ func NewListNamespacesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Li
// 查询组织列表
func (l *ListNamespacesLogic) ListNamespaces(in *modelarts.ListNamespacesReq) (*modelarts.ListNamespacesResp, error) {
var resp modelarts.ListNamespacesResp
swrUrl := l.svcCtx.Config.ModelArtsConf.SwrApiEndpoint
url := swrUrl + "v2/manage/namespaces"
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
url := platform.SwrApiEndpoint + "v2/manage/namespaces"
reqByte, err := json.Marshal(in)
body, _ := util.SendRequest("GET", url, bytes.NewBuffer(reqByte))
body, _ := util.SendRequest("GET", url, bytes.NewBuffer(reqByte), in.Platform)
if err != nil {
return nil, err
}

View File

@ -30,7 +30,11 @@ func NewListReposDetailsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
// 查询镜像仓库列表
func (l *ListReposDetailsLogic) ListReposDetails(in *modelarts.ListRepoReq) (*modelarts.ListReposDetailsResp, error) {
var resp modelarts.ListReposDetailsResp
swrUrl := l.svcCtx.Config.ModelArtsConf.SwrApiEndpoint
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
swrUrl := platform.SwrApiEndpoint
var baseURL = "v2/manage/repos?"
if in.Offset == "" {
in.Offset = "0"
@ -47,7 +51,7 @@ func (l *ListReposDetailsLogic) ListReposDetails(in *modelarts.ListRepoReq) (*mo
}
url := swrUrl + baseURL
reqByte, err := json.Marshal(in)
body, err := util.SendRequest("GET", url, bytes.NewBuffer(reqByte))
body, err := util.SendRequest("GET", url, bytes.NewBuffer(reqByte), in.Platform)
if err != nil {
return nil, err
}

View File

@ -30,11 +30,15 @@ func NewListRepositoryTagsLogic(ctx context.Context, svcCtx *svc.ServiceContext)
func (l *ListRepositoryTagsLogic) ListRepositoryTags(in *modelarts.ListRepositoryTagsReq) (*modelarts.ListRepositoryTagsResp, error) {
var resp modelarts.ListRepositoryTagsResp
swrUrl := l.svcCtx.Config.ModelArtsConf.SwrApiEndpoint
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
swrUrl := platform.SwrApiEndpoint
url := swrUrl + fmt.Sprintf("v2/manage/namespaces/%s/repos/%s/tags", in.Namespace, in.Repository)
reqByte, err := json.Marshal(in)
body, err := util.SendRequest("GET", url, bytes.NewBuffer(reqByte))
body, err := util.SendRequest("GET", url, bytes.NewBuffer(reqByte), in.Platform)
if err != nil {
return nil, err
}

View File

@ -29,10 +29,14 @@ func NewShowNamespaceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Sho
func (l *ShowNamespaceLogic) ShowNamespace(in *modelarts.NamespaceReq) (*modelarts.NamespaceInfo, error) {
var resp modelarts.NamespaceInfo
swrUrl := l.svcCtx.Config.ModelArtsConf.SwrApiEndpoint
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
swrUrl := platform.SwrApiEndpoint
url := swrUrl + fmt.Sprintf("v2/manage/namespaces/%s", in.Namespace)
body, err := util.SendRequest("GET", url, nil)
body, err := util.SendRequest("GET", url, nil, in.Platform)
if err != nil {
return nil, err
}

View File

@ -29,11 +29,15 @@ func NewShowRepositoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Sh
// ShowRepository 查询镜像仓库概要信息
func (l *ShowRepositoryLogic) ShowRepository(in *modelarts.ShowRepositoryReq) (*modelarts.ShowRepositoryResp, error) {
var resp modelarts.ShowRepositoryResp
swrUrl := l.svcCtx.Config.ModelArtsConf.SwrApiEndpoint
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
swrUrl := platform.SwrApiEndpoint
url := swrUrl + fmt.Sprintf("v2/manage/namespaces/%s/repos/%s", in.Namespace, in.Repository)
reqByte, err := json.Marshal(in)
body, err := util.SendRequest("GET", url, bytes.NewBuffer(reqByte))
body, err := util.SendRequest("GET", url, bytes.NewBuffer(reqByte), in.Platform)
if err != nil {
return nil, err
}

View File

@ -30,11 +30,15 @@ func NewUpdateRepoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Update
func (l *UpdateRepoLogic) UpdateRepo(in *modelarts.UpdateRepoReq) (*modelarts.Resp, error) {
var resp modelarts.Resp
swrUrl := l.svcCtx.Config.ModelArtsConf.SwrApiEndpoint
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
swrUrl := platform.SwrApiEndpoint
url := swrUrl + fmt.Sprintf("v2/manage/namespaces/%s/repos/%s", in.Namespace, in.Repository)
reqByte, err := json.Marshal(in)
body, _ := util.SendRequest("PATCH", url, bytes.NewBuffer(reqByte))
body, _ := util.SendRequest("PATCH", url, bytes.NewBuffer(reqByte), in.Platform)
if err != nil {
return nil, err
}

View File

@ -27,11 +27,13 @@ func NewCreateAlgorithmLogic(ctx context.Context, svcCtx *svc.ServiceContext) *C
// CreateAlgorithm 创建算法
func (l *CreateAlgorithmLogic) CreateAlgorithm(in *modelarts.CreateAlgorithmReq) (*modelarts.CreateAlgorithmResp, error) {
var resp modelarts.CreateAlgorithmResp
modelartsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
reqByte, err := json.Marshal(in)
body, err := util.SendRequest("POST", modelartsUrl+"v2/"+projectId+"/algorithms",
bytes.NewBuffer(reqByte))
body, err := util.SendRequest("POST", platform.Endpoint+"v2/"+platform.ProjectId+"/algorithms",
bytes.NewBuffer(reqByte), in.Platform)
if err != nil {
return nil, err
}

View File

@ -27,12 +27,13 @@ func NewCreateDataSetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Cre
// create DateSet
func (l *CreateDataSetLogic) CreateDataSet(in *modelarts.CreateDataSetReq) (*modelarts.CreateDataSetResq, error) {
var resp modelarts.CreateDataSetResq
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
reqByte, err := json.Marshal(in)
body, err := util.SendRequest("POST", ModelArtsUrl+"v2/"+projectId+"/datasets",
bytes.NewBuffer(reqByte))
body, err := util.SendRequest("POST", platform.Endpoint+"v2/"+platform.ProjectId+"/datasets",
bytes.NewBuffer(reqByte), in.Platform)
if err != nil {
return nil, err
}

View File

@ -32,11 +32,13 @@ func NewCreateModelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Creat
// model management
func (l *CreateModelLogic) CreateModel(in *modelarts.CreateModelReq) (*modelarts.CreateModelResp, error) {
var resp modelarts.CreateModelResp
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
reqByte, err := json.Marshal(in)
body, err := util.SendRequest("POST", ModelArtsUrl+"v1/"+projectId+"/models",
bytes.NewBuffer(reqByte))
body, err := util.SendRequest("POST", platform.Endpoint+"v1/"+platform.ProjectId+"/models",
bytes.NewBuffer(reqByte), in.Platform)
if err != nil {
return nil, err
}

View File

@ -27,11 +27,13 @@ func NewCreateNotebookLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Cr
func (l *CreateNotebookLogic) CreateNotebook(in *modelarts.CreateNotebookReq) (*modelarts.CreateNotebookResp, error) {
resp := &modelarts.CreateNotebookResp{}
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
reqByte, err := json.Marshal(in)
body, err := util.SendRequest("POST", ModelArtsUrl+"v1/"+projectId+"/notebooks",
bytes.NewBuffer(reqByte))
body, err := util.SendRequest("POST", platform.Endpoint+"v1/"+platform.ProjectId+"/notebooks",
bytes.NewBuffer(reqByte), in.Platform)
if err != nil {
return nil, err
}

View File

@ -31,13 +31,15 @@ func NewCreateProcessorTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext
// processor task
func (l *CreateProcessorTaskLogic) CreateProcessorTask(in *modelarts.CreateProcessorTaskReq) (*modelarts.CreateProcessorTaskResp, error) {
// todo: add your logic here and delete this line
var resp modelarts.CreateProcessorTaskResp
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
reqByte, err := json.Marshal(in)
body, err := util.SendRequest("POST", ModelArtsUrl+"v2/"+projectId+"/processor-tasks/",
bytes.NewBuffer(reqByte))
body, err := util.SendRequest("POST", platform.Endpoint+"v2/"+platform.ProjectId+"/processor-tasks/",
bytes.NewBuffer(reqByte), in.Platform)
if err != nil {
return nil, err
}

View File

@ -34,13 +34,15 @@ func NewCreateServiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Cre
// service management
func (l *CreateServiceLogic) CreateService(in *modelarts.CreateServiceReq) (*modelarts.CreateServiceResp, error) {
// todo: add your logic here and delete this line
var resp modelarts.CreateServiceResp
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
reqByte, err := json.Marshal(in)
body, err := util.SendRequest("POST", ModelArtsUrl+"v1/"+projectId+"/services",
bytes.NewBuffer(reqByte))
body, err := util.SendRequest("POST", platform.Endpoint+"v1/"+platform.ProjectId+"/services",
bytes.NewBuffer(reqByte), in.Platform)
if err != nil {
return nil, err
}

View File

@ -28,11 +28,13 @@ func NewCreateTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Create
// creat task 创建导入任务
func (l *CreateTaskLogic) CreateTask(in *modelarts.ImportTaskDataReq) (*modelarts.ImportTaskDataResp, error) {
var resp modelarts.ImportTaskDataResp
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
reqByte, err := json.Marshal(in)
body, err := util.SendRequest("POST", ModelArtsUrl+"v2/"+projectId+"/datasets"+in.DatasetId+"/import-tasks",
bytes.NewBuffer(reqByte))
body, err := util.SendRequest("POST", platform.Endpoint+"v2/"+platform.ProjectId+"/datasets"+in.DatasetId+"/import-tasks",
bytes.NewBuffer(reqByte), in.Platform)
if err != nil {
return nil, err
}

View File

@ -28,11 +28,13 @@ func NewCreateTrainingJobConfigLogic(ctx context.Context, svcCtx *svc.ServiceCon
// CreateTrainingJobConfig 创建训练作业参数
func (l *CreateTrainingJobConfigLogic) CreateTrainingJobConfig(in *modelarts.CreateTrainingJobConfigReq) (*modelarts.CreateTrainingJobConfigResp, error) {
var resp modelarts.CreateTrainingJobConfigResp
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
reqByte, err := json.Marshal(in)
body, err := util.SendRequest("POST", ModelArtsUrl+"v1/"+projectId+"/training-job-configs",
bytes.NewBuffer(reqByte))
body, err := util.SendRequest("POST", platform.Endpoint+"v1/"+platform.ProjectId+"/training-job-configs",
bytes.NewBuffer(reqByte), in.Platform)
if err != nil {
return nil, err
}

View File

@ -28,14 +28,16 @@ func NewCreateTrainingJobLogic(ctx context.Context, svcCtx *svc.ServiceContext)
// CreateTrainingJob 创建训练作业
func (l *CreateTrainingJobLogic) CreateTrainingJob(in *modelarts.CreateTrainingJobReq) (*modelarts.CreateTrainingJobResp, error) {
var resp modelarts.CreateTrainingJobResp
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
if reflect.ValueOf(in.Spec.LogExportPath).IsNil() {
in.Spec.LogExportPath = &modelarts.LogExportPath{ObsUrl: l.svcCtx.Config.ModelArtsConf.JobLogsPath}
}
reqByte, err := json.Marshal(in)
body, err := util.SendRequest("POST", ModelArtsUrl+"v2/"+projectId+"/training-jobs",
bytes.NewBuffer(reqByte))
body, err := util.SendRequest("POST", platform.Endpoint+"v2/"+platform.ProjectId+"/training-jobs",
bytes.NewBuffer(reqByte), in.Platform)
if err != nil {
return nil, err

View File

@ -27,11 +27,13 @@ func NewCreateVisualizationJobLogic(ctx context.Context, svcCtx *svc.ServiceCont
func (l *CreateVisualizationJobLogic) CreateVisualizationJob(in *modelarts.CreateVisualizationJobReq) (*modelarts.CreateVisualizationJobResp, error) {
var resp modelarts.CreateVisualizationJobResp
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
reqByte, err := json.Marshal(in)
body, err := util.SendRequest("POST", ModelArtsUrl+"v1/"+projectId+"/visualization-jobs",
bytes.NewBuffer(reqByte))
body, err := util.SendRequest("POST", platform.Endpoint+"v1/"+platform.ProjectId+"/visualization-jobs",
bytes.NewBuffer(reqByte), in.Platform)
if err != nil {
return nil, err
}

View File

@ -27,10 +27,12 @@ func NewDeleteAlgorithmsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
// DeleteAlgorithms 删除算法
func (l *DeleteAlgorithmsLogic) DeleteAlgorithms(in *modelarts.DeleteAlgorithmsReq) (*modelarts.DeleteAlgorithmsResp, error) {
var resp modelarts.DeleteAlgorithmsResp
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
body, err := util.SendRequest("DELETE", ModelArtsUrl+"v2/"+projectId+"/algorithms/"+in.AlgorithmId,
nil)
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
body, err := util.SendRequest("DELETE", platform.Endpoint+"v2/"+platform.ProjectId+"/algorithms/"+in.AlgorithmId,
nil, in.Platform)
if err != nil {
return nil, err
}

View File

@ -26,12 +26,14 @@ func NewDeleteDataSetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Del
// create DateSet
func (l *DeleteDataSetLogic) DeleteDataSet(in *modelarts.DeleteDataSetReq) (*modelarts.DeleteDataSetResq, error) {
// todo: add your logic here and delete this line
var resp modelarts.DeleteDataSetResq
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
body, err := util.SendRequest("DELETE", ModelArtsUrl+"v2/"+projectId+"/datasets/"+in.DatasetId,
nil)
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
body, err := util.SendRequest("DELETE", platform.Endpoint+"v2/"+platform.ProjectId+"/datasets/"+in.DatasetId,
nil, in.Platform)
if err != nil {
return nil, err
}

View File

@ -30,12 +30,14 @@ func NewDeleteModelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Delet
}
func (l *DeleteModelLogic) DeleteModel(in *modelarts.DeleteModelReq) (*modelarts.DeleteModelResp, error) {
// todo: add your logic here and delete this line
var resp modelarts.DeleteModelResp
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
body, err := util.SendRequest("DELETE", ModelArtsUrl+projectId+"/models/"+in.ModelId,
nil)
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
body, err := util.SendRequest("DELETE", platform.Endpoint+platform.ProjectId+"/models/"+in.ModelId,
nil, in.Platform)
if err != nil {
return nil, err
}

View File

@ -30,10 +30,12 @@ func NewDeleteServiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Del
func (l *DeleteServiceLogic) DeleteService(in *modelarts.DeleteServiceReq) (*modelarts.DeleteServiceResp, error) {
var resp modelarts.DeleteServiceResp
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
body, err := util.SendRequest("DELETE", ModelArtsUrl+projectId+"/services/"+in.ServiceId,
nil)
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
body, err := util.SendRequest("DELETE", platform.Endpoint+platform.ProjectId+"/services/"+in.ServiceId,
nil, in.Platform)
if err != nil {
return nil, err
}

View File

@ -26,10 +26,12 @@ func NewDeleteTrainingJobConfigLogic(ctx context.Context, svcCtx *svc.ServiceCon
// DeleteTrainingJobConfig 删除训练作业参数
func (l *DeleteTrainingJobConfigLogic) DeleteTrainingJobConfig(in *modelarts.DeleteTrainingJobConfigReq) (*modelarts.DeleteTrainingJobConfigResp, error) {
var resp modelarts.DeleteTrainingJobConfigResp
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
body, err := util.SendRequest("DELETE", ModelArtsUrl+"v1/"+projectId+"/training-job-configs/"+in.ConfigName,
nil)
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
body, err := util.SendRequest("DELETE", platform.Endpoint+"v1/"+platform.ProjectId+"/training-job-configs/"+in.ConfigName,
nil, in.Platform)
if err != nil {
return nil, err
}

View File

@ -27,10 +27,12 @@ func NewDeleteTrainingJobLogic(ctx context.Context, svcCtx *svc.ServiceContext)
func (l *DeleteTrainingJobLogic) DeleteTrainingJob(in *modelarts.DeleteTrainingJobReq) (*modelarts.DeleteTrainingJobResp, error) {
var resp modelarts.DeleteTrainingJobResp
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
body, err := util.SendRequest("DELETE", ModelArtsUrl+"v2/"+projectId+"/training-jobs/"+in.TrainingJobId,
nil)
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
body, err := util.SendRequest("DELETE", platform.Endpoint+"v2/"+platform.ProjectId+"/training-jobs/"+in.TrainingJobId,
nil, in.Platform)
if err != nil {
return nil, err
}

View File

@ -29,13 +29,15 @@ func NewDescribeProcessorTaskLogic(ctx context.Context, svcCtx *svc.ServiceConte
}
func (l *DescribeProcessorTaskLogic) DescribeProcessorTask(in *modelarts.DescribeProcessorTaskReq) (*modelarts.DescribeProcessorTaskResp, error) {
// todo: add your logic here and delete this line
var resp modelarts.DescribeProcessorTaskResp
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
body, err := util.SendRequest("GET", ModelArtsUrl+"v2/"+projectId+"/processor-tasks/"+in.TaskId,
nil)
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
body, err := util.SendRequest("GET", platform.Endpoint+"v2/"+platform.ProjectId+"/processor-tasks/"+in.TaskId,
nil, in.Platform)
if err != nil {
return nil, err
}

View File

@ -34,11 +34,13 @@ func NewExportTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Export
func (l *ExportTaskLogic) ExportTask(in *modelarts.ExportTaskReq) (*modelarts.ExportTaskDataResp, error) {
var resp modelarts.ExportTaskDataResp
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
reqByte, err := json.Marshal(in)
body, err := util.SendRequest("POST", ModelArtsUrl+"v2/"+projectId+"/datasets/"+in.DatasetId+"/export-tasks",
bytes.NewBuffer(reqByte))
body, err := util.SendRequest("POST", platform.Endpoint+"v2/"+platform.ProjectId+"/datasets/"+in.DatasetId+"/export-tasks",
bytes.NewBuffer(reqByte), in.Platform)
if err != nil {
return nil, err
}

View File

@ -26,13 +26,15 @@ func NewGetAiEnginesListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
// GET ai-engines 查询作业引擎规格
func (l *GetAiEnginesListLogic) GetAiEnginesList(in *modelarts.ListAiEnginesReq) (*modelarts.ListAiEnginesResp, error) {
// todo: add your logic here and delete this line
var resp modelarts.ListAiEnginesResp
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
body, err := util.SendRequest("GET", ModelArtsUrl+"v2/"+projectId+"/training-job-engines",
nil)
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
body, err := util.SendRequest("GET", platform.Endpoint+"v2/"+platform.ProjectId+"/training-job-engines",
nil, in.Platform)
if err != nil {
return nil, err
}

View File

@ -27,7 +27,10 @@ func NewGetDatasetListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ge
// find datasetList
func (l *GetDatasetListLogic) GetDatasetList(in *modelarts.DataSetReq) (*modelarts.DataSetResp, error) {
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
var resp modelarts.DataSetResp
offset := strconv.Itoa(int(in.Offset))
judgeLimit := strconv.Itoa(int(in.Limit))
@ -37,11 +40,9 @@ func (l *GetDatasetListLogic) GetDatasetList(in *modelarts.DataSetReq) (*modelar
} else {
limit = "10"
}
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
url := fmt.Sprintf("%sv2/%s/datasets?offset=%s&limit=%s&dataset_version=%s", ModelArtsUrl, projectId, offset, limit, in.DatasetVersion)
url := fmt.Sprintf("%sv2/%s/datasets?offset=%s&limit=%s&dataset_version=%s", platform.Endpoint, platform.ProjectId, offset, limit, in.DatasetVersion)
body, err := util.SendRequest("GET", url,
nil)
nil, in.Platform)
if err != nil {
return nil, err
}

View File

@ -30,11 +30,6 @@ func NewGetExportTasksOfDatasetLogic(ctx context.Context, svcCtx *svc.ServiceCon
}
}
//type Pppp struct {
// TotalCount int `json:"total_count"`
// ExportTasks []*Modelarts.ExportTaskStatus `json:"export_tasks"`
//}
func (l *GetExportTasksOfDatasetLogic) GetExportTasksOfDataset(in *modelarts.GetExportTasksOfDatasetReq) (*modelarts.GetExportTasksOfDatasetResp, error) {
var resp modelarts.GetExportTasksOfDatasetResp
offset := strconv.Itoa(int(in.Offset))
@ -45,10 +40,12 @@ func (l *GetExportTasksOfDatasetLogic) GetExportTasksOfDataset(in *modelarts.Get
} else {
limit = "10"
}
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
body, err := util.SendRequest("GET", ModelArtsUrl+"v2/"+projectId+"/datasets/"+in.DatasetId+"/export-tasks?limit="+limit+"&offset="+offset,
nil)
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
body, err := util.SendRequest("GET", platform.Endpoint+"v2/"+platform.ProjectId+"/datasets/"+in.DatasetId+"/export-tasks?limit="+limit+"&offset="+offset,
nil, in.Platform)
if err != nil {
return nil, err
}

View File

@ -32,10 +32,12 @@ func NewGetExportTaskStatusOfDatasetLogic(ctx context.Context, svcCtx *svc.Servi
func (l *GetExportTaskStatusOfDatasetLogic) GetExportTaskStatusOfDataset(in *modelarts.GetExportTaskStatusOfDatasetReq) (*modelarts.GetExportTaskStatusOfDatasetResp, error) {
var resp modelarts.GetExportTaskStatusOfDatasetResp
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
body, err := util.SendRequest("GET", ModelArtsUrl+"v2/"+projectId+"/datasets/"+in.ResourceId+"/export-tasks/"+in.TaskId,
nil)
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
body, err := util.SendRequest("GET", platform.Endpoint+"v2/"+platform.ProjectId+"/datasets/"+in.ResourceId+"/export-tasks/"+in.TaskId,
nil, in.Platform)
if err != nil {
return nil, err
}

View File

@ -37,10 +37,12 @@ func (l *GetImportTaskListLogic) GetImportTaskList(in *modelarts.ListImportTasks
limit = "10"
}
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
body, err := util.SendRequest("GET", ModelArtsUrl+"v2/"+projectId+"/datasets/"+in.DatasetId+"/import-tasks?limit="+limit+"&offset="+offset,
nil)
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
body, err := util.SendRequest("GET", platform.Endpoint+"v2/"+platform.ProjectId+"/datasets/"+in.DatasetId+"/import-tasks?limit="+limit+"&offset="+offset,
nil, in.Platform)
if err != nil {
return nil, err
}

View File

@ -36,10 +36,12 @@ func (l *GetListTrainingJobsLogic) GetListTrainingJobs(in *modelarts.ListTrainin
limit = "10"
}
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
body, err := util.SendRequest("POST", ModelArtsUrl+"v2/"+projectId+"/training-job-searches?offset="+offset+"&"+"limit="+limit,
nil)
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
body, err := util.SendRequest("POST", platform.Endpoint+"v2/"+platform.ProjectId+"/training-job-searches?offset="+offset+"&"+"limit="+limit,
nil, in.Platform)
if err != nil {
return nil, err
}

View File

@ -27,10 +27,12 @@ func NewGetNotebookStorageLogic(ctx context.Context, svcCtx *svc.ServiceContext)
func (l *GetNotebookStorageLogic) GetNotebookStorage(in *modelarts.GetNotebookStorageReq) (*modelarts.GetNotebookStorageResp, error) {
var resp modelarts.GetNotebookStorageResp
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
body, err := util.SendRequest("GET", ModelArtsUrl+"v1/"+projectId+"/notebooks"+in.InstanceId+"/storage",
nil)
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
body, err := util.SendRequest("GET", platform.Endpoint+"v1/"+platform.ProjectId+"/notebooks"+in.InstanceId+"/storage",
nil, in.Platform)
if err != nil {
return nil, err
}

View File

@ -31,7 +31,6 @@ func NewGetTokenLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetToken
// getToken
func (l *GetTokenLogic) GetToken(in *modelarts.TokenReq) (*modelarts.TokenResp, error) {
// todo: add your logic here and delete this line
var resp modelarts.TokenResp
TokenUrl := "v3/auth/tokens"

View File

@ -25,13 +25,15 @@ func NewGetTrainingJobFlavorsLogic(ctx context.Context, svcCtx *svc.ServiceConte
// training-job-flavors 获取训练作业支持的公共规格
func (l *GetTrainingJobFlavorsLogic) GetTrainingJobFlavors(in *modelarts.TrainingJobFlavorsReq) (*modelarts.TrainingJobFlavorsResp, error) {
// todo: add your logic here and delete this line
var resp modelarts.TrainingJobFlavorsResp
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
body, err := util.SendRequest("GET", ModelArtsUrl+"v2/"+projectId+"/training-job-flavors?flavor_type="+in.FlavorType,
nil)
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
body, err := util.SendRequest("GET", platform.Endpoint+"v2/"+platform.ProjectId+"/training-job-flavors?flavor_type="+in.FlavorType,
nil, in.Platform)
if err != nil {
return nil, err
}

View File

@ -29,10 +29,12 @@ func NewGetTrainingJobsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *G
func (l *GetTrainingJobsLogic) GetTrainingJobs(in *modelarts.DetailTrainingJobsReq) (*modelarts.JobResponse, error) {
var resp modelarts.JobResponse
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
body, err := util.SendRequest("GET", ModelArtsUrl+"v2/"+projectId+"/training-jobs/"+in.TrainingJobId,
nil)
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
body, err := util.SendRequest("GET", platform.Endpoint+"v2/"+platform.ProjectId+"/training-jobs/"+in.TrainingJobId,
nil, in.Platform)
if err != nil {
return nil, err
}

View File

@ -28,10 +28,12 @@ func NewGetVisualizationJobLogic(ctx context.Context, svcCtx *svc.ServiceContext
func (l *GetVisualizationJobLogic) GetVisualizationJob(in *modelarts.GetVisualizationJobReq) (*modelarts.GetVisualizationJobResp, error) {
var resp modelarts.GetVisualizationJobResp
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
body, err := util.SendRequest("GET", ModelArtsUrl+"v1/"+projectId+"/visualization-jobs",
nil)
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
body, err := util.SendRequest("GET", platform.Endpoint+"v1/"+platform.ProjectId+"/visualization-jobs",
nil, in.Platform)
if err != nil {
return nil, err
}

View File

@ -36,11 +36,12 @@ func (l *ListAlgorithmsLogic) ListAlgorithms(in *modelarts.ListAlgorithmsReq) (*
} else {
limit = "10"
}
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
body, err := util.SendRequest("GET", ModelArtsUrl+"v2/"+projectId+"/algorithms?offset="+offset+"&"+"limit="+limit,
bytes.NewBuffer([]byte("foo=bar")))
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
body, err := util.SendRequest("GET", platform.Endpoint+"v2/"+platform.ProjectId+"/algorithms?offset="+offset+"&"+"limit="+limit,
bytes.NewBuffer([]byte("foo=bar")), in.Platform)
if err != nil {
return nil, err
}

View File

@ -32,7 +32,7 @@ func NewListClustersLogic(ctx context.Context, svcCtx *svc.ServiceContext) *List
}
func (l *ListClustersLogic) ListClusters(in *modelarts.ListClustersReq) (*modelarts.ListClustersResp, error) {
// todo: add your logic here and delete this line
var resp modelarts.ListClustersResp
judgeLimit := strconv.Itoa(int(in.Limit))
offset := strconv.Itoa(int(in.Offset))
@ -42,11 +42,12 @@ func (l *ListClustersLogic) ListClusters(in *modelarts.ListClustersReq) (*modela
} else {
limit = "10"
}
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
body, err := util.SendRequest("GET", ModelArtsUrl+"v1/"+projectId+"/clusters?offset="+offset+"&"+"limit="+limit,
nil)
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
body, err := util.SendRequest("GET", platform.Endpoint+"v1/"+platform.ProjectId+"/clusters?offset="+offset+"&"+"limit="+limit,
nil, in.Platform)
if err != nil {
return nil, err
}

View File

@ -31,13 +31,15 @@ func NewListModelsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListMo
}
func (l *ListModelsLogic) ListModels(in *modelarts.ListModelReq) (*modelarts.ListModelResp, error) {
// todo: add your logic here and delete this line
var resp modelarts.ListModelResp
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
body, err := util.SendRequest("GET", ModelArtsUrl+"v1/"+projectId+"/models",
bytes.NewBuffer([]byte("foo=bar")))
var resp modelarts.ListModelResp
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
body, err := util.SendRequest("GET", platform.Endpoint+"v1/"+platform.ProjectId+"/models",
bytes.NewBuffer([]byte("foo=bar")), in.Platform)
if err != nil {
return nil, err
}

View File

@ -27,11 +27,12 @@ func NewListNotebookLogic(ctx context.Context, svcCtx *svc.ServiceContext) *List
func (l *ListNotebookLogic) ListNotebook(in *modelarts.ListNotebookReq) (*modelarts.ListNotebookResp, error) {
resp := &modelarts.ListNotebookResp{}
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
body, err := util.SendRequest("GET", ModelArtsUrl+"v1/"+projectId+"/notebooks",
nil)
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
body, err := util.SendRequest("GET", platform.Endpoint+"v1/"+platform.ProjectId+"/notebooks",
nil, in.Platform)
if err != nil {
return nil, err
}

View File

@ -40,11 +40,12 @@ func (l *ListServicesLogic) ListServices(in *modelarts.ListServicesReq) (*modela
} else {
limit = "10"
}
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
body, err := util.SendRequest("GET", ModelArtsUrl+"v1/"+projectId+"/services?offset="+offset+"&"+"limit="+limit,
bytes.NewBuffer([]byte("foo=bar")))
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
body, err := util.SendRequest("GET", platform.Endpoint+"v1/"+platform.ProjectId+"/services?offset="+offset+"&"+"limit="+limit,
bytes.NewBuffer([]byte("foo=bar")), in.Platform)
if err != nil {
return nil, err
}

View File

@ -30,10 +30,12 @@ func (l *ListTrainingJobConfigLogic) ListTrainingJobConfig(in *modelarts.ListTra
var resp modelarts.ListTrainingJobConfigResp
perPage := strconv.Itoa(int(in.PerPage))
page := strconv.Itoa(int(in.Page))
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
body, err := util.SendRequest("GET", ModelArtsUrl+"v1/"+projectId+"/training-job-configs?"+perPage+"&"+page,
bytes.NewBuffer([]byte("foo=bar")))
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
body, err := util.SendRequest("GET", platform.Endpoint+"v1/"+platform.ProjectId+"/training-job-configs?"+perPage+"&"+page,
bytes.NewBuffer([]byte("foo=bar")), in.Platform)
if err != nil {
return nil, err
}

View File

@ -27,12 +27,13 @@ func NewMountNotebookStorageLogic(ctx context.Context, svcCtx *svc.ServiceContex
func (l *MountNotebookStorageLogic) MountNotebookStorage(in *modelarts.MountNotebookStorageReq) (*modelarts.MountNotebookStorageResp, error) {
var resp modelarts.MountNotebookStorageResp
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
reqByte, err := json.Marshal(in)
body, err := util.SendRequest("POST", ModelArtsUrl+"v1/"+projectId+"/notebooks"+in.InstanceId+"/storage",
bytes.NewBuffer(reqByte))
body, err := util.SendRequest("POST", platform.Endpoint+"v1/"+platform.ProjectId+"/notebooks"+in.InstanceId+"/storage",
bytes.NewBuffer(reqByte), in.Platform)
if err != nil {
return nil, err
}

View File

@ -29,12 +29,13 @@ func NewShowAlgorithmByUuidLogic(ctx context.Context, svcCtx *svc.ServiceContext
func (l *ShowAlgorithmByUuidLogic) ShowAlgorithmByUuid(in *modelarts.ShowAlgorithmByUuidReq) (*modelarts.ShowAlgorithmByUuidResp, error) {
var resp modelarts.ShowAlgorithmByUuidResp
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
body, err := util.SendRequest("GET", ModelArtsUrl+"v2/"+projectId+"/algorithms/"+in.AlgorithmId,
bytes.NewBuffer([]byte("foo=bar")))
body, err := util.SendRequest("GET", platform.Endpoint+"v2/"+platform.ProjectId+"/algorithms/"+in.AlgorithmId,
bytes.NewBuffer([]byte("foo=bar")), in.Platform)
if err != nil {
return nil, err
}

View File

@ -29,13 +29,15 @@ func NewShowModelsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShowMo
}
func (l *ShowModelsLogic) ShowModels(in *modelarts.ShowModelReq) (*modelarts.ShowModelResp, error) {
// todo: add your logic here and delete this line
var resp modelarts.ShowModelResp
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
body, err := util.SendRequest("GET", ModelArtsUrl+"v1/"+projectId+"/models/"+in.ModelId,
nil)
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
body, err := util.SendRequest("GET", platform.Endpoint+"v1/"+platform.ProjectId+"/models/"+in.ModelId,
nil, in.Platform)
if err != nil {
return nil, err
}

View File

@ -29,14 +29,15 @@ func NewShowServiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShowS
}
func (l *ShowServiceLogic) ShowService(in *modelarts.ShowServiceReq) (*modelarts.ShowServiceResp, error) {
// todo: add your logic here and delete this line
var resp modelarts.ShowServiceResp
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
body, err := util.SendRequest("GET", ModelArtsUrl+"v1/"+projectId+"/services/"+in.ServiceId,
nil)
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
body, err := util.SendRequest("GET", platform.Endpoint+"v1/"+platform.ProjectId+"/services/"+in.ServiceId,
nil, in.Platform)
if err != nil {
return nil, err
}

View File

@ -27,12 +27,13 @@ func NewStartNotebookLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Sta
func (l *StartNotebookLogic) StartNotebook(in *modelarts.StartNotebookReq) (*modelarts.StartNotebookResp, error) {
var resp modelarts.StartNotebookResp
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
reqByte, err := json.Marshal(in)
body, err := util.SendRequest("POST", ModelArtsUrl+"v1/"+projectId+"/notebooks"+in.Id+"/start",
bytes.NewBuffer(reqByte))
body, err := util.SendRequest("POST", platform.Endpoint+"v1/"+platform.ProjectId+"/notebooks"+in.Id+"/start",
bytes.NewBuffer(reqByte), in.Platform)
if err != nil {
return nil, err
}

View File

@ -27,12 +27,13 @@ func NewStopNotebookLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Stop
func (l *StopNotebookLogic) StopNotebook(in *modelarts.StopNotebookReq) (*modelarts.StopNotebookResp, error) {
var resp modelarts.StopNotebookResp
projectId := l.svcCtx.Config.ModelArtsConf.ProjectId
ModelArtsUrl := l.svcCtx.Config.ModelArtsConf.Endpoint
platform, err := util.GetModelArtsConfWithPlatform(in.Platform)
if err != nil {
return nil, err
}
reqByte, err := json.Marshal(in)
body, err := util.SendRequest("POST", ModelArtsUrl+"v1/"+projectId+"/notebooks"+in.Id+"/stop",
bytes.NewBuffer(reqByte))
body, err := util.SendRequest("POST", platform.Endpoint+"v1/"+platform.ProjectId+"/notebooks"+in.Id+"/stop",
bytes.NewBuffer(reqByte), in.Platform)
if err != nil {
return nil, err
}

View File

@ -13,16 +13,33 @@ var FileName string
var C config.Config
// SignClient AK/SK签名认证
func SignClient(r *http.Request) (*http.Client, error) {
func SignClient(r *http.Request, Platform string) (*http.Client, error) {
var (
projectId string
ak string
sk string
)
switch Platform {
case C.ModelArtsConf.CloudBrain2.Platform:
projectId = C.ModelArtsConf.CloudBrain2.ProjectId
ak = C.ModelArtsConf.CloudBrain2.AK
sk = C.ModelArtsConf.CloudBrain2.SK
case C.ModelArtsConf.Njaci.Platform:
projectId = C.ModelArtsConf.CloudBrain2.ProjectId
ak = C.ModelArtsConf.Njaci.AK
sk = C.ModelArtsConf.Njaci.SK
default:
return nil, fmt.Errorf("platform %s not supported", Platform)
}
r.Header.Add("content-type", "application/json;charset=UTF-8")
r.Header.Add("X-Project-Id", C.ModelArtsConf.ProjectId)
r.Header.Add("X-Project-Id", projectId)
//r.Header.Add("X-Domain-Id", conf.DomainId)
r.Header.Add("x-stage", "RELEASE")
s := core.Signer{
Key: C.ModelArtsConf.AK,
Secret: C.ModelArtsConf.SK,
Key: ak,
Secret: sk,
}
err := s.Sign(r)
if err != nil {
@ -39,14 +56,14 @@ func SignClient(r *http.Request) (*http.Client, error) {
return client, nil
}
func SendRequest(method, url string, in io.Reader) (*[]byte, error) {
func SendRequest(method, url string, in io.Reader, Platform string) (*[]byte, error) {
r, err := http.NewRequest(method, url, in)
if err != nil {
fmt.Println("Error creating new request:", err)
return nil, err
}
signedR, err := SignClient(r)
signedR, err := SignClient(r, Platform)
if err != nil {
fmt.Println("Error signing request:", err)
return nil, err
@ -67,3 +84,16 @@ func SendRequest(method, url string, in io.Reader) (*[]byte, error) {
return &body, nil
}
func GetModelArtsConfWithPlatform(platform string) (*config.Conf, error) {
var conf config.Conf
switch platform {
case C.ModelArtsConf.CloudBrain2.Platform:
conf = C.ModelArtsConf.CloudBrain2
case C.ModelArtsConf.Njaci.Platform:
conf = C.ModelArtsConf.Njaci
default:
return nil, fmt.Errorf("platform not supported")
}
return &conf, nil
}

View File

@ -39,7 +39,7 @@ func (o AuthInfo) String() string {
// 容器镜像服务->生成临时登录指令 https://swr-api.cn-east-293.njaci.cn/v2/manage/utils/secret
func CreateSecretAsNjaci() (user, pwd string) {
resp := CreateSecretResponse{}
body, err := SendRequest("POST", NajsciSwrEndpoint, nil)
body, err := SendRequest("POST", NajsciSwrEndpoint, nil, "njaci")
if err != nil {
fmt.Println(err)

File diff suppressed because it is too large Load Diff

View File

@ -59,6 +59,7 @@ message DataSetReq{
int32 offset = 3; // @gotags: copier:"Offset"
string modelArtsType = 4; // @gotags: copier:"ModelArtsType"
string dataset_version = 5; // @gotags: copier:"dataset_version"
string platform = 6;
}
message DataSetResp{
@ -102,6 +103,7 @@ message ImportTaskDataReq{
string project_id = 2;
string import_path = 3;
string modelArtsType = 4; // @gotags: copier:"ModelArtsType"
string platform = 5;
}
message ImportTaskDataResp{
@ -122,6 +124,7 @@ message ListImportTasksReq{
int32 limit = 3; // @gotags: copier:"Limit"
int32 offset = 4; // @gotags: copier:"Offset"
string modelArtsType = 5; // @gotags: copier:"ModelArtsType"
string platform = 6;
}
@ -208,11 +211,13 @@ message ListTrainingJobsreq{
int32 limit = 2;//@gotags: copier:"Limit"
int32 offSet = 3;//@gotags: copier:"Offset"
string modelArtsType = 4; // @gotags: copier:"ModelArtsType"
string platform = 5;
}
message DetailTrainingJobsReq {
string project_id = 1;
string training_job_id = 2;
string platform = 3;
}
message ListTrainingJobsresp{
@ -502,6 +507,7 @@ message CreateTrainingJobReq {
MetadataS metadata = 2; // @gotags: copier:"Metadatas"
Algorithms algorithm = 3; // @gotags: copier:"AlgorithmsCtRq"
SpecsC spec = 4; // @gotags: copier:"SpecsCtRq"
string platform = 5;
}
//
message CreateTrainingJobResp{
@ -636,6 +642,7 @@ message CreateTrainingJobConfigReq {
repeated ParameterS parameter = 8;
string project_id = 9;
string modelArtsType = 10; // @gotags: copier:"ModelArtsType"
string platform = 11;
}
message ParameterS {
@ -656,6 +663,7 @@ message DeleteTrainingJobReq{
string project_id = 1; //@gotags: copier:"Project_id"
string training_job_id = 2; //@gotags: copier:"Training_job_id"
string modelArtsType = 3; // @gotags: copier:"ModelArtsType"
string platform = 4;
}
message DeleteTrainingJobResp{
int32 code = 1; //@gotags: copier:"Code"
@ -670,6 +678,7 @@ message DeleteTrainingJobConfigReq{
string project_id = 1;
string config_name = 2;
string modelArtsType = 3; // @gotags: copier:"ModelArtsType"
string platform = 4;
}
message DeleteTrainingJobConfigResp{
bool is_success = 1;
@ -692,6 +701,7 @@ message ListTrainingJobConfigReq{
string search_content = 6;
string config_type = 7;
string modelArtsType = 8; // @gotags: copier:"ModelArtsType"
string platform = 9;
}
message ListTrainingJobConfigResp{
@ -722,6 +732,7 @@ message CreateAlgorithmReq{
JobConfigAl job_config = 2; // @gotags: copier:"JobConfigCARq"
repeated ResourceRequirements resource_requirements = 3;// @gotags: copier:"ResourceRequirementsCARq"
AdvancedConfigAl advanced_config = 4;// @gotags: copier:"AdvancedConfigCARq"
string platform = 5;
}
message ResourceRequirements{
string key = 1;
@ -914,6 +925,7 @@ message ListAlgorithmsReq{
string project_id = 2; // @gotags: copier:"ProjectId"
int32 offset = 3; // @gotags: copier:"Offset"
int32 limit = 4; // @gotags: copier:"Limit"
string platform = 5;
}
message ListAlgorithmsResp{
@ -953,6 +965,7 @@ message DeleteAlgorithmsReq{
string project_id = 1; // @gotags: copier:"ProjectId"
string algorithm_id = 2; // @gotags: copier:"AlgorithmId"
string modelArtsType = 3; // @gotags: copier:"ModelArtsType"
string platform = 4;
}
message DeleteAlgorithmsResp{
@ -967,6 +980,7 @@ message ShowAlgorithmByUuidReq{
string project_id = 1; // @gotags: copier:"ProjectId"
string algorithm_id = 2; // @gotags: copier:"AlgorithmId"
string modelArtsType = 3; // @gotags: copier:"ModelArtsType"
string platform = 4;
}
message ShowAlgorithmByUuidResp{
@ -986,6 +1000,7 @@ message TrainingJobFlavorsReq{
string project_id = 1; // @gotags: copier:"ProjectId"
string flavor_type = 2; // @gotags: copier:"FlavorType"
string modelArtsType = 3; // @gotags: copier:"ModelArtsType"
string platform = 4;
}
message TrainingJobFlavorsResp{
@ -1001,6 +1016,7 @@ message TrainingJobFlavorsResp{
message ListAiEnginesReq{
string project_id = 1; // @gotags: copier:"ProjectId"
string modelArtsType = 2; // @gotags: copier:"ModelArtsType"
string platform = 3;
}
message ListAiEnginesResp{
@ -1045,6 +1061,7 @@ message ExportTaskReq{
string dataset_id = 13; // @gotags: copier:"DatasetId"
string project_id = 14; // @gotags: copier:"ProjectId"
string modelArtsType = 15; // @gotags: copier:"ModelArtsType"
string platform = 16;
}
message ExportTaskDataResp{
@ -1130,6 +1147,7 @@ message GetExportTasksOfDatasetReq{
int32 limit = 4; // @gotags: copier:"Limit"
int32 offset = 5; // @gotags: copier:"Offset"
string modelArtsType = 6; // @gotags: copier:"ModelArtsType"
string platform = 7;
}
message GetExportTasksOfDatasetResp{
@ -1180,6 +1198,7 @@ message GetExportTaskStatusOfDatasetReq{
string project_id = 2; // @gotags: copier:"ProjectId"
string task_id = 3; // @gotags: copier:"TaskId"
string modelArtsType = 4; // @gotags: copier:"ModelArtsType"
string platform = 5;
}
message GetExportTaskStatusOfDatasetResp{
@ -1219,6 +1238,7 @@ message CreateProcessorTaskReq{
WorkPath work_path = 9;
string workspace_id = 10;
string modelArtsType = 11; // @gotags: copier:"ModelArtsType"
string platform = 12;
}
message CreateProcessorTaskResp{
@ -1265,6 +1285,7 @@ message DescribeProcessorTaskReq{
string project_id = 1;
string task_id = 2;
string modelArtsType = 4; // @gotags: copier:"ModelArtsType"
string platform = 5;
}
message DescribeProcessorTaskResp{
@ -1317,6 +1338,7 @@ message CreateModelReq{
repeated string install_type = 23;
repeated CreateModelRequestInferParams input_params = 24;
string modelArtsType = 25; // @gotags: copier:"ModelArtsType"
string platform = 26;
}
message CreateModelResp{
@ -1383,6 +1405,7 @@ message DeleteModelReq{
string model_id = 2;
bool cascade = 3;
string modelArtsType = 4; // @gotags: copier:"ModelArtsType"
string platform = 5;
}
message DeleteModelResp{
@ -1413,6 +1436,7 @@ message ListModelReq{
string model_type = 10;
string not_model_type = 11;
string modelArtsType = 12; // @gotags: copier:"ModelArtsType"
string platform = 13;
}
message ListModelResp{
@ -1460,6 +1484,7 @@ message ShowModelReq{
string project_id = 1;
string model_id = 2;
string modelArtsType = 3; // @gotags: copier:"ModelArtsType"
string platform = 4;
}
message ShowModelResp{
@ -1536,6 +1561,7 @@ message CreateServiceReq{
repeated ServiceConfig config = 10; // @gotags: copier:"Config"
string project_id = 11; // @gotags: copier:"ProjectId"
string modelArtsType = 12; // @gotags: copier:"ModelArtsType"
string platform = 13;
}
message CreateServiceResp{
@ -1584,6 +1610,7 @@ message DeleteServiceReq{
string project_id = 1; // @gotags: copier:"ProjectId"
string service_id = 2; // @gotags: copier:"ServiceId"
string modelArtsType = 3; // @gotags: copier:"ModelArtsType"
string platform = 4;
}
message DeleteServiceResp{
@ -1600,6 +1627,7 @@ message ShowServiceReq{
string project_id = 1; // @gotags: copier:"ProjectId"
string service_id = 2; // @gotags: copier:"ServiceId"
string modelArtsType = 3; // @gotags: copier:"ModelArtsType"
string platform = 4;
}
message ShowServiceResp{
@ -1673,6 +1701,7 @@ message ListServicesReq{
int32 limit = 2;//@gotags: copier:"Limit"
int32 offSet = 3;//@gotags: copier:"Offset"
string modelArtsType = 4; // @gotags: copier:"ModelArtsType"
string platform = 5;
}
message ListServicesResp{
@ -1721,6 +1750,7 @@ message ListClustersReq{
string sort_by = 5; // @gotags: copier:"SortBy"
string order = 6; // @gotags: copier:"Order"
string modelArtsType = 7; // @gotags: copier:"ModelArtsType"
string platform = 8;
}
message ListClustersResp{
@ -1771,6 +1801,7 @@ message CreateDataSetReq {
ImportConfig import_config = 8; // @gotags: copier:"ImportConfig" json:"import_config"
int64 data_type = 9; // @gotags: copier:"DataType" json:"data_type"
int64 import_type = 10; // @gotags: copier:"ImportType" json:"import_type"
string platform = 11;
}
message CreateDataSetResq{
@ -1784,6 +1815,7 @@ message CreateDataSetResq{
/******************create dataset start*************************/
message DeleteDataSetReq {
string dataset_id = 2; // @gotags: copier:"DatasetId"
string platform = 3;
}
message DeleteDataSetResq{
@ -1798,6 +1830,7 @@ message ListNotebookReq{
string project_id = 1; // @gotags: copier:"ProjectId"
ListNotebookParam param = 2; // @gotags: copier:"Param"
string modelArtsType = 3; // @gotags: copier:"ModelArtsType"
string platform = 4;
}
message ListNotebookResp{
int32 current = 1; // @gotags: copier:"Current"
@ -1827,6 +1860,7 @@ message CreateNotebookReq{
string project_id = 1; // @gotags: copier:"ProjectId"
CreateNotebookParam param = 2; // @gotags: copier:"Param"
string modelArtsType = 3; // @gotags: copier:"ModelArtsType"
string platform = 4;
}
message CreateNotebookResp{
NotebookResp notebookResp = 1; // @gotags: copier:"NotebookResp"
@ -1854,7 +1888,7 @@ message StartNotebookReq{
string project_id = 2; // @gotags: copier:"ProjectId"
StartNotebookParam param = 3; // @gotags: copier:"Param"
string modelArtsType = 4; // @gotags: copier:"ModelArtsType"
string platform = 5;
}
message StartNotebookResp{
NotebookResp notebookResp = 1; // @gotags: copier:"NotebookResp"
@ -1871,7 +1905,7 @@ message StopNotebookReq{
string id = 1; // @gotags: copier:"Id"
string project_id = 2; // @gotags: copier:"ProjectId"
string modelArtsType = 3; // @gotags: copier:"ModelArtsType"
string platform = 4;
}
message StopNotebookResp{
NotebookResp notebookResp = 1; // @gotags: copier:"NotebookResp"
@ -1884,6 +1918,7 @@ message GetNotebookStorageReq{
string instance_id = 1; // @gotags: copier:"InstanceId"
string project_id = 2; // @gotags: copier:"ProjectId"
string modelArtsType = 3; // @gotags: copier:"ModelArtsType"
string platform = 4;
}
message GetNotebookStorageResp{
@ -1898,7 +1933,7 @@ message MountNotebookStorageReq{
string project_id = 2; // @gotags: copier:"ProjectId"
MountNotebookStorageParam param = 3; // @gotags: copier:"Param"
string modelArtsType = 4; // @gotags: copier:"ModelArtsType"
string platform = 5;
}
message MountNotebookStorageResp{
string category = 1; // @gotags: copier:"Category"
@ -2071,6 +2106,7 @@ message GetVisualizationJobReq{
string project_id = 1; // @gotags: copier:"project_id"
GetVisualizationJobParam param = 2; // @gotags: copier:"param"
string modelArtsType = 3; // @gotags: copier:"ModelArtsType"
string platform = 4;
}
message GetVisualizationJobResp{
bool is_success = 1; // @gotags: copier:"is_success"
@ -2105,6 +2141,7 @@ message CreateVisualizationJobReq{
string project_id = 1; // @gotags: copier:"project_id"
CreateVisualizationJobParam param = 2; // @gotags: copier:"param"
string modelArtsType = 3; // @gotags: copier:"ModelArtsType"
string platform = 4;
}
message CreateVisualizationJobResp{
string error_message = 1; // @gotags: copier:"error_message"
@ -2224,6 +2261,7 @@ message Errors {
message NamespaceReq {
string namespace = 1;
string kind = 2; // @gotags: copier:"kind"
string platform = 3;
}
//
@ -2240,6 +2278,7 @@ message ListNamespacesReq {
string namespace = 1; //
string filter = 2; //namespace::{namespace}|mode::{mode}{namespace},{mode},;visible,(:,)
string kind = 3; // @gotags: copier:"kind"
string platform = 4;
}
//
@ -2262,12 +2301,14 @@ message CreateRepoReq {
bool is_public = 4; //
string namespace = 5; //
string kind = 6; // @gotags: copier:"kind"
string platform = 7;
}
message DeleteRepoReq {
string namespace = 1; //
string repository = 2; //
string kind = 3; // @gotags: copier:"kind"
string platform = 4;
}
message ListRepoReq {
@ -2281,6 +2322,7 @@ message ListRepoReq {
string filter = 8; //使filter至少要传递一个filter参数 namespace::
string kind = 9; // @gotags: copier:"kind"
string id = 10; // @gotags: copier:"id"
string platform = 11;
}
message ReposDetails {
@ -2314,6 +2356,7 @@ message ShowRepositoryReq {
string namespace = 1 ; //,线线(线,线线),,1-64
string repository = 2; //
string kind = 3; // @gotags: copier:"kind"
string platform = 4;
}
message ShowRepositoryResp {
@ -2344,6 +2387,7 @@ message UpdateRepoReq{
string kind = 4; // @gotags: copier:"kind"
string namespace = 5; //
string repository = 6; //
string platform = 7;
}
message ListRepositoryTagsReq {
@ -2356,6 +2400,7 @@ message ListRepositoryTagsReq {
string order_type = 7; //descasc
string filter = 8; //使filter至少要传递一个filter参数 namespace::
string kind = 9; // @gotags: copier:"kind"
string platform = 10;
}
message ListRepositoryTagsResp {
@ -2388,6 +2433,7 @@ message DeleteRepoTagReq{
string repository = 2; //
string tag = 3; //
string Kind = 4; // @gotags: copier:"kind"
string platform = 5;
}
//FileRequest

View File

@ -3,6 +3,7 @@
GRPC localhost:2002/modelarts.ModelArtsService/CreateTrainingJob
{
"platform": "modelarts-CloudBrain2",
"kind": "job",
"metadata": {
"name": "pcm-job-5c4e-9d0c",
@ -45,6 +46,7 @@ GRPC localhost:2002/modelarts.ModelArtsService/CreateTrainingJob
GRPC localhost:2002/modelarts.ModelArtsService/CreateTrainingJob
{
"platform": "modelarts-CloudBrain2",
"kind": "job",
"metadata": {
"name": "pcm-job-b331",
@ -80,6 +82,7 @@ GRPC localhost:2002/modelarts.ModelArtsService/CreateTrainingJob
GRPC localhost:2002/modelarts.ModelArtsService/CreateTrainingJob
{
"platform": "modelarts-CloudBrain2",
"kind": "job",
"metadata": {
"name": "pcm-job-f6db",
@ -116,11 +119,12 @@ GRPC localhost:2002/modelarts.ModelArtsService/CreateTrainingJob
GRPC localhost:2002/modelarts.ModelArtsService/GetListTrainingJobs
{
"platform": "modelarts-CloudBrain2"
}
### 获取训练作业支持的公共规格
GRPC localhost:2002/modelarts.ModelArtsService/GetTrainingJobFlavors
{
"platform": "modelarts-CloudBrain2"
}

View File

@ -4,14 +4,14 @@ GRPC localhost:2002/modelarts.imagesService/CreateNamespace
{
"namespace": "jcce-test",
"kind": "modelarts"
"platform": "modelarts-CloudBrain2"
}
### 查询组织列表
GRPC localhost:2002/modelarts.imagesService/ListNamespaces
{
"kind": "modelarts"
"platform": "modelarts-CloudBrain2"
}
### 删除组织
@ -19,7 +19,7 @@ GRPC localhost:2002/modelarts.imagesService/DeleteNamespaces
{
"namespace": "jcce-test",
"kind": "modelarts"
"platform": "modelarts-CloudBrain2"
}
### 获取组织详情
@ -27,7 +27,7 @@ GRPC localhost:2002/modelarts.imagesService/ShowNamespace
{
"namespace": "cloudream",
"kind": "modelarts"
"platform": "modelarts-CloudBrain2"
}
### 在组织下创建镜像仓库
@ -39,13 +39,14 @@ GRPC localhost:2002/modelarts.imagesService/CreateRepo
"category" : "linux",
"description" : "this is a busybox repository",
"is_public" : true,
"kind": "modelarts"
"platform": "modelarts-CloudBrain2"
}
### 查询镜像仓库列表
GRPC localhost:2002/modelarts.imagesService/ListReposDetails
{
"platform": "modelarts-CloudBrain2"
}

View File

@ -4,14 +4,14 @@ GRPC localhost:2002/modelarts.imagesService/CreateNamespace
{
"namespace": "jcce-test",
"kind": "njaci"
"platform": "modelarts-njaci"
}
### 查询组织列表
GRPC localhost:2002/modelarts.imagesService/ListNamespaces
{
"kind": "njaci"
"platform": "modelarts-njaci"
}
### 删除组织
@ -19,7 +19,7 @@ GRPC localhost:2002/modelarts.imagesService/DeleteNamespaces
{
"namespace": "jcce-test",
"kind": "njaci"
"platform": "modelarts-njaci"
}
### 获取组织详情
@ -27,7 +27,7 @@ GRPC localhost:2002/modelarts.imagesService/ShowNamespace
{
"namespace": "jcce-test",
"kind": "njaci"
"platform": "modelarts-njaci"
}
### 在组织下创建镜像仓库
@ -39,15 +39,17 @@ GRPC localhost:2002/modelarts.imagesService/CreateRepo
"repository": "maven",
"category": "linux",
"description": "this is a busybox repository",
"is_public": true
"is_public": true,
"platform": "modelarts-njaci"
}
### 查询镜像仓库列表
GRPC localhost:2002/modelarts.imagesService/ListReposDetails
{
"platform": "modelarts-njaci",
"offset": 0,
"limit": 20
"limit": 100
// "namespace": "pcl"
}
@ -58,7 +60,7 @@ GRPC localhost:2002/modelarts.imagesService/ShowRepository
{
"namespace": "jcce-test",
"repository": "maven",
"kind": "njaci"
"platform": "modelarts-njaci"
}
### 删除组织下的镜像仓库
@ -67,7 +69,7 @@ GRPC localhost:2002/modelarts.imagesService/DeleteRepo
{
"namespace": "jcce-test",
"repository": "maven",
"kind": "njaci"
"platform": "modelarts-njaci"
}
### 查询镜像tag列表
@ -75,7 +77,8 @@ GRPC localhost:2002/modelarts.imagesService/ListRepositoryTags
{
"namespace": "custom-image",
"repository": "rsc_psi-23da563f4ecb9ce375ae00d455bbb7c4"
"repository": "rsc_psi-23da563f4ecb9ce375ae00d455bbb7c4",
"platform": "modelarts-njaci"
}
### 更新镜像仓库的概要信息
@ -87,7 +90,8 @@ GRPC localhost:2002/modelarts.imagesService/UpdateRepo
"kind": "njaci",
"category": "linux",
"description": "This is the JCCE Maven base image 111",
"is_public": false
"is_public": false,
"platform": "modelarts-njaci"
}
### 删除指定tag的镜像
@ -97,5 +101,6 @@ GRPC localhost:2002/modelarts.imagesService/DeleteRepoTag
"namespace": "jcce-test",
"repository": "maven",
"tag": "3",
"Kind": "njaci"
"Kind": "njaci",
"platform": "modelarts-njaci"
}

View File

@ -3,6 +3,7 @@
GRPC localhost:2003/modelarts.ModelArtsService/CreateTrainingJob
{
"platform": "modelarts-njaci",
"kind": "job",
"metadata": {
"name": "pcm-job-5c4e-9d0c",
@ -45,6 +46,7 @@ GRPC localhost:2003/modelarts.ModelArtsService/CreateTrainingJob
GRPC localhost:2002/modelarts.ModelArtsService/CreateTrainingJob
{
"platform": "modelarts-njaci",
"kind": "job",
"metadata": {
"name": "job-b190-9c219",
@ -55,7 +57,7 @@ GRPC localhost:2002/modelarts.ModelArtsService/CreateTrainingJob
},
"algorithm": {
"engine": {
"image_url": "nudt-cloudream/redis:latest"
"image_url": "cloudream/maven:3"
},
"code_dir": "",
"command": "sleep;",
@ -86,6 +88,7 @@ GRPC localhost:2002/modelarts.ModelArtsService/CreateTrainingJob
GRPC localhost:2003/modelarts.ModelArtsService/CreateTrainingJob
{
"platform": "modelarts-njaci",
"kind": "job",
"metadata": {
"name": "pcm-job-f6db",
@ -122,25 +125,28 @@ GRPC localhost:2003/modelarts.ModelArtsService/CreateTrainingJob
GRPC localhost:2002/modelarts.ModelArtsService/GetListTrainingJobs
{
"platform": "modelarts-njaci"
}
### 获取训练作业支持的公共规格
GRPC localhost:2003/modelarts.ModelArtsService/GetTrainingJobFlavors
GRPC localhost:2002/modelarts.ModelArtsService/GetTrainingJobFlavors
{
"platform": "modelarts-njaci"
}
### 查询训练详情
GRPC localhost:2002/modelarts.ModelArtsService/GetTrainingJobs
{
"training_job_id": "7dd6892d-5456-4707-8291-10de93405308"
"platform": "modelarts-njaci",
"training_job_id": "7dd6892d-5456-4707-8291-10de93405308"
}
### 删除训练作业
GRPC localhost:2002/modelarts.ModelArtsService/DeleteTrainingJob
{
"platform": "modelarts-njaci",
"training_job_id": "7dd6892d-5456-4707-8291-10de93405308"
}