调整AICore

This commit is contained in:
tzwang 2023-03-08 17:39:02 +08:00
parent f30dbfd11b
commit ff5fd3d07b
21 changed files with 920 additions and 73 deletions

View File

@ -318,6 +318,17 @@ type (
)
/******************ListTrainingJobs end*************************/
/******************DeleteTrainingJob start*************************/
type (
DeleteTrainingJobReq {
Project_id string `json:"total"`
Training_job_id string `json:"total"`
}
DeleteTrainingJobResp {
}
)
/******************DeleteTrainingJob end*************************/
/******************ListAlgorithms start*************************/
type AlgorithmResponse {
MetadataAlRp MetadataAlRp `json:"metadata,optional"`
@ -757,6 +768,86 @@ type (
Status string `json:"status"`
WorkspaceId string `json:"workspaceId"`
}
CreateNotebookReq {
Project_id string `json:"project_id"`
Param CreateNotebookParam `json:"param"`
}
CreateNotebookResp {
NotebookResp NotebookResp `json:"notebookResp"`
}
CreateNotebookParam {
Description string `json:"description"`
Duration int64 `json:"duration"`
Endpoints []EndpointsReq `json:"endpoints"`
Feature string `json:"feature"`
Flavor string `json:"flavor"`
Image_id string `json:"image_id"`
Name string `json:"name"`
Pool_id string `json:"pool_id"`
Volume VolumeReq `json:"volume"`
Workspace_id string `json:"workspace_id"`
Hooks CustomHooks `json:"hooks"`
Lease LeaseReq `json:"lease"`
}
StartNotebookReq {
Id string `json:"id"`
Project_id string `json:"project_id"`
Param StartNotebookParam `json:"param"`
}
StartNotebookResp {
NotebookResp NotebookResp `json:"notebookResp"`
}
StartNotebookParam {
Duration int64 `json:"duration"`
Type_start_notebook string `json:"type"`
}
StopNotebookReq {
Id string `json:"id"`
Project_id string `json:"project_id"`
}
StopNotebookResp {
NotebookResp NotebookResp `json:"notebookResp"`
}
GetNotebookStorageReq {
Instance_id string `json:"instance_id"`
Project_id string `json:"project_id"`
}
GetNotebookStorageResp {
Current int32 `json:"current"`
Data []DataVolumesRes `json:"data"`
Pages int32 `json:"pages"`
Size int32 `json:"size"`
Total int64 `json:"total"`
}
MountNotebookStorageReq {
Instance_id string `json:"instance_id"`
Project_id string `json:"project_id"`
Param MountNotebookStorageParam `json:"param"`
}
MountNotebookStorageResp {
Category string `json:"category"`
Id string `json:"id"`
Mount_path string `json:"mount_path"`
Status string `json:"status"`
Uri string `json:"uri"`
}
MountNotebookStorageParam {
Category string `json:"category"`
Mount_path string `json:"mount_path"`
Uri string `json:"uri"`
}
DataVolumesRes {
Category string `json:"category"`
Id string `json:"id"`
Mount_path string `json:"mount_path"`
Status string `json:"status"`
Uri string `json:"uri"`
}
NotebookResp {
Action_progress []JobProgress `json:"action_progress"`
Description string `json:"description"`
@ -826,9 +917,102 @@ type (
Ownership string `json:"ownership"`
Status string `json:"status"`
}
EndpointsReq {
Allowed_access_ips []string `json:"allowed_access_ips"`
Dev_service string `json:"dev_service"`
Ssh_keys []string `json:"ssh_keys"`
}
VolumeReq {
Capacity int64 `json:"capacity"`
Category string `json:"category"`
Ownership string `json:"ownership"`
Uri string `json:"uri"`
}
CustomHooks {
Container_hooks ContainerHooks `json:"container_hooks"`
}
ContainerHooks {
Post_start Config `json:"post_start"`
Pre_start Config `json:"pre_start"`
}
Config {
Script string `json:"script"`
Type_config string `json:"type"`
}
LeaseReq {
Duration int64 `json:"duration"`
Type_lease_req string `json:"type"`
}
)
/******************Notebook Type end*************************/
/******************Visualization Job Start*************************/
type (
GetVisualizationJobReq {
Project_id string `json:"project_id"`
Param GetVisualizationJobParam `json:"param"`
}
GetVisualizationJobResp {
Is_success bool `json:"is_success"`
Error_code string `json:"error_code"`
Error_message string `json:"error_message"`
Job_total_count int32 `json:"job_total_count"`
Job_count_limit int32 `json:"job_count_limit"`
Jobs []jobs `json:"jobs"`
Quotas int32 `json:"quotas"`
}
jobs {
Job_name string `json:"job_name"`
Status int32 `json:"status"`
Create_time int64 `json:"create_time"`
Duration int64 `json:"duration"`
Job_desc string `json:"job_desc"`
Service_url string `json:"service_url"`
Train_url string `json:"train_url"`
Job_id string `json:"job_id"`
Resource_id string `json:"resource_id"`
}
GetVisualizationJobParam {
Status string `json:"status"`
Per_page int32 `json:"per_page"`
Page int32 `json:"page"`
SortBy string `json:"sortBy"`
Order string `json:"order"`
Search_content string `json:"search_content"`
Workspace_id string `json:"workspace_id"`
}
CreateVisualizationJobReq {
Project_id string `json:"project_id"`
Param CreateVisualizationJobParam `json:"param"`
}
CreateVisualizationJobResp {
Error_message string `json:"error_message"`
Error_code string `json:"error_code"`
Job_id int64 `json:"job_id"`
Job_name string `json:"job_name"`
Status int32 `json:"status"`
Create_time int64 `json:"create_time"`
Service_url string `json:"service_url"`
}
CreateVisualizationJobParam {
Job_name string `json:"job_name"`
Job_desc string `json:"job_desc"`
Train_url string `json:"train_url"`
Job_type string `json:"job_type"`
Flavor flavor `json:"flavor"`
Schedule schedule `json:"schedule"`
}
flavor {
Code string `json:"code"`
}
schedule {
Type_schedule string `json:"type"`
Time_unit string `json:"time_unit"`
Duration int32 `json:"duration"`
}
)
/******************Visualization Job End*************************/
/******************CreateAlgorithm end*************************/
service AICore-api {
@ -843,6 +1027,9 @@ service AICore-api {
// ListTrainingJobs 查询训练作业列表
@handler GetListTrainingJobsHandler
get /GetListTrainingJobs (ListTrainingJobsreq) returns (ListTrainingJobsresp)
// DeleteTrainingJob 删除训练作业
@handler DeleteTrainingJobHandler
delete /DeleteTrainingJob (DeleteTrainingJobReq) returns (DeleteTrainingJobResp)
// CreateAlgorithm 创建算法
@handler CreateAlgorithmHandler
post /CreateAlgorithm (CreateAlgorithmReq) returns (CreateAlgorithmResp)
@ -879,5 +1066,22 @@ service AICore-api {
/******************Notebook Method start*************************/
@handler listNotebookHandler
get /listNotebook (ListNotebookReq) returns (ListNotebookResp)
@handler createNotebookHandler
post /createNotebook (CreateNotebookReq) returns (CreateNotebookResp)
@handler startNotebookHandler
post /startNotebook (StartNotebookReq) returns (StartNotebookResp)
@handler stopNotebookHandler
post /stopNotebook (StopNotebookReq) returns (StopNotebookResp)
@handler getNotebookStorageHandler
get /getNotebookStorage (GetNotebookStorageReq) returns (GetNotebookStorageResp)
@handler mountNotebookStorageHandler
post /mountNotebookStorage (MountNotebookStorageReq) returns (MountNotebookStorageResp)
/******************Notebook Method end*************************/
/******************Visualization Job Method start*************************/
@handler getVisualizationJobHandler
get /getVisualizationJob (GetVisualizationJobReq) returns (GetVisualizationJobResp)
@handler createVisualizationJobHandler
post /CreateVisualizationJob (CreateVisualizationJobReq) returns (CreateVisualizationJobResp)
/******************Visualization Job Method start*************************/
}

View File

@ -0,0 +1,28 @@
package handler
import (
"net/http"
"PCM/adaptor/AIComputing/AICore/api/internal/logic"
"PCM/adaptor/AIComputing/AICore/api/internal/svc"
"PCM/adaptor/AIComputing/AICore/api/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func CreateAlgorithmHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CreateAlgorithmReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := logic.NewCreateAlgorithmLogic(r.Context(), svcCtx)
resp, err := l.CreateAlgorithm(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,28 @@
package handler
import (
"net/http"
"PCM/adaptor/AIComputing/AICore/api/internal/logic"
"PCM/adaptor/AIComputing/AICore/api/internal/svc"
"PCM/adaptor/AIComputing/AICore/api/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func CreateExportTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CreateExportTaskReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := logic.NewCreateExportTaskLogic(r.Context(), svcCtx)
resp, err := l.CreateExportTask(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,28 @@
package handler
import (
"net/http"
"PCM/adaptor/AIComputing/AICore/api/internal/logic"
"PCM/adaptor/AIComputing/AICore/api/internal/svc"
"PCM/adaptor/AIComputing/AICore/api/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func createNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CreateNotebookReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := logic.NewCreateNotebookLogic(r.Context(), svcCtx)
resp, err := l.CreateNotebook(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,28 @@
package handler
import (
"net/http"
"PCM/adaptor/AIComputing/AICore/api/internal/logic"
"PCM/adaptor/AIComputing/AICore/api/internal/svc"
"PCM/adaptor/AIComputing/AICore/api/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func createServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CreateServiceReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := logic.NewCreateServiceLogic(r.Context(), svcCtx)
resp, err := l.CreateService(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,28 @@
package handler
import (
"net/http"
"PCM/adaptor/AIComputing/AICore/api/internal/logic"
"PCM/adaptor/AIComputing/AICore/api/internal/svc"
"PCM/adaptor/AIComputing/AICore/api/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func createVisualizationJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CreateVisualizationJobReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := logic.NewCreateVisualizationJobLogic(r.Context(), svcCtx)
resp, err := l.CreateVisualizationJob(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,28 @@
package handler
import (
"net/http"
"PCM/adaptor/AIComputing/AICore/api/internal/logic"
"PCM/adaptor/AIComputing/AICore/api/internal/svc"
"PCM/adaptor/AIComputing/AICore/api/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func DeleteAlgorithmHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.DeleteAlgorithmReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := logic.NewDeleteAlgorithmLogic(r.Context(), svcCtx)
resp, err := l.DeleteAlgorithm(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,28 @@
package handler
import (
"net/http"
"PCM/adaptor/AIComputing/AICore/api/internal/logic"
"PCM/adaptor/AIComputing/AICore/api/internal/svc"
"PCM/adaptor/AIComputing/AICore/api/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func DeleteServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.DeleteServiceReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := logic.NewDeleteServiceLogic(r.Context(), svcCtx)
resp, err := l.DeleteService(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,28 @@
package handler
import (
"net/http"
"PCM/adaptor/AIComputing/AICore/api/internal/logic"
"PCM/adaptor/AIComputing/AICore/api/internal/svc"
"PCM/adaptor/AIComputing/AICore/api/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func DeleteTrainingJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.DeleteTrainingJobReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := logic.NewDeleteTrainingJobLogic(r.Context(), svcCtx)
resp, err := l.DeleteTrainingJob(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,28 @@
package handler
import (
"net/http"
"PCM/adaptor/AIComputing/AICore/api/internal/logic"
"PCM/adaptor/AIComputing/AICore/api/internal/svc"
"PCM/adaptor/AIComputing/AICore/api/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func getNotebookStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetNotebookStorageReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := logic.NewGetNotebookStorageLogic(r.Context(), svcCtx)
resp, err := l.GetNotebookStorage(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,28 @@
package handler
import (
"net/http"
"PCM/adaptor/AIComputing/AICore/api/internal/logic"
"PCM/adaptor/AIComputing/AICore/api/internal/svc"
"PCM/adaptor/AIComputing/AICore/api/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func getVisualizationJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetVisualizationJobReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := logic.NewGetVisualizationJobLogic(r.Context(), svcCtx)
resp, err := l.GetVisualizationJob(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,28 @@
package handler
import (
"net/http"
"PCM/adaptor/AIComputing/AICore/api/internal/logic"
"PCM/adaptor/AIComputing/AICore/api/internal/svc"
"PCM/adaptor/AIComputing/AICore/api/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func ListAlgorithmsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ListAlgorithmsReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := logic.NewListAlgorithmsLogic(r.Context(), svcCtx)
resp, err := l.ListAlgorithms(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,28 @@
package handler
import (
"net/http"
"PCM/adaptor/AIComputing/AICore/api/internal/logic"
"PCM/adaptor/AIComputing/AICore/api/internal/svc"
"PCM/adaptor/AIComputing/AICore/api/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func ListClustersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ListClustersReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := logic.NewListClustersLogic(r.Context(), svcCtx)
resp, err := l.ListClusters(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,28 @@
package handler
import (
"net/http"
"PCM/adaptor/AIComputing/AICore/api/internal/logic"
"PCM/adaptor/AIComputing/AICore/api/internal/svc"
"PCM/adaptor/AIComputing/AICore/api/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func ListServicesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ListServicesReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := logic.NewListServicesLogic(r.Context(), svcCtx)
resp, err := l.ListServices(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,28 @@
package handler
import (
"net/http"
"PCM/adaptor/AIComputing/AICore/api/internal/logic"
"PCM/adaptor/AIComputing/AICore/api/internal/svc"
"PCM/adaptor/AIComputing/AICore/api/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func mountNotebookStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MountNotebookStorageReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := logic.NewMountNotebookStorageLogic(r.Context(), svcCtx)
resp, err := l.MountNotebookStorage(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -32,6 +32,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/GetListTrainingJobs",
Handler: GetListTrainingJobsHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/DeleteTrainingJob",
Handler: DeleteTrainingJobHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/CreateAlgorithm",
@ -42,16 +47,36 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/ListAlgorithms",
Handler: ListAlgorithmsHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/DeleteAlgorithm",
Handler: DeleteAlgorithmHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/CreateExportTask",
Handler: CreateExportTaskHandler(serverCtx),
},
{
Method: http.MethodGet,
Method: http.MethodPost,
Path: "/CreateService",
Handler: CreateServiceHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/ListServices",
Handler: ListServicesHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/ShowService",
Handler: ShowServiceHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/DeleteService",
Handler: DeleteServiceHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/ListClusters",

View File

@ -0,0 +1,28 @@
package handler
import (
"net/http"
"PCM/adaptor/AIComputing/AICore/api/internal/logic"
"PCM/adaptor/AIComputing/AICore/api/internal/svc"
"PCM/adaptor/AIComputing/AICore/api/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func ShowServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ShowServiceReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := logic.NewShowServiceLogic(r.Context(), svcCtx)
resp, err := l.ShowService(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,28 @@
package handler
import (
"net/http"
"PCM/adaptor/AIComputing/AICore/api/internal/logic"
"PCM/adaptor/AIComputing/AICore/api/internal/svc"
"PCM/adaptor/AIComputing/AICore/api/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func startNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.StartNotebookReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := logic.NewStartNotebookLogic(r.Context(), svcCtx)
resp, err := l.StartNotebook(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,28 @@
package handler
import (
"net/http"
"PCM/adaptor/AIComputing/AICore/api/internal/logic"
"PCM/adaptor/AIComputing/AICore/api/internal/svc"
"PCM/adaptor/AIComputing/AICore/api/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func stopNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.StopNotebookReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := logic.NewStopNotebookLogic(r.Context(), svcCtx)
resp, err := l.StopNotebook(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,30 @@
package logic
import (
"context"
"PCM/adaptor/AIComputing/AICore/api/internal/svc"
"PCM/adaptor/AIComputing/AICore/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type DeleteTrainingJobLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewDeleteTrainingJobLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteTrainingJobLogic {
return &DeleteTrainingJobLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *DeleteTrainingJobLogic) DeleteTrainingJob(req *types.DeleteTrainingJobReq) (resp *types.DeleteTrainingJobResp, err error) {
// todo: add your logic here and delete this line
return
}

View File

@ -53,13 +53,13 @@ type ImportTaskDataResp struct {
}
type CreateExportTaskReq struct {
ProjectId string `json:"project_id"`
DatasetId string `json:"dataset_id"`
ExportPath string `json:"export_path"`
ProjectId string `json:"project_id" copier:"ProjectId"`
DatasetId string `json:"dataset_id" copier:"DatasetId"`
Path string `json:"path" copier:"Path"`
}
type CreateExportTaskResp struct {
TaskId string `json:"task_id"`
TaskId string `json:"task_id" copier:"SlurmVersion"`
}
type ListImportTasksReq struct {
@ -318,6 +318,14 @@ type ListTrainingJobsresp struct {
Items []Items `json:"items"`
}
type DeleteTrainingJobReq struct {
Project_id string `json:"total"`
Training_job_id string `json:"total"`
}
type DeleteTrainingJobResp struct {
}
type AlgorithmResponse struct {
MetadataAlRp MetadataAlRp `json:"metadata,optional"`
JobConfigAlRp JobConfigAlRp `json:"job_config,optional"`
@ -444,107 +452,203 @@ type SearchParams struct {
}
type CreateServiceReq struct {
WorkspaceId string `json:"workspaceId" copier:"TotCpuUsec"`
Schedule Scheduler `json:"schedule"`
ClusterId string `json:"clusterId"`
InferType string `json:"inferType"`
VpcId string `json:"vpcId"`
ServiceName string `json:"serviceName"`
Description string `json:"description"`
SecurityGroupId string `json:"securityGroupId"`
SubnetNetworkId string `json:"subnetNetworkId"`
Config []ServiceConfig `json:"config"`
ProjectId string `json:"projectId"`
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"`
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"`
}
type CreateServiceResp struct {
Code uint32 `json:"code"`
ServiceId string `json:"serviceId"`
ResourceIds []string `json:"resourceIds"`
Code uint32 `json:"code,optional" copier:"Code"`
ServiceId string `json:"serviceId,optional" copier:"ServiceId"`
ResourceIds []string `json:"resourceIds,optional" copier:"ResourceIds"`
}
type Scheduler struct {
Duration int32 `json:"duration"`
TimeUnit string `json:"timeUnit"`
Type string `json:"type"`
Duration int32 `json:"duration,optional" copier:"Duration"`
TimeUnit string `json:"timeUnit,optional" copier:"TimeUnit"`
Type string `json:"type,optional" copier:"Type"`
}
type ServiceConfig struct {
CustomSpec CustomSpec `json:"customSpec"`
Envs map[string]string `json:"envs"`
Specification string `json:"specification"`
Weight int32 `json:"weight"`
ModelId string `json:"modelId"`
SrcPath string `json:"srcPath"`
ReqUri string `json:"reqUri"`
MappingType string `json:"mappingType"`
ClusterId string `json:"clusterId"`
Nodes []string `json:"nodes"`
SrcType string `json:"srcType"`
DestPath string `json:"destPath"`
InstanceCount int32 `json:"instanceCount"`
CustomSpec CustomSpec `json:"customSpec,optional" copier:"CustomSpec"`
Envs map[string]string `json:"envs,optional" copier:"Envs"`
Specification string `json:"specification,optional" copier:"Specification"`
Weight int32 `json:"weight,optional" copier:"Weight"`
ModelId string `json:"modelId,optional" copier:"ModelId"`
SrcPath string `json:"srcPath,optional" copier:"SrcPath"`
ReqUri string `json:"reqUri,optional" copier:"ReqUri"`
MappingType string `json:"mappingType,optional" copier:"MappingType"`
ClusterId string `json:"clusterId,optional" copier:"ClusterId"`
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"`
}
type CustomSpec struct {
GpuP4 float64 `json:"gpuP4"`
Memory int64 `json:"memory"`
Cpu float64 `json:"cpu"`
AscendA310 int64 `json:"ascendA310"`
GpuP4 float64 `json:"gpuP4,optional" copier:"GpuP4"`
Memory int64 `json:"memory,optional" copier:"Memory"`
Cpu float64 `json:"cpu,optional" copier:"Cpu"`
AscendA310 int64 `json:"ascendA310,optional" copier:"AscendA310"`
}
type DeleteServiceReq struct {
ProjectId string `json:"projectId" copier:"project_id"`
ServiceId string `json:"serviceId" copier:"service_id"`
ProjectId string `json:"projectId" copier:"ProjectId"`
ServiceId string `json:"serviceId" copier:"ServiceId"`
}
type DeleteServiceResp struct {
}
type ListServicesReq struct {
ProjectId string `json:"projectId" copier:"ProjectId"`
}
type ListServicesResp struct {
Code int32 `json:"code,omitempty" copier:"Code"`
TotalCount int32 `json:"total_count,omitempty" copier:"TotalCount"`
Count int32 `json:"count,omitempty" copier:"Count"`
Services []ListServices `json:"services,omitempty" copier:"Services"`
}
type ListServices struct {
FailedTimes uint32 `json:"failed_times,omitempty" copier:"FailedTimes"`
Owner string `json:"owner,omitempty" copier:"Owner"`
DueTime int32 `json:"due_time,omitempty" copier:"DueTime"`
FinishedTime int32 `json:"finished_time,omitempty" copier:"FinishedTime"`
InferType string `json:"infer_type,omitempty" copier:"InferType"`
ServiceName string `json:"service_name,omitempty" copier:"ServiceName"`
Description string `json:"description,omitempty" copier:"Description"`
Project string `json:"project,omitempty" copier:"Project"`
InvocationTimes uint32 `json:"invocation_times,omitempty" copier:"InvocationTimes"`
PublishAt uint32 `json:"publish_at,omitempty" copier:"PublishAt"`
WorkspaceId string `json:"workspace_id,omitempty" copier:"WorkspaceId"`
Scheduler []*Scheduler `json:"scheduler,omitempty" copier:"Scheduler"`
StartTime int32 `json:"start_time,omitempty" copier:"StartTime"`
OperationTime string `json:"operation_time,omitempty" copier:"OperationTime"`
IsShared bool `json:"is_shared,omitempty" copier:"IsShared"`
ServiceId string `json:"service_id,omitempty" copier:"ServiceId"`
Progress int32 `json:"progress,omitempty" copier:"Progress"`
SharedCount int32 `json:"shared_count,omitempty" copier:"SharedCount"`
Tenant string `json:"tenant,omitempty" copier:"Tenant"`
Status string `json:"status,omitempty" copier:"Status"`
IsOpenedSampleCollection string `json:"is_opened_sample_collection,omitempty" copier:"IsOpenedSampleCollection"`
TransitionAt int32 `json:"transition_at,omitempty" copier:"TransitionAt"`
IsFree bool `json:"is_free,omitempty" copier:"IsFree"`
AdditionalProperties map[string]string `json:"additional_properties,omitempty" copier:"AdditionalProperties"`
}
type ShowServiceReq struct {
ProjectId string `json:"projectId" copier:"project_id"`
ServiceId string `json:"serviceId" copier:"service_id"`
ProjectId string `json:"projectId" copier:"ProjectId"`
ServiceId string `json:"serviceId" copier:"ServiceId"`
}
type ShowServiceResp struct {
Owner string `json:"owner" copier:"owner"`
FailedTimes uint32 `json:"failed_times,omitempty" copier:"FailedTimes"`
Owner string `json:"owner,omitempty" copier:"Owner"`
DueTime int32 `json:"due_time,omitempty" copier:"DueTime"`
FinishedTime int32 `json:"finished_time,omitempty" copier:"FinishedTime"`
InferType string `json:"infer_type,omitempty" copier:"InferType"`
ServiceName string `json:"service_name,omitempty" copier:"ServiceName"`
Description string `json:"description,omitempty" copier:"Description"`
Project string `json:"project,omitempty" copier:"Project"`
InvocationTimes uint32 `json:"invocation_times,omitempty" copier:"InvocationTimes"`
PublishAt uint32 `json:"publish_at,omitempty" copier:"PublishAt"`
WorkspaceId string `json:"workspace_id,omitempty" copier:"WorkspaceId"`
Scheduler []Scheduler `json:"scheduler,omitempty" copier:"Scheduler"`
StartTime int32 `json:"start_time,omitempty" copier:"StartTime"`
OperationTime string `json:"operation_time,omitempty" copier:"OperationTime"`
IsShared bool `json:"is_shared,omitempty" copier:"IsShared"`
ServiceId string `json:"service_id,omitempty" copier:"ServiceId"`
Progress int32 `json:"progress,omitempty" copier:"Progress"`
SharedCount int32 `json:"shared_count,omitempty" copier:"SharedCount"`
Tenant string `json:"tenant,omitempty" copier:"Tenant"`
Status string `json:"status,omitempty" copier:"Status"`
IsOpenedSampleCollection string `json:"is_opened_sample_collection,omitempty" copier:"IsOpenedSampleCollection"`
TransitionAt int32 `json:"transition_at,omitempty" copier:"TransitionAt"`
IsFree bool `json:"is_free,omitempty" copier:"IsFree"`
AdditionalProperties map[string]string `json:"additional_properties,omitempty" copier:"AdditionalProperties"`
ClusterId string `json:"cluster_id,omitempty" copier:"ClusterId"`
VpcId string `json:"vpc_id,omitempty" copier:"VpcId"`
SubnetNetworkId string `json:"subnet_network_id,omitempty" copier:"SubnetNetworkId"`
SecurityGroupId string `json:"security_group_id,omitempty" copier:"SecurityGroupId"`
Config []QueryServiceConfig `json:"config,omitempty" copier:"Config"`
ErrorMsg string `json:"error_msg,omitempty" copier:"ErrorMsg"`
AccessAddress string `json:"access_address,omitempty" copier:"AccessAddress"`
BindAccessAddress string `json:"bind_access_address,omitempty" copier:"BindAccessAddress"`
UpdateTime string `json:"update_time,omitempty" copier:"UpdateTime"`
DebugUrl string `json:"debug_url,omitempty" copier:"DebugUrl"`
}
type QueryServiceConfig struct {
ModelVersion string `json:"model_version,omitempty" copier:"ModelVersion"`
FinishedTime string `json:"finished_time,omitempty" copier:"FinishedTime"`
CustomSpec *CustomSpec `json:"CustomSpec,omitempty" copier:"CustomSpec"`
Envs map[string]string `json:"envs,omitempty" copier:"Envs"`
Specification string `json:"specification,omitempty" copier:"Specification"`
Weight int32 `json:"weight,omitempty" copier:"Weight"`
ModelId string `json:"model_id,omitempty" copier:"ModelId"`
SrcPath string `json:"src_path,omitempty" copier:"SrcPath"`
ReqUri string `json:"req_uri,omitempty" copier:"ReqUri"`
MappingType string `json:"mapping_type,omitempty" copier:"MappingType"`
StartTime string `json:"start_time,omitempty" copier:"StartTime"`
ClusterId string `json:"cluster_id,omitempty" copier:"ClusterId"`
Nodes []string `json:"nodes,omitempty" copier:"Nodes"`
MappingRule string `json:"mapping_rule,omitempty" copier:"MappingRule"`
ModelName string `json:"model_name,omitempty" copier:"ModelName"`
SrcType string `json:"src_type,omitempty" copier:"SrcType"`
DestPath string `json:"dest_path,omitempty" copier:"DestPath"`
InstanceCount int32 `json:"instance_count,omitempty" copier:"InstanceCount"`
Status string `json:"status,omitempty" copier:"Status"`
Scaling bool `json:"scaling,omitempty" copier:"Scaling"`
SupportDebug bool `json:"support_debug,omitempty" copier:"SupportDebug"`
AdditionalProperties map[string]string `json:"additional_properties,omitempty" copier:"AdditionalProperties"`
}
type ListClustersReq struct {
ProjectId string `json:"project_id"`
ClusterName string `json:"cluster_name,optional"`
Offset int64 `json:"offset,optional"`
Limit int64 `json:"limit,optional"`
SortBy string `json:"sort_by,optional"`
Order string `json:"order,optional"`
ProjectId string `json:"project_id" copier:"ProjectId"`
ClusterName string `json:"cluster_name,optional" copier:"ClusterName"`
Offset int64 `json:"offset,optional" copier:"Offset"`
Limit int64 `json:"limit,optional" copier:"Limit"`
SortBy string `json:"sort_by,optional" copier:"SortBy"`
Order string `json:"order,optional" copier:"Order"`
}
type ListClustersResp struct {
Code int32 `json:"code,omitempty"`
Count int32 `json:"count,omitempty"`
Clusters []Cluster `json:"clusters,omitempty"`
Code int32 `json:"code,omitempty" copier:"Code"`
Count int32 `json:"count,omitempty" copier:"Count"`
Clusters []Cluster `json:"clusters,omitempty" copier:"Clusters"`
}
type ClusterNode struct {
Specification string `json:"specification,omitempty"`
Count int32 `json:"count,omitempty"`
AvailableCount int32 `json:"available_count,omitempty"`
Specification string `json:"specification,omitempty" copier:"Specification"`
Count int32 `json:"count,omitempty" copier:"Count"`
AvailableCount int32 `json:"available_count,omitempty" copier:"AvailableCount"`
}
type Cluster struct {
ClusterId string `json:"cluster_id,omitempty"`
ClusterName string `json:"cluster_name,omitempty"`
Description string `json:"description,omitempty"`
Tenant string `json:"tenant,omitempty"`
Project string `json:"project,omitempty"`
Owner string `json:"owner,omitempty"`
CreatedAt int32 `json:"created_at,omitempty"`
Status string `json:"status,omitempty"`
Nodes ClusterNode `json:"nodes,omitempty"`
AllocatableCpuCores float64 `json:"allocatable_cpu_cores,omitempty"`
AllocatableMemory int64 `json:"allocatable_memory,omitempty"`
PeriodNum int32 `json:"period_num,omitempty"`
PeriodType string `json:"period_type,omitempty"`
OrderId string `json:"order_id,omitempty"`
ClusterId string `json:"cluster_id,omitempty" copier:"ClusterId"`
ClusterName string `json:"cluster_name,omitempty" copier:"ClusterName"`
Description string `json:"description,omitempty" copier:"Description"`
Tenant string `json:"tenant,omitempty" copier:"Tenant"`
Project string `json:"project,omitempty" copier:"Project"`
Owner string `json:"owner,omitempty" copier:"Owner"`
CreatedAt int32 `json:"created_at,omitempty" copier:"CreatedAt"`
Status string `json:"status,omitempty" copier:"Status"`
Nodes ClusterNode `json:"nodes,omitempty" copier:"Nodes"`
AllocatableCpuCores float64 `json:"allocatable_cpu_cores,omitempty" copier:"AllocatableCpuCores"`
AllocatableMemory int64 `json:"allocatable_memory,omitempty" copier:"AllocatableMemory"`
PeriodNum int32 `json:"period_num,omitempty" copier:"PeriodNum"`
PeriodType string `json:"period_type,omitempty" copier:"PeriodType"`
OrderId string `json:"order_id,omitempty" copier:"OrderId"`
}
type ListAlgorithmsReq struct {
@ -567,6 +671,14 @@ type ListAlgorithmsResp struct {
Items []AlgorithmResponse `json:"items,optional"`
}
type DeleteAlgorithmReq struct {
ProjectId string `json:"project_id" copier:"ProjectId"`
AlgorithmId string `json:"algorithm_id" copier:"AlgorithmId"`
}
type DeleteAlgorithmResp struct {
}
type MetadataAlRq struct {
Id string `json:"id,optional"`
Name string `json:"name,optional"`
@ -839,7 +951,7 @@ type GetVisualizationJobResp struct {
Error_message string `json:"error_message"`
Job_total_count int32 `json:"job_total_count"`
Job_count_limit int32 `json:"job_count_limit"`
Jobs []Jobs `json:"jobs"`
Jobs []jobs `json:"jobs"`
Quotas int32 `json:"quotas"`
}
@ -885,8 +997,8 @@ type CreateVisualizationJobParam struct {
Job_desc string `json:"job_desc"`
Train_url string `json:"train_url"`
Job_type string `json:"job_type"`
Flavor Flavor `json:"flavor"`
Schedule Schedule `json:"schedule"`
Flavor flavor `json:"flavor"`
Schedule schedule `json:"schedule"`
}
type Flavor struct {