| @@ -181,7 +181,7 @@ type ( | |||||
| } | } | ||||
| TaskYaml { | TaskYaml { | ||||
| TaskId int64 `yaml:"taskId"` | TaskId int64 `yaml:"taskId"` | ||||
| serviceName string `yaml:"serviceName"` | |||||
| taskType string `yaml:"taskType"` | |||||
| metadata interface{} `yaml:"metadata"` | metadata interface{} `yaml:"metadata"` | ||||
| } | } | ||||
| ) | ) | ||||
| @@ -23,43 +23,43 @@ info( | |||||
| service pcm { | service pcm { | ||||
| @handler scheduleTaskByYamlHandler | @handler scheduleTaskByYamlHandler | ||||
| post /core/scheduleTaskByYaml (scheduleTaskByYamlReq) returns () | post /core/scheduleTaskByYaml (scheduleTaskByYamlReq) returns () | ||||
| @handler scheduleTaskHandler | @handler scheduleTaskHandler | ||||
| post /core/scheduleTask (scheduleTaskReq) returns () | post /core/scheduleTask (scheduleTaskReq) returns () | ||||
| @handler TaskListHandler | @handler TaskListHandler | ||||
| get /core/taskList () returns (taskListResp) | get /core/taskList () returns (taskListResp) | ||||
| @handler JobTotalHandler | @handler JobTotalHandler | ||||
| get /core/jobTotal () returns (jobTotalResp) | get /core/jobTotal () returns (jobTotalResp) | ||||
| @handler listCenterHandler | @handler listCenterHandler | ||||
| get /core/listCenter () returns (listCenterResp) | get /core/listCenter () returns (listCenterResp) | ||||
| @handler listClusterHandler | @handler listClusterHandler | ||||
| get /core/listCluster/:centerId (listClusterReq) returns (listClusterResp) | get /core/listCluster/:centerId (listClusterReq) returns (listClusterResp) | ||||
| @handler submitJobHandler | @handler submitJobHandler | ||||
| post /core/submitJob (submitJobReq) returns (submitJobResp) | post /core/submitJob (submitJobReq) returns (submitJobResp) | ||||
| @handler getRegionHandler | @handler getRegionHandler | ||||
| get /core/getRegion () returns (getRegionResp) | get /core/getRegion () returns (getRegionResp) | ||||
| @handler listRegionHandler | @handler listRegionHandler | ||||
| get /core/listRegion () returns (listRegionResp) | get /core/listRegion () returns (listRegionResp) | ||||
| @handler getComputingPowerHandler | @handler getComputingPowerHandler | ||||
| get /core/getComputingPower returns (cpResp) | get /core/getComputingPower returns (cpResp) | ||||
| @handler getGeneralInfoHandler | @handler getGeneralInfoHandler | ||||
| get /core/getGeneralInfo () returns (GiResp) | get /core/getGeneralInfo () returns (GiResp) | ||||
| @handler listDomainResourceHandler | @handler listDomainResourceHandler | ||||
| get /core/listDomainResource returns (DomainResourceResp) | get /core/listDomainResource returns (DomainResourceResp) | ||||
| @handler getResourcePanelConfigHandler | @handler getResourcePanelConfigHandler | ||||
| get /core/getResourcePanelConfigHandler () returns (ResourcePanelConfigResp) | get /core/getResourcePanelConfigHandler () returns (ResourcePanelConfigResp) | ||||
| @handler putResourcePanelConfigHandler | @handler putResourcePanelConfigHandler | ||||
| put /core/resourcePanelConfigHandler (ResourcePanelConfigReq) returns () | put /core/resourcePanelConfigHandler (ResourcePanelConfigReq) returns () | ||||
| } | } | ||||
| @@ -72,7 +72,7 @@ service pcm { | |||||
| service pcm { | service pcm { | ||||
| @handler listJobHandler | @handler listJobHandler | ||||
| get /hpc/listJob (listJobReq) returns (listJobResp) | get /hpc/listJob (listJobReq) returns (listJobResp) | ||||
| @handler listHistoryJobHandler | @handler listHistoryJobHandler | ||||
| get /hpc/listHistoryJob (listHistoryJobReq) returns (listHistoryJobResp) | get /hpc/listHistoryJob (listHistoryJobReq) returns (listHistoryJobResp) | ||||
| } | } | ||||
| @@ -85,10 +85,10 @@ service pcm { | |||||
| service pcm { | service pcm { | ||||
| @handler listDataSetHandler | @handler listDataSetHandler | ||||
| get /ai/listDataSet/:projectId (DataSetReq) returns (DataSetResp) | get /ai/listDataSet/:projectId (DataSetReq) returns (DataSetResp) | ||||
| @handler CreateDataSetHandler | @handler CreateDataSetHandler | ||||
| post /ai/createDataSet/:projectId (CreateDataSetReq) returns (CreateDataSetResp) | post /ai/createDataSet/:projectId (CreateDataSetReq) returns (CreateDataSetResp) | ||||
| @handler DeleteDataSetHandler | @handler DeleteDataSetHandler | ||||
| delete /ai/deleteDataSet/:projectId/:datasetId (DeleteDataSetReq) returns (DeleteDataSetResp) | delete /ai/deleteDataSet/:projectId/:datasetId (DeleteDataSetReq) returns (DeleteDataSetResp) | ||||
| // creat task 创建导入任务 | // creat task 创建导入任务 | ||||
| @@ -119,7 +119,7 @@ service pcm { | |||||
| // ShowAlgorithmByUuid 展示算法详情 | // ShowAlgorithmByUuid 展示算法详情 | ||||
| @handler ShowAlgorithmByUuid | @handler ShowAlgorithmByUuid | ||||
| get /ai/ShowAlgorithmByUuid/:projectId/:algorithmId (ShowAlgorithmByUuidReq) returns (ShowAlgorithmByUuidResp) | get /ai/ShowAlgorithmByUuid/:projectId/:algorithmId (ShowAlgorithmByUuidReq) returns (ShowAlgorithmByUuidResp) | ||||
| // creat export task 创建导出任务 | // creat export task 创建导出任务 | ||||
| @handler CreateExportTaskHandler | @handler CreateExportTaskHandler | ||||
| post /ai/CreateExportTask/:projectId/:datasetId (CreateExportTaskReq) returns (ExportTaskDataResp) | post /ai/CreateExportTask/:projectId/:datasetId (CreateExportTaskReq) returns (ExportTaskDataResp) | ||||
| @@ -127,11 +127,11 @@ service pcm { | |||||
| get /ai/GetExportTasksOfDataset/:projectId/:datasetId (GetExportTasksOfDatasetReq) returns (GetExportTasksOfDatasetResp) | get /ai/GetExportTasksOfDataset/:projectId/:datasetId (GetExportTasksOfDatasetReq) returns (GetExportTasksOfDatasetResp) | ||||
| @handler GetExportTaskStatusOfDatasetHandler | @handler GetExportTaskStatusOfDatasetHandler | ||||
| get /ai/GetExportTaskStatusOfDataset/:projectId/:resourceId/:taskId (GetExportTaskStatusOfDatasetReq) returns (GetExportTaskStatusOfDatasetResp) | get /ai/GetExportTaskStatusOfDataset/:projectId/:resourceId/:taskId (GetExportTaskStatusOfDatasetReq) returns (GetExportTaskStatusOfDatasetResp) | ||||
| // create processor task 创建处理任务 | // create processor task 创建处理任务 | ||||
| @handler CreateProcessorTaskHandler | @handler CreateProcessorTaskHandler | ||||
| post /ai/CreateProcessorTask (CreateProcessorTaskReq) returns (CreateProcessorTaskResp) | post /ai/CreateProcessorTask (CreateProcessorTaskReq) returns (CreateProcessorTaskResp) | ||||
| // create service 创建服务 | // create service 创建服务 | ||||
| @handler CreateServiceHandler | @handler CreateServiceHandler | ||||
| post /ai/CreateService/:projectId (CreateServiceReq) returns (CreateServiceResp) | post /ai/CreateService/:projectId (CreateServiceReq) returns (CreateServiceResp) | ||||
| @@ -147,7 +147,7 @@ service pcm { | |||||
| // ListClusters查询专属资源池列表 | // ListClusters查询专属资源池列表 | ||||
| @handler ListClustersHandler | @handler ListClustersHandler | ||||
| get /ai/ListClusters (ListClustersReq) returns (ListClustersResp) | get /ai/ListClusters (ListClustersReq) returns (ListClustersResp) | ||||
| /******************Notebook Method start*************************/ | /******************Notebook Method start*************************/ | ||||
| @handler listNotebookHandler | @handler listNotebookHandler | ||||
| get /ai/listNotebook (ListNotebookReq) returns (ListNotebookResp) | get /ai/listNotebook (ListNotebookReq) returns (ListNotebookResp) | ||||
| @@ -162,7 +162,7 @@ service pcm { | |||||
| @handler mountNotebookStorageHandler | @handler mountNotebookStorageHandler | ||||
| post /ai/mountNotebookStorage (MountNotebookStorageReq) returns (MountNotebookStorageResp) | post /ai/mountNotebookStorage (MountNotebookStorageReq) returns (MountNotebookStorageResp) | ||||
| /******************Notebook Method end*************************/ | /******************Notebook Method end*************************/ | ||||
| /******************Visualization Job Method start*************************/ | /******************Visualization Job Method start*************************/ | ||||
| @handler getVisualizationJobHandler | @handler getVisualizationJobHandler | ||||
| get /ai/getVisualizationJob (GetVisualizationJobReq) returns (GetVisualizationJobResp) | get /ai/getVisualizationJob (GetVisualizationJobReq) returns (GetVisualizationJobResp) | ||||
| @@ -193,16 +193,16 @@ service pcm { | |||||
| service pcm { | service pcm { | ||||
| @handler uploadHandler | @handler uploadHandler | ||||
| post /upload () returns () | post /upload () returns () | ||||
| @handler chunkHandler | @handler chunkHandler | ||||
| post /chunk () returns () | post /chunk () returns () | ||||
| @handler imageListHandler | @handler imageListHandler | ||||
| get /image/list () returns (imageListResp) | get /image/list () returns (imageListResp) | ||||
| @handler dataSetCheckHandler | @handler dataSetCheckHandler | ||||
| get /dataSet/check/:fileMd5 (checkReq) returns (checkResp) | get /dataSet/check/:fileMd5 (checkReq) returns (checkResp) | ||||
| @handler uploadDataSetHandler | @handler uploadDataSetHandler | ||||
| post /dataSet/upload () returns () | post /dataSet/upload () returns () | ||||
| } | } | ||||
| @@ -308,6 +308,5 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | |||||
| }, | }, | ||||
| }, | }, | ||||
| rest.WithPrefix("/pcm/v1"), | rest.WithPrefix("/pcm/v1"), | ||||
| rest.WithMaxBytes(1111111111), | |||||
| ) | ) | ||||
| } | } | ||||
| @@ -56,12 +56,12 @@ func (l *ScheduleTaskByYamlLogic) ScheduleTaskByYaml(req *types.ScheduleTaskByYa | |||||
| logx.Error(err) | logx.Error(err) | ||||
| return err | return err | ||||
| } | } | ||||
| switch task.ServiceName { | |||||
| case "kubeNative": | |||||
| switch task.TaskType { | |||||
| case "cloud": | |||||
| l.svcCtx.ScheduleCloudClient.Push(string(reqMessage)) | l.svcCtx.ScheduleCloudClient.Push(string(reqMessage)) | ||||
| case "ac", "th": | |||||
| case "hpc": | |||||
| l.svcCtx.ScheduleHpcClient.Push(string(reqMessage)) | l.svcCtx.ScheduleHpcClient.Push(string(reqMessage)) | ||||
| case "modelArts": | |||||
| case "ai": | |||||
| l.svcCtx.ScheduleAiClient.Push(string(reqMessage)) | l.svcCtx.ScheduleAiClient.Push(string(reqMessage)) | ||||
| } | } | ||||
| } | } | ||||
| @@ -61,7 +61,7 @@ func (l *ScheduleTaskLogic) ScheduleTask(req *types.ScheduleTaskReq) (err error) | |||||
| logx.Error(err) | logx.Error(err) | ||||
| return err | return err | ||||
| } | } | ||||
| switch task.ServiceName { | |||||
| switch task.TaskType { | |||||
| case "kubeNative": | case "kubeNative": | ||||
| l.svcCtx.ScheduleCloudClient.Push(string(reqMessage)) | l.svcCtx.ScheduleCloudClient.Push(string(reqMessage)) | ||||
| case "ac", "th": | case "ac", "th": | ||||
| @@ -30,10 +30,9 @@ func (l *ScheduleAiMq) Consume(_, val string) error { | |||||
| var task *types.TaskInfo | var task *types.TaskInfo | ||||
| json.Unmarshal([]byte(val), &task) | json.Unmarshal([]byte(val), &task) | ||||
| ai := model.Ai{ | ai := model.Ai{ | ||||
| TaskId: task.TaskId, | |||||
| Status: "Saved", | |||||
| ServiceName: task.ServiceName, | |||||
| YamlString: val, | |||||
| TaskId: task.TaskId, | |||||
| Status: "Saved", | |||||
| YamlString: val, | |||||
| } | } | ||||
| tool.Convert(task.Metadata, &ai) | tool.Convert(task.Metadata, &ai) | ||||
| // 存储数据 | // 存储数据 | ||||
| @@ -5,6 +5,7 @@ import ( | |||||
| "context" | "context" | ||||
| "encoding/json" | "encoding/json" | ||||
| "github.com/zeromicro/go-zero/core/logx" | "github.com/zeromicro/go-zero/core/logx" | ||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/pkg/scheduler" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/model" | "gitlink.org.cn/jcce-pcm/pcm-coordinator/model" | ||||
| @@ -54,13 +55,12 @@ func UnMarshalK8sStruct(yamlString string, taskId int64) model.Cloud { | |||||
| unstructureObj := &unstructured.Unstructured{Object: unstructuredMap} | unstructureObj := &unstructured.Unstructured{Object: unstructuredMap} | ||||
| cloud = model.Cloud{ | cloud = model.Cloud{ | ||||
| TaskId: taskId, | |||||
| ApiVersion: unstructureObj.GetAPIVersion(), | |||||
| Name: unstructureObj.GetName(), | |||||
| Kind: unstructureObj.GetKind(), | |||||
| Namespace: unstructureObj.GetNamespace(), | |||||
| Status: "Saved", | |||||
| ServiceName: "kubeNative", | |||||
| TaskId: taskId, | |||||
| ApiVersion: unstructureObj.GetAPIVersion(), | |||||
| Name: unstructureObj.GetName(), | |||||
| Kind: unstructureObj.GetKind(), | |||||
| Namespace: unstructureObj.GetNamespace(), | |||||
| Status: "Saved", | |||||
| } | } | ||||
| } | } | ||||
| return cloud | return cloud | ||||
| @@ -69,6 +69,10 @@ func UnMarshalK8sStruct(yamlString string, taskId int64) model.Cloud { | |||||
| func (l *ScheduleCloudMq) Consume(_, val string) error { | func (l *ScheduleCloudMq) Consume(_, val string) error { | ||||
| var task *types.TaskInfo | var task *types.TaskInfo | ||||
| json.Unmarshal([]byte(val), &task) | json.Unmarshal([]byte(val), &task) | ||||
| participantId, err := scheduler.MatchLabels(l.svcCtx.DbEngin, task) | |||||
| if err != nil { | |||||
| return err | |||||
| } | |||||
| // 构建提交作业到云算的结构体 | // 构建提交作业到云算的结构体 | ||||
| bytes, err := json.Marshal(task.Metadata) | bytes, err := json.Marshal(task.Metadata) | ||||
| if err != nil { | if err != nil { | ||||
| @@ -76,6 +80,9 @@ func (l *ScheduleCloudMq) Consume(_, val string) error { | |||||
| } | } | ||||
| cloud := UnMarshalK8sStruct(string(bytes), task.TaskId) | cloud := UnMarshalK8sStruct(string(bytes), task.TaskId) | ||||
| cloud.YamlString = string(bytes) | cloud.YamlString = string(bytes) | ||||
| if len(participantId) != 0 { | |||||
| cloud.ParticipantId = participantId[0] | |||||
| } | |||||
| // 存储数据 | // 存储数据 | ||||
| tx := l.svcCtx.DbEngin.Create(&cloud) | tx := l.svcCtx.DbEngin.Create(&cloud) | ||||
| if tx.Error != nil { | if tx.Error != nil { | ||||
| @@ -33,7 +33,7 @@ func (l *ScheduleHpcMq) Consume(_, val string) error { | |||||
| hpc := model.Hpc{ | hpc := model.Hpc{ | ||||
| TaskId: task.TaskId, | TaskId: task.TaskId, | ||||
| Status: "Saved", | Status: "Saved", | ||||
| ServiceName: task.ServiceName, | |||||
| ServiceName: task.TaskType, | |||||
| YamlString: val, | YamlString: val, | ||||
| } | } | ||||
| tool.Convert(task.Metadata, &hpc) | tool.Convert(task.Metadata, &hpc) | ||||
| @@ -0,0 +1 @@ | |||||
| package scheduler | |||||
| @@ -0,0 +1,62 @@ | |||||
| package scheduler | |||||
| import ( | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| "gorm.io/gorm" | |||||
| "math/rand" | |||||
| "time" | |||||
| ) | |||||
| func MatchLabels(dbEngin *gorm.DB, task *types.TaskInfo) ([]int64, error) { | |||||
| var ids []int64 | |||||
| count := 0 | |||||
| for key := range task.MatchLabels { | |||||
| var participantId []int64 | |||||
| dbEngin.Raw("select participant_id from sc_participant_label_info where `key` = ? and value = ?", key, task.MatchLabels[key]).Scan(&participantId) | |||||
| if count == 0 { | |||||
| ids = participantId | |||||
| } | |||||
| if len(participantId) == 0 || len(ids) == 0 { | |||||
| return nil, nil | |||||
| } | |||||
| ids = intersect(ids, participantId) | |||||
| count++ | |||||
| } | |||||
| return micsSlice(ids, 1), nil | |||||
| } | |||||
| // 求交集 | |||||
| func intersect(slice1, slice2 []int64) []int64 { | |||||
| m := make(map[int64]int) | |||||
| nn := make([]int64, 0) | |||||
| for _, v := range slice1 { | |||||
| m[v]++ | |||||
| } | |||||
| for _, v := range slice2 { | |||||
| times, _ := m[v] | |||||
| if times == 1 { | |||||
| nn = append(nn, v) | |||||
| } | |||||
| } | |||||
| return nn | |||||
| } | |||||
| func micsSlice(origin []int64, count int) []int64 { | |||||
| tmpOrigin := make([]int64, len(origin)) | |||||
| copy(tmpOrigin, origin) | |||||
| //一定要seed | |||||
| rand.Seed(time.Now().Unix()) | |||||
| rand.Shuffle(len(tmpOrigin), func(i int, j int) { | |||||
| tmpOrigin[i], tmpOrigin[j] = tmpOrigin[j], tmpOrigin[i] | |||||
| }) | |||||
| result := make([]int64, 0, count) | |||||
| for index, value := range tmpOrigin { | |||||
| if index == count { | |||||
| break | |||||
| } | |||||
| result = append(result, value) | |||||
| } | |||||
| return result | |||||
| } | |||||
| @@ -161,9 +161,9 @@ type ScheduleTaskByYamlReq struct { | |||||
| } | } | ||||
| type TaskYaml struct { | type TaskYaml struct { | ||||
| TaskId int64 `yaml:"taskId"` | |||||
| ServiceName string `yaml:"serviceName"` | |||||
| Metadata interface{} `yaml:"metadata"` | |||||
| TaskId int64 `yaml:"taskId"` | |||||
| TaskType string `yaml:"taskType"` | |||||
| Metadata interface{} `yaml:"metadata"` | |||||
| } | } | ||||
| type ScheduleTaskReq struct { | type ScheduleTaskReq struct { | ||||
| @@ -175,9 +175,10 @@ type ScheduleTaskReq struct { | |||||
| } | } | ||||
| type TaskInfo struct { | type TaskInfo struct { | ||||
| TaskId int64 `json:"taskId,optional"` | |||||
| ServiceName string `json:"serviceName"` | |||||
| Metadata interface{} `json:"metadata"` | |||||
| TaskId int64 `json:"taskId,optional"` | |||||
| TaskType string `json:"taskType"` | |||||
| MatchLabels map[string]string `json:"matchLabels"` | |||||
| Metadata interface{} `json:"metadata"` | |||||
| } | } | ||||
| type JobTotalResp struct { | type JobTotalResp struct { | ||||
| @@ -64,7 +64,6 @@ func main() { | |||||
| for _, mq := range services { | for _, mq := range services { | ||||
| serviceGroup.Add(mq) | serviceGroup.Add(mq) | ||||
| } | } | ||||
| logx.Infof("Starting server at %s:%d...\n", c.Host, c.Port) | logx.Infof("Starting server at %s:%d...\n", c.Host, c.Port) | ||||
| serviceGroup.Start() | serviceGroup.Start() | ||||
| @@ -36,18 +36,19 @@ type ( | |||||
| } | } | ||||
| Ai struct { | Ai struct { | ||||
| Id int64 `db:"id"` // id | |||||
| TaskId int64 `db:"task_id"` // 任务id | |||||
| ProjectId string `db:"project_id"` // 项目id | |||||
| Name string `db:"name"` // 名称 | |||||
| Status string `db:"status"` // 状态 | |||||
| StartTime string `db:"start_time"` // 开始时间 | |||||
| RunningTime int64 `db:"running_time"` // 运行时间 | |||||
| CreatedBy int64 `db:"created_by"` // 创建人 | |||||
| CreatedTime sql.NullTime `db:"created_time"` // 创建时间 | |||||
| UpdatedBy int64 `db:"updated_by"` // 更新人 | |||||
| UpdatedTime sql.NullTime `db:"updated_time"` // 更新时间 | |||||
| DeletedFlag int64 `db:"deleted_flag"` // 是否删除(0-否,1-是) | |||||
| Id int64 `db:"id"` // id | |||||
| TaskId int64 `db:"task_id"` // 任务id | |||||
| ParticipantId int64 `db:"participant_id"` // 集群静态信息id | |||||
| ProjectId string `db:"project_id"` // 项目id | |||||
| Name string `db:"name"` // 名称 | |||||
| Status string `db:"status"` // 状态 | |||||
| StartTime string `db:"start_time"` // 开始时间 | |||||
| RunningTime int64 `db:"running_time"` // 运行时间 | |||||
| CreatedBy int64 `db:"created_by"` // 创建人 | |||||
| CreatedTime sql.NullTime `db:"created_time"` // 创建时间 | |||||
| UpdatedBy int64 `db:"updated_by"` // 更新人 | |||||
| UpdatedTime sql.NullTime `db:"updated_time"` // 更新时间 | |||||
| DeletedFlag int64 `db:"deleted_flag"` // 是否删除(0-否,1-是) | |||||
| ServiceName string `db:"service_name"` | ServiceName string `db:"service_name"` | ||||
| Result string `db:"result"` | Result string `db:"result"` | ||||
| YamlString string `db:"yaml_string"` | YamlString string `db:"yaml_string"` | ||||
| @@ -36,23 +36,24 @@ type ( | |||||
| } | } | ||||
| Cloud struct { | Cloud struct { | ||||
| Id int64 `db:"id"` // id | |||||
| TaskId int64 `db:"task_id"` // 任务id | |||||
| ApiVersion string `db:"api_version"` | |||||
| Name string `db:"name"` // 名称 | |||||
| Namespace string `db:"namespace"` // 命名空间 | |||||
| Kind string `db:"kind"` // 种类 | |||||
| Status string `db:"status"` // 状态 | |||||
| StartTime string `db:"start_time"` // 开始时间 | |||||
| RunningTime int64 `db:"running_time"` // 运行时长 | |||||
| CreatedBy int64 `db:"created_by"` // 创建人 | |||||
| CreatedTime sql.NullTime `db:"created_time"` // 创建时间 | |||||
| UpdatedBy int64 `db:"updated_by"` // 更新人 | |||||
| UpdatedTime sql.NullTime `db:"updated_time"` // 更新时间 | |||||
| DeletedFlag int64 `db:"deleted_flag"` // 是否删除(0-否,1-是) | |||||
| ServiceName string `db:"service_name"` | |||||
| YamlString string `db:"yaml_string"` | |||||
| Result string `db:"result"` | |||||
| Id int64 `db:"id"` // id | |||||
| TaskId int64 `db:"task_id"` // 任务id | |||||
| ParticipantId int64 `db:"participant_id"` // 集群静态信息id | |||||
| ApiVersion string `db:"api_version"` | |||||
| Name string `db:"name"` // 名称 | |||||
| Namespace string `db:"namespace"` // 命名空间 | |||||
| Kind string `db:"kind"` // 种类 | |||||
| Status string `db:"status"` // 状态 | |||||
| StartTime string `db:"start_time"` // 开始时间 | |||||
| RunningTime int64 `db:"running_time"` // 运行时长 | |||||
| CreatedBy int64 `db:"created_by"` // 创建人 | |||||
| CreatedTime sql.NullTime `db:"created_time"` // 创建时间 | |||||
| UpdatedBy int64 `db:"updated_by"` // 更新人 | |||||
| UpdatedTime sql.NullTime `db:"updated_time"` // 更新时间 | |||||
| DeletedFlag int64 `db:"deleted_flag"` // 是否删除(0-否,1-是) | |||||
| ServiceName string `db:"service_name"` | |||||
| YamlString string `db:"yaml_string"` | |||||
| Result string `db:"result"` | |||||
| } | } | ||||
| ) | ) | ||||
| @@ -36,34 +36,35 @@ type ( | |||||
| } | } | ||||
| Hpc struct { | Hpc struct { | ||||
| Id int64 `db:"id"` // id | |||||
| TaskId int64 `db:"task_id"` // 任务id | |||||
| JobId string `db:"job_id"` // 作业id | |||||
| ServiceName string `db:"service_name"` // 服务名称 | |||||
| Name string `db:"name"` // 名称 | |||||
| Status string `db:"status"` // 状态 | |||||
| StartTime string `db:"start_time"` // 开始时间 | |||||
| RunningTime int64 `db:"running_time"` // 运行时间 | |||||
| CardCount int64 `db:"card_count"` // 卡数 | |||||
| CreatedBy int64 `db:"created_by"` // 创建人 | |||||
| CreatedTime sql.NullTime `db:"created_time"` // 创建时间 | |||||
| UpdatedBy int64 `db:"updated_by"` // 更新人 | |||||
| UpdatedTime sql.NullTime `db:"updated_time"` // 更新时间 | |||||
| DeletedFlag int64 `db:"deleted_flag"` // 是否删除(0-否,1-是) | |||||
| WorkDir string `db:"work_dir"` | |||||
| WallTime string `db:"wall_time"` | |||||
| Result string `db:"result"` | |||||
| YamlString string `db:"yaml_string"` | |||||
| CmdScript string `db:"cmd_script"` | |||||
| derivedEs string `db:"derived_es"` | |||||
| cluster string `db:"cluster"` | |||||
| blockId string `db:"block_id"` | |||||
| allocNodes uint32 `db:"alloc_nodes"` | |||||
| allocCpu uint32 `db:"alloc_cpu"` | |||||
| version string `db:"version"` | |||||
| account string `db:"account"` | |||||
| exitCode uint32 `db:"exit_code"` | |||||
| assocId uint32 `db:"assoc_id"` | |||||
| Id int64 `db:"id"` // id | |||||
| TaskId int64 `db:"task_id"` // 任务id | |||||
| ParticipantId int64 `db:"participant_id"` // 集群静态信息id | |||||
| JobId string `db:"job_id"` // 作业id | |||||
| ServiceName string `db:"service_name"` // 服务名称 | |||||
| Name string `db:"name"` // 名称 | |||||
| Status string `db:"status"` // 状态 | |||||
| StartTime string `db:"start_time"` // 开始时间 | |||||
| RunningTime int64 `db:"running_time"` // 运行时间 | |||||
| CardCount int64 `db:"card_count"` // 卡数 | |||||
| CreatedBy int64 `db:"created_by"` // 创建人 | |||||
| CreatedTime sql.NullTime `db:"created_time"` // 创建时间 | |||||
| UpdatedBy int64 `db:"updated_by"` // 更新人 | |||||
| UpdatedTime sql.NullTime `db:"updated_time"` // 更新时间 | |||||
| DeletedFlag int64 `db:"deleted_flag"` // 是否删除(0-否,1-是) | |||||
| WorkDir string `db:"work_dir"` | |||||
| WallTime string `db:"wall_time"` | |||||
| Result string `db:"result"` | |||||
| YamlString string `db:"yaml_string"` | |||||
| CmdScript string `db:"cmd_script"` | |||||
| derivedEs string `db:"derived_es"` | |||||
| cluster string `db:"cluster"` | |||||
| blockId string `db:"block_id"` | |||||
| allocNodes uint32 `db:"alloc_nodes"` | |||||
| allocCpu uint32 `db:"alloc_cpu"` | |||||
| version string `db:"version"` | |||||
| account string `db:"account"` | |||||
| exitCode uint32 `db:"exit_code"` | |||||
| assocId uint32 `db:"assoc_id"` | |||||
| } | } | ||||
| ) | ) | ||||
| @@ -4,7 +4,7 @@ package pcmCore; | |||||
| option go_package = "/pcmCore"; | option go_package = "/pcmCore"; | ||||
| message SyncInfoReq { | message SyncInfoReq { | ||||
| string serviceName = 1; | |||||
| int64 participantId = 1; | |||||
| string kind = 2; | string kind = 2; | ||||
| repeated HpcInfo HpcInfoList = 3; | repeated HpcInfo HpcInfoList = 3; | ||||
| repeated CloudInfo CloudInfoList = 4; | repeated CloudInfo CloudInfoList = 4; | ||||
| @@ -12,7 +12,7 @@ message SyncInfoReq { | |||||
| } | } | ||||
| message AiInfo { | message AiInfo { | ||||
| string serviceName = 1; | |||||
| int64 participantId = 1; | |||||
| int64 taskId = 2; | int64 taskId = 2; | ||||
| string project_id = 3; | string project_id = 3; | ||||
| string name = 4; | string name = 4; | ||||
| @@ -30,7 +30,7 @@ message AiInfo { | |||||
| } | } | ||||
| message CloudInfo { | message CloudInfo { | ||||
| string serviceName = 1; | |||||
| int64 participant = 1; | |||||
| int64 taskId = 2; | int64 taskId = 2; | ||||
| string apiVersion = 3; | string apiVersion = 3; | ||||
| string kind = 4; | string kind = 4; | ||||
| @@ -44,7 +44,7 @@ message CloudInfo { | |||||
| } | } | ||||
| message HpcInfo { | message HpcInfo { | ||||
| string serviceName = 1; | |||||
| int64 participantId = 1; | |||||
| int64 taskId = 2; | int64 taskId = 2; | ||||
| string jobId = 3; | string jobId = 3; | ||||
| @@ -74,7 +74,7 @@ message SyncInfoResp{ | |||||
| message InfoListReq{ | message InfoListReq{ | ||||
| string kind = 1; | string kind = 1; | ||||
| string serviceName = 2; | |||||
| string participantId = 2; | |||||
| } | } | ||||
| message InfoListResp{ | message InfoListResp{ | ||||
| @@ -158,7 +158,7 @@ message NodePhyInfo { | |||||
| message ParticipantHeartbeatReq{ | message ParticipantHeartbeatReq{ | ||||
| int64 participantId = 1; //participantId | int64 participantId = 1; //participantId | ||||
| string host = 2; //host | string host = 2; //host | ||||
| int32 port = 3; //port | |||||
| string port = 3; //port | |||||
| } | } | ||||
| // participant 参与者 | // participant 参与者 | ||||
| @@ -1,8 +1,8 @@ | |||||
| // Code generated by protoc-gen-go-grpc. DO NOT EDIT. | // Code generated by protoc-gen-go-grpc. DO NOT EDIT. | ||||
| // versions: | // versions: | ||||
| // - protoc-gen-go-grpc v1.3.0 | // - protoc-gen-go-grpc v1.3.0 | ||||
| // - protoc v4.23.4 | |||||
| // source: pb/pcmCore.proto | |||||
| // - protoc v3.19.4 | |||||
| // source: pcmCore.proto | |||||
| package pcmCore | package pcmCore | ||||
| @@ -27,9 +27,9 @@ const ( | |||||
| // | // | ||||
| // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. | // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. | ||||
| type PcmCoreClient interface { | type PcmCoreClient interface { | ||||
| // SyncInfo Synchronous data information | |||||
| //SyncInfo Synchronous data information | |||||
| SyncInfo(ctx context.Context, in *SyncInfoReq, opts ...grpc.CallOption) (*SyncInfoResp, error) | SyncInfo(ctx context.Context, in *SyncInfoReq, opts ...grpc.CallOption) (*SyncInfoResp, error) | ||||
| // InfoList | |||||
| //InfoList | |||||
| InfoList(ctx context.Context, in *InfoListReq, opts ...grpc.CallOption) (*InfoListResp, error) | InfoList(ctx context.Context, in *InfoListReq, opts ...grpc.CallOption) (*InfoListResp, error) | ||||
| } | } | ||||
| @@ -63,9 +63,9 @@ func (c *pcmCoreClient) InfoList(ctx context.Context, in *InfoListReq, opts ...g | |||||
| // All implementations must embed UnimplementedPcmCoreServer | // All implementations must embed UnimplementedPcmCoreServer | ||||
| // for forward compatibility | // for forward compatibility | ||||
| type PcmCoreServer interface { | type PcmCoreServer interface { | ||||
| // SyncInfo Synchronous data information | |||||
| //SyncInfo Synchronous data information | |||||
| SyncInfo(context.Context, *SyncInfoReq) (*SyncInfoResp, error) | SyncInfo(context.Context, *SyncInfoReq) (*SyncInfoResp, error) | ||||
| // InfoList | |||||
| //InfoList | |||||
| InfoList(context.Context, *InfoListReq) (*InfoListResp, error) | InfoList(context.Context, *InfoListReq) (*InfoListResp, error) | ||||
| mustEmbedUnimplementedPcmCoreServer() | mustEmbedUnimplementedPcmCoreServer() | ||||
| } | } | ||||
| @@ -146,7 +146,7 @@ var PcmCore_ServiceDesc = grpc.ServiceDesc{ | |||||
| }, | }, | ||||
| }, | }, | ||||
| Streams: []grpc.StreamDesc{}, | Streams: []grpc.StreamDesc{}, | ||||
| Metadata: "pb/pcmCore.proto", | |||||
| Metadata: "pcmCore.proto", | |||||
| } | } | ||||
| const ( | const ( | ||||
| @@ -160,7 +160,7 @@ const ( | |||||
| type ParticipantServiceClient interface { | type ParticipantServiceClient interface { | ||||
| // registerParticipant Participant注册接口 | // registerParticipant Participant注册接口 | ||||
| RegisterParticipant(ctx context.Context, in *ParticipantPhyReq, opts ...grpc.CallOption) (*ParticipantPhyResp, error) | RegisterParticipant(ctx context.Context, in *ParticipantPhyReq, opts ...grpc.CallOption) (*ParticipantPhyResp, error) | ||||
| // 心跳 | |||||
| //心跳 | |||||
| ReportHeartbeat(ctx context.Context, in *ParticipantHeartbeatReq, opts ...grpc.CallOption) (*HealthCheckResp, error) | ReportHeartbeat(ctx context.Context, in *ParticipantHeartbeatReq, opts ...grpc.CallOption) (*HealthCheckResp, error) | ||||
| } | } | ||||
| @@ -196,7 +196,7 @@ func (c *participantServiceClient) ReportHeartbeat(ctx context.Context, in *Part | |||||
| type ParticipantServiceServer interface { | type ParticipantServiceServer interface { | ||||
| // registerParticipant Participant注册接口 | // registerParticipant Participant注册接口 | ||||
| RegisterParticipant(context.Context, *ParticipantPhyReq) (*ParticipantPhyResp, error) | RegisterParticipant(context.Context, *ParticipantPhyReq) (*ParticipantPhyResp, error) | ||||
| // 心跳 | |||||
| //心跳 | |||||
| ReportHeartbeat(context.Context, *ParticipantHeartbeatReq) (*HealthCheckResp, error) | ReportHeartbeat(context.Context, *ParticipantHeartbeatReq) (*HealthCheckResp, error) | ||||
| mustEmbedUnimplementedParticipantServiceServer() | mustEmbedUnimplementedParticipantServiceServer() | ||||
| } | } | ||||
| @@ -277,5 +277,5 @@ var ParticipantService_ServiceDesc = grpc.ServiceDesc{ | |||||
| }, | }, | ||||
| }, | }, | ||||
| Streams: []grpc.StreamDesc{}, | Streams: []grpc.StreamDesc{}, | ||||
| Metadata: "pb/pcmCore.proto", | |||||
| Metadata: "pcmCore.proto", | |||||
| } | } | ||||