Compare commits

...

26 Commits

Author SHA1 Message Date
zhangwei 1611ce4e7c 镜像管理完成 2023-07-06 10:03:21 +08:00
zhangwei e35fb35fe3 推送文件到云集存储完成 2023-07-04 17:11:19 +08:00
zhangwei 4d246847cd 文件上传 2023-07-04 16:30:31 +08:00
zhangwei f7d1f70f11 Merge branch '2.0' into 2.0-zw
# Conflicts:
#	adaptor/PCM-CORE/api/desc/core/pcm-core.api
#	adaptor/PCM-CORE/rpc/pcmcore.go
#	common/config/nacos.go
2023-07-04 15:41:29 +08:00
zhangwei 8f0f03f780 文件上传 2023-07-04 15:36:50 +08:00
zhangwei 72f094fbec 文件上传 2023-07-04 11:47:24 +08:00
zhangwei 088cc41d99 大屏任务列表判空 2023-06-26 09:06:01 +08:00
zhangwei 34cdece43b 代码规范 2023-06-21 16:16:09 +08:00
zhangwei 6800f9a6d5 任务列表信息 2023-06-20 16:48:07 +08:00
devad 15f598faac fix: 域信息查询数算集群监控
Signed-off-by: devad <cossjie@foxmail.com>
2023-06-17 11:29:05 +08:00
zhangwei 43a5062326 对接任务数据增加返回体 2023-06-16 22:34:30 +08:00
zhangwei efcea561a7 对接任务数据 2023-06-16 22:03:17 +08:00
ll15074821352 64c14f9308 modelarts Core端api文件训练作业增加订阅算法参数 2023-06-16 16:08:28 +08:00
devad fa3519fe5c fix: 修复查询域资源信息赋值问题
Signed-off-by: devad <cossjie@foxmail.com>
2023-06-16 11:51:44 +08:00
qiwang d705dd41fe fix:PCM-ceph代码修改 2023-06-16 10:07:44 +08:00
zhouqunjie d6386bb55f add param type for listclusterlogic 2023-06-16 09:50:16 +08:00
ll15074821352 e30cbb370e modelarts Core端api文件训练作业增加订阅算法参数 2023-06-16 08:35:51 +08:00
zhouqunjie 8a9df31afa nacos config amend 2023-06-15 20:07:07 +08:00
zhouqunjie c64c2121c2 Merge remote-tracking branch 'origin/2.0' into 2.0 2023-06-15 18:38:31 +08:00
zhouqunjie e2d56722f5 pcm interface:list cluster for compute center 2023-06-15 18:38:24 +08:00
devad 7ff060d170 fix: nacos地址更改为配置
Signed-off-by: devad <cossjie@foxmail.com>
2023-06-15 18:03:24 +08:00
zhouqunjie 922d169796 Merge remote-tracking branch 'origin/2.0' into 2.0 2023-06-15 17:27:37 +08:00
zhouqunjie 94574bb562 ac list history job& pcm list cluster for compute center 2023-06-15 17:27:30 +08:00
ll15074821352 6acb3cf134 modelarts Core端api文件训练作业增加订阅算法参数 2023-06-15 16:24:09 +08:00
ll15074821352 585099db80 modelarts Core端api文件训练作业增加订阅算法参数 2023-06-15 09:44:45 +08:00
894646498@qq.com 156bfc9f20 nacos集成 2023-04-21 17:19:42 +08:00
51 changed files with 5928 additions and 4467 deletions

View File

@ -4,7 +4,7 @@ NacosConfig:
ServerConfigs:
# - IpAddr: 127.0.0.1
# Port: 8848
- IpAddr: 10.101.15.7
- IpAddr: nacos.jcce.dev
Port: 8848
ClientConfig:
NamespaceId: test

View File

@ -25,7 +25,7 @@ func InitCron(svc *svc.ServiceContext) {
}
// 提交任务
submitJob(infoList, submitJobLogic)
// 查询运行中的任务列表同步信息 吧吧你 你
// 查询运行中的任务列表同步信息
listReq := modelarts.ListTrainingJobsreq{
ProjectId: "0a62ffb0d48026c12fbfc011b8d23f0b",
Limit: 10,
@ -75,15 +75,120 @@ func submitJob(infoList *pcmcoreclient.InfoListResp, submitJobLogic *CreateTrain
Description: "This is a ModelArts Demo Job",
},
Algorithm: &modelarts.Algorithms{
Command: infoList.AiInfoList[index].Command,
Engine: &modelarts.EngineCreateTraining{
ImageUrl: infoList.AiInfoList[index].ImageUrl,
//SubscriptionId: infoList.AiInfoList[index].SubscriptionId,
//ItemVersionId: infoList.AiInfoList[index].ItemVersionId,
SubscriptionId: "26a0d9a9-808a-43f4-9a06-c9ea6bdc53d2",
ItemVersionId: "2.0.0",
//Command: infoList.AiInfoList[index].Command,
//Engine: &modelarts.EngineCreateTraining{
// ImageUrl: infoList.AiInfoList[index].ImageUrl,
//},
Parameters: []*modelarts.ParametersTrainJob{
{
Name: "do_train",
Value: "True",
},
{
Name: "do_eval_along_train",
Value: "True",
},
{
Name: "lr",
Value: "0.01",
},
{
Name: "epochs",
Value: "60",
},
{
Name: "batch_size",
Value: "64",
},
{
Name: "eval_batch_size",
Value: "64",
},
{
Name: "lr_scheduler",
Value: "cos",
},
{
Name: "lr_step",
Value: "20",
},
{
Name: "mixup",
Value: "0.2",
},
{
Name: "label_smoothing",
Value: "0.1",
},
{
Name: "warmup_epochs",
Value: "5",
},
{
Name: "rand_aug",
Value: "True",
},
{
Name: "num_workers",
Value: "8",
},
{
Name: "model_name",
Value: "resnest50",
},
{
Name: "use_dali",
Value: "False",
},
{
Name: "accumulation_steps",
Value: "1",
},
{
Name: "do_data_cleaning",
Value: "True",
},
{
Name: "max_to_keep",
Value: "10",
},
},
Inputs: []*modelarts.InputTraining{
{
Name: "data_url",
AccessMethod: "parameter",
Remote: &modelarts.RemoteTra{
Dataset: &modelarts.DatasetTra{
Id: "L0cTaBjZF61k27w8T74",
Name: "dataset-flower",
VersionName: "V001",
VersionId: "xBx4lPDk4rtf6mEex4W",
},
},
},
},
Outputs: []*modelarts.OutputTraining{
{
Name: "train_url",
AccessMethod: "parameter",
Remote: &modelarts.RemoteOut{
Obs: &modelarts.ObsTra{
ObsUrl: "/jointcloud-out1/flower/",
},
},
},
},
},
Spec: &modelarts.SpecsC{
Resource: &modelarts.ResourceCreateTraining{
FlavorId: infoList.AiInfoList[index].FlavorId,
NodeCount: 1,
FlavorId: infoList.AiInfoList[index].FlavorId,
NodeCount: 1,
Policy: "regular",
FlavorLabel: "[限时免费] GPU: 1*NVIDIA-V100(32GB) | CPU: 8 核 64GB 780GB",
},
},
}

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc v3.19.4
// - protoc v4.22.2
// source: pcm-modelarts.proto
package modelarts
@ -65,39 +65,39 @@ 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.
type ModelArtsClient interface {
//get modelarts Token
// get modelarts Token
GetToken(ctx context.Context, in *TokenReq, opts ...grpc.CallOption) (*TokenResp, error)
//get modelarts Token
// get modelarts Token
GetDatasetList(ctx context.Context, in *DataSetReq, opts ...grpc.CallOption) (*DataSetResp, error)
//create DateSet
// create DateSet
CreateDataSet(ctx context.Context, in *CreateDataSetReq, opts ...grpc.CallOption) (*CreateDataSetResq, error)
//create DateSet
// create DateSet
DeleteDataSet(ctx context.Context, in *DeleteDataSetReq, opts ...grpc.CallOption) (*DeleteDataSetResq, error)
//creat task 创建导入任务
// creat task 创建导入任务
CreateTask(ctx context.Context, in *ImportTaskDataReq, opts ...grpc.CallOption) (*ImportTaskDataResp, error)
//get taskList 查询数据集导入任务列表
// get taskList 查询数据集导入任务列表
GetImportTaskList(ctx context.Context, in *ListImportTasksReq, opts ...grpc.CallOption) (*ListImportTasksResp, error)
// ListTrainingJobs 查询训练作业列表
// ListTrainingJobs 查询训练作业列表
GetListTrainingJobs(ctx context.Context, in *ListTrainingJobsreq, opts ...grpc.CallOption) (*ListTrainingJobsresp, error)
// CreateTrainingJob 创建训练作业
// CreateTrainingJob 创建训练作业
CreateTrainingJob(ctx context.Context, in *CreateTrainingJobReq, opts ...grpc.CallOption) (*CreateTrainingJobResp, error)
// DeleteTrainingJobConfig 删除训练作业
// DeleteTrainingJobConfig 删除训练作业
DeleteTrainingJob(ctx context.Context, in *DeleteTrainingJobReq, opts ...grpc.CallOption) (*DeleteTrainingJobResp, error)
// CreateTrainingJobConfig 创建训练作业参数
// CreateTrainingJobConfig 创建训练作业参数
CreateTrainingJobConfig(ctx context.Context, in *CreateTrainingJobConfigReq, opts ...grpc.CallOption) (*CreateTrainingJobConfigResp, error)
// DeleteTrainingJobConfig 删除训练作业参数
// DeleteTrainingJobConfig 删除训练作业参数
DeleteTrainingJobConfig(ctx context.Context, in *DeleteTrainingJobConfigReq, opts ...grpc.CallOption) (*DeleteTrainingJobConfigResp, error)
// ListTrainingJobConfig 查询训练作业参数
// ListTrainingJobConfig 查询训练作业参数
ListTrainingJobConfig(ctx context.Context, in *ListTrainingJobConfigReq, opts ...grpc.CallOption) (*ListTrainingJobConfigResp, error)
// CreateAlgorithm 创建算法
// CreateAlgorithm 创建算法
CreateAlgorithm(ctx context.Context, in *CreateAlgorithmReq, opts ...grpc.CallOption) (*CreateAlgorithmResp, error)
// ListAlgorithms 查询算法
// ListAlgorithms 查询算法
ListAlgorithms(ctx context.Context, in *ListAlgorithmsReq, opts ...grpc.CallOption) (*ListAlgorithmsResp, error)
// DeleteAlgorithms 删除算法
// DeleteAlgorithms 删除算法
DeleteAlgorithms(ctx context.Context, in *DeleteAlgorithmsReq, opts ...grpc.CallOption) (*DeleteAlgorithmsResp, error)
// ShowAlgorithmByUuid 展示算法详情
// ShowAlgorithmByUuid 展示算法详情
ShowAlgorithmByUuid(ctx context.Context, in *ShowAlgorithmByUuidReq, opts ...grpc.CallOption) (*ShowAlgorithmByUuidResp, error)
// training-job-flavors 获取训练作业支持的公共规格
// training-job-flavors 获取训练作业支持的公共规格
GetTrainingJobFlavors(ctx context.Context, in *TrainingJobFlavorsReq, opts ...grpc.CallOption) (*TrainingJobFlavorsResp, error)
// GET ai-engines 查询作业引擎规格
GetAiEnginesList(ctx context.Context, in *ListAiEnginesReq, opts ...grpc.CallOption) (*ListAiEnginesResp, error)
@ -105,28 +105,28 @@ type ModelArtsClient interface {
ExportTask(ctx context.Context, in *ExportTaskReq, opts ...grpc.CallOption) (*ExportTaskDataResp, error)
GetExportTasksOfDataset(ctx context.Context, in *GetExportTasksOfDatasetReq, opts ...grpc.CallOption) (*GetExportTasksOfDatasetResp, error)
GetExportTaskStatusOfDataset(ctx context.Context, in *GetExportTaskStatusOfDatasetReq, opts ...grpc.CallOption) (*GetExportTaskStatusOfDatasetResp, error)
//processor task
// processor task
CreateProcessorTask(ctx context.Context, in *CreateProcessorTaskReq, opts ...grpc.CallOption) (*CreateProcessorTaskResp, error)
DescribeProcessorTask(ctx context.Context, in *DescribeProcessorTaskReq, opts ...grpc.CallOption) (*DescribeProcessorTaskResp, error)
//model management
// model management
CreateModel(ctx context.Context, in *CreateModelReq, opts ...grpc.CallOption) (*CreateModelResp, error)
DeleteModel(ctx context.Context, in *DeleteModelReq, opts ...grpc.CallOption) (*DeleteModelResp, error)
ListModels(ctx context.Context, in *ListModelReq, opts ...grpc.CallOption) (*ListModelResp, error)
ShowModels(ctx context.Context, in *ShowModelReq, opts ...grpc.CallOption) (*ShowModelResp, error)
//service management
// service management
CreateService(ctx context.Context, in *CreateServiceReq, opts ...grpc.CallOption) (*CreateServiceResp, error)
ListServices(ctx context.Context, in *ListServicesReq, opts ...grpc.CallOption) (*ListServicesResp, error)
ShowService(ctx context.Context, in *ShowServiceReq, opts ...grpc.CallOption) (*ShowServiceResp, error)
DeleteService(ctx context.Context, in *DeleteServiceReq, opts ...grpc.CallOption) (*DeleteServiceResp, error)
ListClusters(ctx context.Context, in *ListClustersReq, opts ...grpc.CallOption) (*ListClustersResp, error)
//notebook task
// notebook task
ListNotebook(ctx context.Context, in *ListNotebookReq, opts ...grpc.CallOption) (*ListNotebookResp, error)
CreateNotebook(ctx context.Context, in *CreateNotebookReq, opts ...grpc.CallOption) (*CreateNotebookResp, error)
StartNotebook(ctx context.Context, in *StartNotebookReq, opts ...grpc.CallOption) (*StartNotebookResp, error)
StopNotebook(ctx context.Context, in *StopNotebookReq, opts ...grpc.CallOption) (*StopNotebookResp, error)
GetNotebookStorage(ctx context.Context, in *GetNotebookStorageReq, opts ...grpc.CallOption) (*GetNotebookStorageResp, error)
MountNotebookStorage(ctx context.Context, in *MountNotebookStorageReq, opts ...grpc.CallOption) (*MountNotebookStorageResp, error)
//visualization-jobs
// visualization-jobs
GetVisualizationJob(ctx context.Context, in *GetVisualizationJobReq, opts ...grpc.CallOption) (*GetVisualizationJobResp, error)
CreateVisualizationJob(ctx context.Context, in *CreateVisualizationJobReq, opts ...grpc.CallOption) (*CreateVisualizationJobResp, error)
}
@ -503,39 +503,39 @@ func (c *modelArtsClient) CreateVisualizationJob(ctx context.Context, in *Create
// All implementations must embed UnimplementedModelArtsServer
// for forward compatibility
type ModelArtsServer interface {
//get modelarts Token
// get modelarts Token
GetToken(context.Context, *TokenReq) (*TokenResp, error)
//get modelarts Token
// get modelarts Token
GetDatasetList(context.Context, *DataSetReq) (*DataSetResp, error)
//create DateSet
// create DateSet
CreateDataSet(context.Context, *CreateDataSetReq) (*CreateDataSetResq, error)
//create DateSet
// create DateSet
DeleteDataSet(context.Context, *DeleteDataSetReq) (*DeleteDataSetResq, error)
//creat task 创建导入任务
// creat task 创建导入任务
CreateTask(context.Context, *ImportTaskDataReq) (*ImportTaskDataResp, error)
//get taskList 查询数据集导入任务列表
// get taskList 查询数据集导入任务列表
GetImportTaskList(context.Context, *ListImportTasksReq) (*ListImportTasksResp, error)
// ListTrainingJobs 查询训练作业列表
// ListTrainingJobs 查询训练作业列表
GetListTrainingJobs(context.Context, *ListTrainingJobsreq) (*ListTrainingJobsresp, error)
// CreateTrainingJob 创建训练作业
// CreateTrainingJob 创建训练作业
CreateTrainingJob(context.Context, *CreateTrainingJobReq) (*CreateTrainingJobResp, error)
// DeleteTrainingJobConfig 删除训练作业
// DeleteTrainingJobConfig 删除训练作业
DeleteTrainingJob(context.Context, *DeleteTrainingJobReq) (*DeleteTrainingJobResp, error)
// CreateTrainingJobConfig 创建训练作业参数
// CreateTrainingJobConfig 创建训练作业参数
CreateTrainingJobConfig(context.Context, *CreateTrainingJobConfigReq) (*CreateTrainingJobConfigResp, error)
// DeleteTrainingJobConfig 删除训练作业参数
// DeleteTrainingJobConfig 删除训练作业参数
DeleteTrainingJobConfig(context.Context, *DeleteTrainingJobConfigReq) (*DeleteTrainingJobConfigResp, error)
// ListTrainingJobConfig 查询训练作业参数
// ListTrainingJobConfig 查询训练作业参数
ListTrainingJobConfig(context.Context, *ListTrainingJobConfigReq) (*ListTrainingJobConfigResp, error)
// CreateAlgorithm 创建算法
// CreateAlgorithm 创建算法
CreateAlgorithm(context.Context, *CreateAlgorithmReq) (*CreateAlgorithmResp, error)
// ListAlgorithms 查询算法
// ListAlgorithms 查询算法
ListAlgorithms(context.Context, *ListAlgorithmsReq) (*ListAlgorithmsResp, error)
// DeleteAlgorithms 删除算法
// DeleteAlgorithms 删除算法
DeleteAlgorithms(context.Context, *DeleteAlgorithmsReq) (*DeleteAlgorithmsResp, error)
// ShowAlgorithmByUuid 展示算法详情
// ShowAlgorithmByUuid 展示算法详情
ShowAlgorithmByUuid(context.Context, *ShowAlgorithmByUuidReq) (*ShowAlgorithmByUuidResp, error)
// training-job-flavors 获取训练作业支持的公共规格
// training-job-flavors 获取训练作业支持的公共规格
GetTrainingJobFlavors(context.Context, *TrainingJobFlavorsReq) (*TrainingJobFlavorsResp, error)
// GET ai-engines 查询作业引擎规格
GetAiEnginesList(context.Context, *ListAiEnginesReq) (*ListAiEnginesResp, error)
@ -543,28 +543,28 @@ type ModelArtsServer interface {
ExportTask(context.Context, *ExportTaskReq) (*ExportTaskDataResp, error)
GetExportTasksOfDataset(context.Context, *GetExportTasksOfDatasetReq) (*GetExportTasksOfDatasetResp, error)
GetExportTaskStatusOfDataset(context.Context, *GetExportTaskStatusOfDatasetReq) (*GetExportTaskStatusOfDatasetResp, error)
//processor task
// processor task
CreateProcessorTask(context.Context, *CreateProcessorTaskReq) (*CreateProcessorTaskResp, error)
DescribeProcessorTask(context.Context, *DescribeProcessorTaskReq) (*DescribeProcessorTaskResp, error)
//model management
// model management
CreateModel(context.Context, *CreateModelReq) (*CreateModelResp, error)
DeleteModel(context.Context, *DeleteModelReq) (*DeleteModelResp, error)
ListModels(context.Context, *ListModelReq) (*ListModelResp, error)
ShowModels(context.Context, *ShowModelReq) (*ShowModelResp, error)
//service management
// service management
CreateService(context.Context, *CreateServiceReq) (*CreateServiceResp, error)
ListServices(context.Context, *ListServicesReq) (*ListServicesResp, error)
ShowService(context.Context, *ShowServiceReq) (*ShowServiceResp, error)
DeleteService(context.Context, *DeleteServiceReq) (*DeleteServiceResp, error)
ListClusters(context.Context, *ListClustersReq) (*ListClustersResp, error)
//notebook task
// notebook task
ListNotebook(context.Context, *ListNotebookReq) (*ListNotebookResp, error)
CreateNotebook(context.Context, *CreateNotebookReq) (*CreateNotebookResp, error)
StartNotebook(context.Context, *StartNotebookReq) (*StartNotebookResp, error)
StopNotebook(context.Context, *StopNotebookReq) (*StopNotebookResp, error)
GetNotebookStorage(context.Context, *GetNotebookStorageReq) (*GetNotebookStorageResp, error)
MountNotebookStorage(context.Context, *MountNotebookStorageReq) (*MountNotebookStorageResp, error)
//visualization-jobs
// visualization-jobs
GetVisualizationJob(context.Context, *GetVisualizationJobReq) (*GetVisualizationJobResp, error)
CreateVisualizationJob(context.Context, *CreateVisualizationJobReq) (*CreateVisualizationJobResp, error)
mustEmbedUnimplementedModelArtsServer()

View File

@ -71,6 +71,7 @@ type (
DataSources = modelarts.DataSources
DataVolumesRes = modelarts.DataVolumesRes
Dataset = modelarts.Dataset
DatasetTra = modelarts.DatasetTra
DeleteAlgorithmsReq = modelarts.DeleteAlgorithmsReq
DeleteAlgorithmsResp = modelarts.DeleteAlgorithmsResp
DeleteDataSetReq = modelarts.DeleteDataSetReq
@ -125,6 +126,7 @@ type (
ImportTasks = modelarts.ImportTasks
Input = modelarts.Input
InputDataInfo = modelarts.InputDataInfo
InputTraining = modelarts.InputTraining
Inputs = modelarts.Inputs
InputsAlRp = modelarts.InputsAlRp
InputsAlRq = modelarts.InputsAlRq
@ -182,8 +184,10 @@ type (
Npu = modelarts.Npu
Obs = modelarts.Obs
Obs1 = modelarts.Obs1
ObsTra = modelarts.ObsTra
OperatorParam = modelarts.OperatorParam
Output = modelarts.Output
OutputTraining = modelarts.OutputTraining
Outputs = modelarts.Outputs
OutputsAl = modelarts.OutputsAl
OutputsAlRp = modelarts.OutputsAlRp
@ -205,6 +209,8 @@ type (
Remote = modelarts.Remote
RemoteConstraint = modelarts.RemoteConstraint
RemoteConstraints = modelarts.RemoteConstraints
RemoteOut = modelarts.RemoteOut
RemoteTra = modelarts.RemoteTra
Resource = modelarts.Resource
ResourceCreateTraining = modelarts.ResourceCreateTraining
ResourceRequirements = modelarts.ResourceRequirements

View File

@ -7,7 +7,7 @@ NacosConfig:
# - IpAddr: nacos-headless
# Port: 8848
ClientConfig:
NamespaceId: test_octopus
NamespaceId: test
TimeoutMs: 5000
NotLoadCacheAtStart: true
LogDir:

View File

@ -201,6 +201,22 @@ type (
}
)
type (
jobTotalResp {
AllCardRunTime float64 `json:"allCardRunTime"`
AllJobCount float64 `json:"allJobCount"`
AllJobRunTime float64 `json:"allJobRunTime"`
TrainJobs []TrainJob `json:"trainJobs"`
}
TrainJob {
Name string `json:"name"`
Status string `json:"status"`
ServiceName string `json:"serviceName"`
SynergyStatus string `json:"synergyStatus"`
Strategy int `json:"strategy"`
}
)
type (
taskListResp {
TotalCount int `json:"totalCount"`
@ -271,14 +287,39 @@ type (
}
)
type (
listClusterReq {
CenterId int32 `path:"centerId"`
}
listClusterResp {
Code int32 `json:"code"`
Msg string `json:"msg"`
Data ClusterData `json:"data"`
}
ClusterData {
TotalCount int `json:"totalCount"`
Clusters []ComputeCluster `json:"clusters"`
}
ComputeCluster {
Id int64 `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
JcceDomainId int64 `json:"jcceDomainId"`
JcceDomainName string `json:"jcceDomainName"`
Longitude float64 `json:"longitude"`
Latitude float64 `json:"latitude"`
Description string `json:"description"`
}
)
type (
cpResp {
POpsAtFp16 float32 `json:"pOpsAtFp16"`
}
GiResp {
CpuNum int32 `json:"cpuNum,optional"`
MemoryInGib int32 `json:"memoryInGib,optional"`
CpuNum int32 `json:"cpuNum,optional"`
MemoryInGib int32 `json:"memoryInGib,optional"`
StorageInGib int32 `json:"storageInGib,optional"`
}
)
@ -289,18 +330,28 @@ type (
DomainResourceList []DomainResource `json:"domainResourceList"`
}
DomainResource {
Id int64 `json:"id"` // id
DomainId string `json:"domain_id"` // 资源域id
DomainName string `json:"domain_name"` // 资源域名称
JobCount int64 `json:"job_count"` // 资源域任务数量
DomainSource int64 `json:"domain_source"` // 资源域数据来源0-nudt1-鹏城
Stack string `json:"stack"` // 技术栈
ResourceType string `json:"resource_type"` // 资源类型
Cpu string `json:"cpu"` // cpu
Memory string `json:"memory"` // 内存
Disk string `json:"disk"` // 存储
NodeCount string `json:"nodeCount"` //节点数量
// DeleteFlag int64 `json:"delete_flag"` // 是否删除 0:未删除1:已经删除
Id int64 `json:"id"` // id
DomainId string `json:"domainId"` // 资源域id
DomainName string `json:"domainName"` // 资源域名称
JobCount int64 `json:"jobCount"` // 资源域任务数量
DomainSource int64 `json:"domainSource"` // 资源域数据来源0-nudt1-鹏城
Stack string `json:"stack"` // 技术栈
ResourceType string `json:"resourceType"` // 资源类型
Cpu float64 `json:"cpu"` // cpu使用率
Memory float64 `json:"memory"` // 内存使用率
Disk float64 `json:"disk"` // 存储使用率
NodeCount float64 `json:"nodeCount"` //节点使用率
// DeleteFlag int64 `json:"delete_flag"` // 是否删除 0:未删除1:已经删除
Description string `json:"description"` //集群描述
ClusterName string `json:"clusterName"` //集群名称
CpuTotal float64 `json:"cpuTotal"` //cpu总核数
MemoryTotal float64 `json:"memoryTotal"` //内存总量Gi
DiskTotal float64 `json:"diskTotal"` //存储总量GB
NodeTotal float64 `json:"nodeTotal"` //容器节点数
CpuUsage float64 `json:"cpuUsage"` //cpu已使用核数
MemoryUsage float64 `json:"memoryUsage"` //内存已使用Gi
DiskUsage float64 `json:"diskUsage"` //存储已使用GB
NodeUsage float64 `json:"nodeUsage"` //容器节点已使用
}
)
@ -346,4 +397,28 @@ type (
CreateTime string `json:"createTime"` //创建时间,
UpdateTime string `json:"updateTime"` //更新时间
}
)
)
//jccSchedule容器集群资源监控 > start
type ClusterMetrics struct {
Code int `json:"code,omitempty"`
Msg string `json:"msg,omitempty"`
Data []MetricResult `json:"data,omitempty"`
}
type MetricResult struct {
MetricName string `json:"metric_name, omitempty"`
MetricData MetricData `json:"data, omitempty"`
}
type MetricData struct {
Result []map[string]interface{} `json:"result"`
ResultType string `json:"resultType"`
}
type ResultData struct {
Status string `json:"status"`
Data MetricData `json:"data"`
}
//jccSchedule容器集群资源监控 >end

View File

@ -30,9 +30,15 @@ service pcm {
@handler TaskListHandler
get /core/taskList () returns (taskListResp)
@handler JobTotalHandler
get /core/jobTotal () returns (jobTotalResp)
@handler listCenterHandler
get /core/listCenter () returns (listCenterResp)
@handler listClusterHandler
get /core/listCluster/:centerId (listClusterReq) returns (listClusterResp)
@handler submitJobHandler
post /core/submitJob (submitJobReq) returns (submitJobResp)
@ -185,11 +191,11 @@ service pcm {
group : image
)
service pcm {
@handler uploadImageHandler
post /image/upload () returns ()
@handler uploadHandler
post /upload () returns ()
@handler chunkImageHandler
post /image/chunk () returns ()
@handler chunkHandler
post /chunk () returns ()
@handler imageListHandler
get /image/list () returns (imageListResp)

View File

@ -4,7 +4,7 @@ NacosConfig:
ServerConfigs:
# - IpAddr: 127.0.0.1
# Port: 8848
- IpAddr: 10.101.15.7
- IpAddr: nacos.jcce.dev
Port: 8848
ClientConfig:
NamespaceId: test

View File

@ -33,4 +33,10 @@ type Config struct {
CephRpcConf zrpc.RpcClientConf
OctopusRpcConf zrpc.RpcClientConf
NexusUrl string
JccScheduleUrl string
MinioConf struct {
Secret string
AccessKey string
Endpoint string
}
}

View File

@ -0,0 +1,17 @@
package core
import (
"PCM/common/result"
"net/http"
"PCM/adaptor/PCM-CORE/api/internal/logic/core"
"PCM/adaptor/PCM-CORE/api/internal/svc"
)
func JobTotalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := core.NewJobTotalLogic(r.Context(), svcCtx)
resp, err := l.JobTotal()
result.HttpResult(r, w, resp, err)
}
}

View File

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

View File

@ -0,0 +1,190 @@
package image
import (
"PCM/adaptor/PCM-CORE/model"
result2 "PCM/common/result"
"PCM/common/tool"
"bufio"
"context"
"encoding/base64"
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
types2 "github.com/docker/docker/api/types"
"github.com/zeromicro/go-zero/core/logx"
"io/ioutil"
"k8s.io/apimachinery/pkg/util/json"
"net/http"
"os"
"path/filepath"
"strconv"
"strings"
"sync"
"time"
"PCM/adaptor/PCM-CORE/api/internal/svc"
)
var dir, _ = os.Getwd()
var uploadPath = filepath.Join(dir, "uploads")
func ChunkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
size, _ := strconv.ParseInt(r.PostFormValue("size"), 10, 64)
hash := r.PostFormValue("hash")
name := r.PostFormValue("name")
dataType := r.PostFormValue("dataType")
kind := r.PostFormValue("kind")
// 对比合并请求的文件大小和已上传文件夹大小
toSize, _ := tool.GetDirSize(filepath.Join(uploadTempPath, hash))
if size != toSize {
fmt.Fprintf(w, "文件上传错误")
}
chunksPath := filepath.Join(uploadTempPath, hash)
files, _ := ioutil.ReadDir(chunksPath)
// 将文件根据索引序号排序
filesSort := make(map[string]string)
for _, f := range files {
nameArr := strings.Split(f.Name(), "-")
filesSort[nameArr[1]] = f.Name()
}
saveFile := filepath.Join(uploadPath, name)
if exists, _ := tool.PathExists(saveFile); exists {
os.Remove(saveFile)
}
fs, _ := os.OpenFile(saveFile, os.O_CREATE|os.O_RDWR|os.O_APPEND, os.ModeAppend|os.ModePerm)
var wg sync.WaitGroup
filesCount := len(files)
if filesCount != len(filesSort) {
fmt.Fprintf(w, "文件上传错误2")
}
wg.Add(filesCount)
for i := 0; i < filesCount; i++ {
// 这里一定要注意按顺序读取不然文件就会损坏
fileName := filepath.Join(chunksPath, filesSort[strconv.Itoa(i)])
data, err := ioutil.ReadFile(fileName)
fmt.Println(err)
fs.Write(data)
wg.Done()
}
wg.Wait()
os.RemoveAll(chunksPath)
// 保存到数据库表里
svcCtx.DbEngin.Create(&model.File{
Name: name,
Hash: hash,
DataType: dataType,
Status: "local",
Kind: kind,
Bucket: "pcm"})
// 根据数据类型按需上传镜像推送到nexus 数据集和算法推送到云际存储)
var err error
switch kind {
case "image":
err = pushImage(svcCtx, hash, name)
case "dataSet", "algorithm":
err = uploadStorage(svcCtx, hash, name)
}
// 删除本地文件 避免占用本地存储资源
defer os.Remove(filepath.Join(uploadPath, name))
defer fs.Close()
result2.HttpResult(r, w, nil, err)
}
}
// 同步数据集到modelArts
func syncDataSet() {
}
// 上传文件到云集存储
func uploadStorage(svcCtx *svc.ServiceContext, hash string, name string) error {
fileInfo, err := os.Open(filepath.Join(uploadPath, name))
if err != nil {
logx.Error(err)
return err
}
_, err = svcCtx.Uploader.Upload(&s3manager.UploadInput{
Bucket: aws.String("pcm"),
Key: aws.String(name),
Body: fileInfo,
})
if err != nil {
logx.Error(err)
return err
}
// 更新数据状态
svcCtx.DbEngin.Model(&model.File{}).Where("hash = ?", hash).Update("status", "cloud")
return nil
}
// 推送镜像到nexus仓库
func pushImage(svcCtx *svc.ServiceContext, hash string, name string) error {
// 加载镜像文件到docker
fileInfo, err := os.Open(filepath.Join(uploadPath, name))
if err != nil {
logx.Error(err)
return err
}
defer fileInfo.Close()
reader := bufio.NewReader(fileInfo)
body, err := svcCtx.DockerClient.ImageLoad(context.Background(), reader, false)
if err != nil {
logx.Error(err)
return err
}
bytes, err := ioutil.ReadAll(body.Body)
println(string(bytes))
if err != nil {
logx.Error(err)
return err
}
//time.Sleep(12 * 100 * time.Millisecond)
privateImageName := "hub.jcce.dev:18445/repository/docker-hub/" + name
// 给镜像打上私有仓库的tag
err = svcCtx.DockerClient.ImageTag(context.Background(), name, privateImageName)
if err != nil {
logx.Error(err)
return err
}
// 删除原镜像
_, err = svcCtx.DockerClient.ImageRemove(context.Background(), name, types2.ImageRemoveOptions{})
if err != nil {
logx.Error(err)
return err
}
// 推送镜像到registry
authConfig := types2.AuthConfig{
Username: "admin",
Password: "Nudt@123",
}
authConfigBytes, err := json.Marshal(authConfig)
if err != nil {
logx.Error(err)
return err
}
println(fmt.Sprintln("传输开始", time.Now()))
authStr := base64.URLEncoding.EncodeToString(authConfigBytes)
pushBody, err := svcCtx.DockerClient.ImagePush(context.Background(), privateImageName, types2.ImagePushOptions{RegistryAuth: authStr})
pushBytes, _ := ioutil.ReadAll(pushBody)
println(string(pushBytes))
if err != nil {
logx.Error(err)
return err
}
logx.Infof(fmt.Sprintln("传输完成", time.Now()))
// 删除本地镜像 避免存储资源浪费
_, err = svcCtx.DockerClient.ImageRemove(context.Background(), privateImageName, types2.ImageRemoveOptions{})
if err != nil {
logx.Error(err)
return err
}
// 更新数据状态
svcCtx.DbEngin.Model(&model.File{}).Where("hash = ?", hash).Update("status", "cloud")
return nil
}

View File

@ -1,127 +0,0 @@
package image
import (
result2 "PCM/common/result"
"bufio"
"context"
"encoding/base64"
"fmt"
types2 "github.com/docker/docker/api/types"
"github.com/zeromicro/go-zero/core/logx"
"github.com/zeromicro/go-zero/rest/httpx"
"io/ioutil"
"k8s.io/apimachinery/pkg/util/json"
"net/http"
"os"
"path/filepath"
"strconv"
"strings"
"sync"
"PCM/adaptor/PCM-CORE/api/internal/svc"
)
var dir, _ = os.Getwd()
var uploadPath = filepath.Join(dir, "uploads")
func ChunkImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
size, _ := strconv.ParseInt(r.PostFormValue("size"), 10, 64)
hash := r.PostFormValue("hash")
name := r.PostFormValue("name")
// 对比合并请求的文件大小和已上传文件夹大小
toSize, _ := getDirSize(filepath.Join(uploadTempPath, hash))
if size != toSize {
fmt.Fprintf(w, "文件上传错误")
}
chunksPath := filepath.Join(uploadTempPath, hash)
files, _ := ioutil.ReadDir(chunksPath)
// 将文件根据索引序号排序
filesSort := make(map[string]string)
for _, f := range files {
nameArr := strings.Split(f.Name(), "-")
filesSort[nameArr[1]] = f.Name()
}
saveFile := filepath.Join(uploadPath, name)
if exists, _ := PathExists(saveFile); exists {
os.Remove(saveFile)
}
fs, _ := os.OpenFile(saveFile, os.O_CREATE|os.O_RDWR|os.O_APPEND, os.ModeAppend|os.ModePerm)
var wg sync.WaitGroup
filesCount := len(files)
if filesCount != len(filesSort) {
fmt.Fprintf(w, "文件上传错误2")
}
wg.Add(filesCount)
for i := 0; i < filesCount; i++ {
// 这里一定要注意按顺序读取不然文件就会损坏
fileName := filepath.Join(chunksPath, filesSort[strconv.Itoa(i)])
data, err := ioutil.ReadFile(fileName)
fmt.Println(err)
fs.Write(data)
wg.Done()
}
wg.Wait()
os.RemoveAll(chunksPath)
defer fs.Close()
// 加载镜像文件到docker
fileInfo, err := os.Open(filepath.Join(uploadPath, name))
reader := bufio.NewReader(fileInfo)
if err != nil {
return
}
body, err := svcCtx.DockerClient.ImageLoad(context.Background(), reader, false)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
bytes, err := ioutil.ReadAll(body.Body)
loadBody := LoadBody{}
err = json.Unmarshal(bytes, &loadBody)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
imageName := strings.TrimSpace(loadBody.Stream[13:])
privateImageName := "hub.jcce.dev:18445/repository/pcm/" + imageName
// 给镜像打上私有仓库的tag
err = svcCtx.DockerClient.ImageTag(context.Background(), imageName, privateImageName)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
// 推送镜像到registry
authConfig := types2.AuthConfig{
Username: "admin",
Password: "Nudt@123",
}
authConfigBytes, err := json.Marshal(authConfig)
authStr := base64.URLEncoding.EncodeToString(authConfigBytes)
_, err = svcCtx.DockerClient.ImagePush(context.Background(), privateImageName, types2.ImagePushOptions{RegistryAuth: authStr})
if err != nil {
logx.Error(err.Error())
return
}
println("传输完成!")
// 删除本地镜像 避免存储资源浪费
_, err = svcCtx.DockerClient.ImageRemove(context.Background(), privateImageName, types2.ImageRemoveOptions{})
if err != nil {
return
}
result2.HttpResult(r, w, nil, err)
}
}
// DirSize 获取整体文件夹大小
func getDirSize(path string) (int64, error) {
var size int64
err := filepath.Walk(path, func(_ string, info os.FileInfo, err error) error {
if !info.IsDir() {
size += info.Size()
}
return err
})
return size, err
}

View File

@ -2,6 +2,7 @@ package image
import (
result2 "PCM/common/result"
"PCM/common/tool"
"bufio"
"fmt"
"io"
@ -20,22 +21,24 @@ type LoadBody struct {
var uploadTempPath = filepath.Join(uploadPath, "temp")
func UploadImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
func UploadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
file, fileHeader, err := r.FormFile("file")
index := r.PostFormValue("index")
hash := r.PostFormValue("hash")
defer file.Close()
// 合并路径
chunksPath := filepath.Join(uploadTempPath, hash)
// 文件路径
filePath := filepath.Join(chunksPath, hash+"-"+index)
// 检查临时文件夹是否存在
isPathExists, err := PathExists(chunksPath)
// 检查临时文件夹是否存在 不存在则创建文件夹
isPathExists, err := tool.PathExists(chunksPath)
if !isPathExists {
err = os.MkdirAll(chunksPath, os.ModePerm)
}
// 检查文件是否存在
exists, err := PathExists(filePath)
exists, err := tool.PathExists(filePath)
// 文件存在 进行断点续传
if exists {
fileInfo, _ := os.Stat(filePath)
@ -45,7 +48,7 @@ func UploadImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
}
start := strconv.Itoa(int(fileInfo.Size()))
oldFile, _ := os.OpenFile(filePath, os.O_CREATE|os.O_WRONLY, os.ModePerm)
defer file.Close()
defer oldFile.Close()
count, _ := strconv.ParseInt(start, 10, 64)
fmt.Println("已上传:", count)
// 设置读,写的偏移量
@ -81,19 +84,6 @@ func UploadImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
defer file.Close()
defer destFile.Close()
}
result2.HttpResult(r, w, nil, err)
}
}
// PathExists 判断文件夹是否存在
func PathExists(path string) (bool, error) {
_, err := os.Stat(path)
if err == nil {
return true, nil
}
if os.IsNotExist(err) {
return false, nil
}
return false, err
}

View File

@ -32,11 +32,21 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/core/taskList",
Handler: core.TaskListHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/core/jobTotal",
Handler: core.JobTotalHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/core/listCenter",
Handler: core.ListCenterHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/core/listCluster/:centerId",
Handler: core.ListClusterHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/core/submitJob",
@ -273,13 +283,13 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
[]rest.Route{
{
Method: http.MethodPost,
Path: "/image/upload",
Handler: image.UploadImageHandler(serverCtx),
Path: "/upload",
Handler: image.UploadHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/image/chunk",
Handler: image.ChunkImageHandler(serverCtx),
Path: "/chunk",
Handler: image.ChunkHandler(serverCtx),
},
{
Method: http.MethodGet,
@ -298,5 +308,6 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
},
},
rest.WithPrefix("/pcm/v1"),
rest.WithMaxBytes(1111111111),
)
}

View File

@ -0,0 +1,110 @@
package core
import (
"PCM/adaptor/PCM-CORE/model"
"PCM/common/enum"
"PCM/common/tool"
"context"
"k8s.io/apimachinery/pkg/util/json"
"strings"
"PCM/adaptor/PCM-CORE/api/internal/svc"
"PCM/adaptor/PCM-CORE/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type JobTotalLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
type Job struct {
TotalSize int `json:"totalSize"`
OtJobs []OtJob `json:"otJobs"`
}
type OtJob struct {
Name string `json:"name"`
Status string `json:"status"`
Tasks []Task `json:"tasks"`
}
type Task struct {
CenterName []string `json:"centerName"`
}
func NewJobTotalLogic(ctx context.Context, svcCtx *svc.ServiceContext) *JobTotalLogic {
return &JobTotalLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *JobTotalLogic) JobTotal() (resp *types.JobTotalResp, err error) {
// 获取任务时间信息
resp = &types.JobTotalResp{}
bytes, err := tool.HttpGet("GET", "https://grampus.openi.org.cn/openapi/v1/sharescreen/computepower/alljobinfo")
if err != nil {
return nil, err
}
json.Unmarshal(bytes, resp)
// 获取其他任务信息
jobs := &Job{}
jobBytes, err := tool.HttpGet("GET", "https://grampus.openi.org.cn/openapi/v1/sharescreen/trainjob?pageIndex=1&pageSize=10")
if err != nil {
return nil, err
}
json.Unmarshal(jobBytes, jobs)
for _, job := range jobs.OtJobs {
trainJob := types.TrainJob{
Name: job.Name,
Status: job.Status,
Strategy: 0,
SynergyStatus: "未协同",
}
if job.Tasks[0].CenterName != nil {
trainJob.ServiceName = job.Tasks[0].CenterName[0]
}
resp.TrainJobs = append(resp.TrainJobs, trainJob)
}
var tasks []model.Task
tx := l.svcCtx.DbEngin.Find(&tasks)
if tx.Error != nil {
logx.Error(err)
return nil, tx.Error
}
if len(tasks) == 0 {
return nil, nil
}
for _, task := range tasks {
tx := l.svcCtx.DbEngin.Raw("SELECT CONCAT_WS(',',GROUP_CONCAT(DISTINCT h.service_name) ,GROUP_CONCAT(DISTINCT a.service_name) ,GROUP_CONCAT(DISTINCT c.service_name))as service_name from task t left join hpc h on t.id = h.task_id left join cloud c on t.id = c.task_id left join ai a on t.id = a.task_id where t.id = ?", task.Id).Scan(&task.ServiceName)
if tx.Error != nil {
logx.Error(err)
return nil, tx.Error
}
// 承接方转义
if task.ServiceName != "" {
var names []string
servicesName := strings.Split(task.ServiceName, ",")
for _, name := range servicesName {
names = append(names, enum.Partner(name).String())
}
task.ServiceName = strings.Join(names, ",")
}
resp.TrainJobs = append(resp.TrainJobs, types.TrainJob{
ServiceName: task.ServiceName,
Name: task.Name,
Strategy: int(task.Strategy),
SynergyStatus: enum.SynergyStatus(task.SynergyStatus).String(),
Status: task.Status,
})
}
return resp, nil
}

View File

@ -0,0 +1,62 @@
package core
import (
"PCM/adaptor/PCM-CORE/api/internal/svc"
"PCM/adaptor/PCM-CORE/api/internal/types"
"PCM/adaptor/PCM-CORE/model"
"context"
"github.com/zeromicro/go-zero/core/logx"
)
type ListClusterLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewListClusterLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListClusterLogic {
return &ListClusterLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *ListClusterLogic) ListCluster(req *types.ListClusterReq) (*types.ListClusterResp, error) {
var clusters []types.ComputeCluster
var clustersModel *[]model.ComputeCluster
//var centersModel []model.ComputeCenter
var resp types.ListClusterResp
l.svcCtx.DbEngin.Raw("select * from compute_cluster where center_id = ?", req.CenterId).Scan(&clustersModel)
if clustersModel == nil {
resp.Code = 200
resp.Msg = "success"
resp.Data.TotalCount = 0
return &resp, nil
}
var clustersModelV = *clustersModel
for _, clusterModel := range clustersModelV {
var cluster types.ComputeCluster
cluster.Id = clusterModel.Id
cluster.Name = clusterModel.Name.String
cluster.Type = clusterModel.Type.String
cluster.JcceDomainId = clusterModel.JcceDomainId.Int64
cluster.JcceDomainName = clusterModel.JcceDomainName.String
cluster.Longitude = clusterModel.Longitude.Float64
cluster.Latitude = clusterModel.Latitude.Float64
cluster.Description = clusterModel.Description.String
clusters = append(clusters, cluster)
}
resp.Code = 200
resp.Msg = "success"
resp.Data.TotalCount = len(clusters)
resp.Data.Clusters = clusters
return &resp, nil
}

View File

@ -6,11 +6,12 @@ import (
"PCM/adaptor/PCM-CORE/model"
"PCM/common/tool"
"context"
"math/rand"
"strconv"
"time"
"fmt"
"github.com/shopspring/decimal"
"github.com/zeromicro/go-zero/core/logx"
"k8s.io/apimachinery/pkg/util/json"
"math"
"strconv"
)
type ListDomainResourceLogic struct {
@ -28,23 +29,218 @@ func NewListDomainResourceLogic(ctx context.Context, svcCtx *svc.ServiceContext)
}
func (l *ListDomainResourceLogic) ListDomainResource() (resp *types.DomainResourceResp, err error) {
//TODO 域信息查询数算集群监控
resp = &types.DomainResourceResp{}
var domainResourceModel []model.DomainResource
sqlStr := `select * from domain_resource where delete_flag=0 order by id`
sqlStr := "select * from `joint_domain`.domain_cluster"
l.svcCtx.DbEngin.Raw(sqlStr).Scan(&domainResourceModel)
tool.Convert(domainResourceModel, &resp.DomainResourceList)
rand.Seed(time.Now().UnixNano())
//TODO rand
metrics := &types.ClusterMetrics{}
//获取指定集群监控数据
for i := 0; i < len(resp.DomainResourceList); i++ {
c := rand.Intn(65) + 10
m := rand.Intn(65) + 10
d := rand.Intn(65) + 10
n := rand.Intn(65) + 10
resp.DomainResourceList[i].Cpu = strconv.Itoa(c)
resp.DomainResourceList[i].Memory = strconv.Itoa(m)
resp.DomainResourceList[i].Disk = strconv.Itoa(d)
resp.DomainResourceList[i].NodeCount = strconv.Itoa(n)
url := fmt.Sprintf("%s/api/v1/resource/getClusterMetrics?clusterName=%s", l.svcCtx.Config.JccScheduleUrl, resp.DomainResourceList[i].ClusterName)
bytes, err := tool.HttpGet("GET", url)
if err != nil {
logx.WithContext(l.ctx).Errorf("获取云算指定集群监控数据 err: %s", err.Error())
return nil, err
}
json.Unmarshal(bytes, metrics)
if metrics.Code == 200 {
//fmt.Print(metrics)
for _, metricResult := range metrics.Data {
//集群内存已使用
if metricResult.MetricName == "cluster_memory_usage_wo_cache" {
format, ok := metricResult.MetricData.Result[0]["values"].([]interface{})
if ok {
for _, val := range format {
f, ok := val.([]interface{})
if ok {
value, _ := f[1].(string)
v1, err := strconv.ParseFloat(value, 32)
if err != nil {
continue
}
v2, _ := decimal.NewFromFloat(v1 / (1024 * 1024 * 1024)).Round(2).Float64()
resp.DomainResourceList[i].MemoryUsage = v2
} else {
continue
}
}
} else {
continue
}
}
//集群内存总量
if metricResult.MetricName == "cluster_memory_total" {
format, ok := metricResult.MetricData.Result[0]["values"].([]interface{})
if ok {
for _, val := range format {
f, ok := val.([]interface{})
if ok {
value, _ := f[1].(string)
v1, err := strconv.ParseFloat(value, 32)
if err != nil {
continue
}
v2, _ := decimal.NewFromFloat(v1 / (1024 * 1024 * 1024)).Round(2).Float64()
resp.DomainResourceList[i].MemoryTotal = v2
} else {
continue
}
}
} else {
continue
}
}
//集群cpu已使用
if metricResult.MetricName == "cluster_cpu_usage" {
format, ok := metricResult.MetricData.Result[0]["values"].([]interface{})
if ok {
for _, val := range format {
f, ok := val.([]interface{})
if ok {
value, _ := f[1].(string)
v1, err := strconv.ParseFloat(value, 32)
if err != nil {
continue
}
v2, _ := decimal.NewFromFloat(v1).Round(2).Float64()
resp.DomainResourceList[i].CpuUsage = v2
} else {
continue
}
}
} else {
continue
}
}
//集群cpu总核数
if metricResult.MetricName == "cluster_cpu_total" {
format, ok := metricResult.MetricData.Result[0]["values"].([]interface{})
if ok {
for _, val := range format {
f, ok := val.([]interface{})
if ok {
value, _ := f[1].(string)
v1, err := strconv.ParseFloat(value, 32)
if err != nil {
continue
}
v2, _ := decimal.NewFromFloat(v1).Round(2).Float64()
resp.DomainResourceList[i].CpuTotal = v2
} else {
continue
}
}
} else {
continue
}
}
//集群容器节点已使用数量
if metricResult.MetricName == "cluster_pod_running_count" {
format, ok := metricResult.MetricData.Result[0]["values"].([]interface{})
if ok {
for _, val := range format {
f, ok := val.([]interface{})
if ok {
value, _ := f[1].(string)
v1, err := strconv.ParseFloat(value, 32)
if err != nil {
continue
}
v2, _ := decimal.NewFromFloat(v1).Round(2).Float64()
resp.DomainResourceList[i].NodeUsage = v2
} else {
continue
}
}
} else {
continue
}
}
//集群容器节点总量
if metricResult.MetricName == "cluster_pod_quota" {
format, ok := metricResult.MetricData.Result[0]["values"].([]interface{})
if ok {
for _, val := range format {
f, ok := val.([]interface{})
if ok {
value, _ := f[1].(string)
v1, err := strconv.ParseFloat(value, 32)
if err != nil {
continue
}
v2, _ := decimal.NewFromFloat(v1).Round(2).Float64()
resp.DomainResourceList[i].NodeTotal = v2
} else {
continue
}
}
} else {
continue
}
}
//集群磁盘已使用
if metricResult.MetricName == "cluster_disk_size_usage" {
format, ok := metricResult.MetricData.Result[0]["values"].([]interface{})
if ok {
for _, val := range format {
f, ok := val.([]interface{})
if ok {
value, _ := f[1].(string)
v1, err := strconv.ParseFloat(value, 32)
if err != nil {
continue
}
v2, _ := decimal.NewFromFloat(v1 / (1000 * 1000 * 1000)).Round(2).Float64()
resp.DomainResourceList[i].DiskUsage = v2
} else {
continue
}
}
} else {
continue
}
}
//集群磁盘总量
if metricResult.MetricName == "cluster_disk_size_capacity" {
format, ok := metricResult.MetricData.Result[0]["values"].([]interface{})
if ok {
for _, val := range format {
f, ok := val.([]interface{})
if ok {
value, _ := f[1].(string)
v1, err := strconv.ParseFloat(value, 32)
if err != nil {
continue
}
v2, _ := decimal.NewFromFloat(v1 / (1000 * 1000 * 1000)).Round(2).Float64()
resp.DomainResourceList[i].DiskTotal = v2
} else {
continue
}
}
} else {
continue
}
}
if resp.DomainResourceList[i].CpuUsage != 0 && resp.DomainResourceList[i].CpuTotal != 0 {
resp.DomainResourceList[i].Cpu = math.Ceil((resp.DomainResourceList[i].CpuUsage / resp.DomainResourceList[i].CpuTotal) * 10000 / 100.00)
}
if resp.DomainResourceList[i].NodeUsage != 0 && resp.DomainResourceList[i].NodeTotal != 0 {
resp.DomainResourceList[i].NodeCount = math.Ceil((resp.DomainResourceList[i].NodeUsage / resp.DomainResourceList[i].NodeTotal) * 10000 / 100.00)
}
if resp.DomainResourceList[i].DiskUsage != 0 && resp.DomainResourceList[i].DiskTotal != 0 {
resp.DomainResourceList[i].Disk = math.Ceil((resp.DomainResourceList[i].DiskUsage / resp.DomainResourceList[i].DiskTotal) * 10000 / 100.00)
}
if resp.DomainResourceList[i].MemoryUsage != 0 && resp.DomainResourceList[i].MemoryTotal != 0 {
resp.DomainResourceList[i].Memory = math.Ceil((resp.DomainResourceList[i].MemoryUsage / resp.DomainResourceList[i].MemoryTotal) * 10000 / 100.00)
}
resp.DomainResourceList[i].DomainName = resp.DomainResourceList[i].Description
resp.DomainResourceList[i].ResourceType = "云算"
resp.DomainResourceList[i].Stack = "kubernetes"
}
}
}
return resp, nil
}

View File

@ -7,21 +7,21 @@ import (
"github.com/zeromicro/go-zero/core/logx"
)
type ChunkImageLogic struct {
type ChunkLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewChunkImageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ChunkImageLogic {
return &ChunkImageLogic{
func NewChunkLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ChunkLogic {
return &ChunkLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *ChunkImageLogic) ChunkImage() error {
func (l *ChunkLogic) Chunk() error {
// todo: add your logic here and delete this line
return nil

View File

@ -26,7 +26,7 @@ func NewDataSetCheckLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Data
func (l *DataSetCheckLogic) DataSetCheck(req *types.CheckReq) (resp *types.CheckResp, err error) {
resp = &types.CheckResp{}
var dataSets []model.DataSet
var dataSets []model.File
l.svcCtx.DbEngin.Find(&dataSets).Where("md5", req.FileMd5)
if len(dataSets) != 0 {
resp.Exist = true

View File

@ -1,9 +1,8 @@
package image
import (
"context"
"PCM/adaptor/PCM-CORE/api/internal/svc"
"context"
"github.com/zeromicro/go-zero/core/logx"
)
@ -22,7 +21,6 @@ func NewUploadDataSetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Upl
}
func (l *UploadDataSetLogic) UploadDataSet() error {
// todo: add your logic here and delete this line
return nil
}

View File

@ -1,27 +1,28 @@
package image
import (
"PCM/adaptor/PCM-CORE/api/internal/svc"
"PCM/adaptor/PCM-CORE/api/internal/types"
"context"
"PCM/adaptor/PCM-CORE/api/internal/svc"
"github.com/zeromicro/go-zero/core/logx"
)
type UploadImageLogic struct {
type UploadLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewUploadImageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UploadImageLogic {
return &UploadImageLogic{
func NewUploadLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UploadLogic {
return &UploadLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *UploadImageLogic) UploadImage(req *types.UploadImageReq) error {
func (l *UploadLogic) Upload() error {
// todo: add your logic here and delete this line
return nil
}

View File

@ -7,6 +7,10 @@ import (
"PCM/adaptor/PCM-HPC/PCM-AC/rpc/hpcacclient"
"PCM/adaptor/PCM-HPC/PCM-TH/rpc/hpcthclient"
"PCM/adaptor/PCM-STORAGE/PCM-CEPH/rpc/cephclient"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
"github.com/docker/docker/client"
"github.com/go-redis/redis/v8"
"github.com/robfig/cron/v3"
@ -32,9 +36,21 @@ type ServiceContext struct {
OctopusRpc octopusclient.Octopus
CephRpc cephclient.Ceph
DockerClient *client.Client
Downloader *s3manager.Downloader
Uploader *s3manager.Uploader
}
func NewServiceContext(c config.Config) *ServiceContext {
// 创建s3 session
session, _ := session.NewSession(&aws.Config{
Credentials: credentials.NewStaticCredentials(c.MinioConf.AccessKey, c.MinioConf.Secret, ""), //使用静态凭据,硬编码
Endpoint: aws.String(c.MinioConf.Endpoint), //配置端点
Region: aws.String("default"), //配置区域
DisableSSL: aws.Bool(false), //是否禁用https,这里表示不禁用,即使用HTTPS
S3ForcePathStyle: aws.Bool(true), //使用路径样式而非虚拟主机样式,区别请参考:https://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html
})
downloader := s3manager.NewDownloader(session)
uploader := s3manager.NewUploader(session)
//启动Gorm支持
dbEngin, _ := gorm.Open(mysql.Open(c.DB.DataSource), &gorm.Config{
NamingStrategy: schema.NamingStrategy{
@ -60,8 +76,9 @@ func NewServiceContext(c config.Config) *ServiceContext {
ModelArtsRpc: modelartsclient.NewModelArts(zrpc.MustNewClient(c.ModelArtsRpcConf)),
CephRpc: cephclient.NewCeph(zrpc.MustNewClient(c.CephRpcConf)),
ACRpc: hpcacclient.NewHpcAC(zrpc.MustNewClient(c.ACRpcConf)),
//THRpc: hpcthclient.NewHpcTH(zrpc.MustNewClient(c.THRpcConf)),
OctopusRpc: octopusclient.NewOctopus(zrpc.MustNewClient(c.OctopusRpcConf)),
DockerClient: dockerClient,
OctopusRpc: octopusclient.NewOctopus(zrpc.MustNewClient(c.OctopusRpcConf)),
DockerClient: dockerClient,
Downloader: downloader,
Uploader: uploader,
}
}

View File

@ -180,6 +180,21 @@ type TaskInfo struct {
Metadata interface{} `json:"metadata"`
}
type JobTotalResp struct {
AllCardRunTime float64 `json:"allCardRunTime"`
AllJobCount float64 `json:"allJobCount"`
AllJobRunTime float64 `json:"allJobRunTime"`
TrainJobs []TrainJob `json:"trainJobs"`
}
type TrainJob struct {
Name string `json:"name"`
Status string `json:"status"`
ServiceName string `json:"serviceName"`
SynergyStatus string `json:"synergyStatus"`
Strategy int `json:"strategy"`
}
type TaskListResp struct {
TotalCount int `json:"totalCount"`
CardTime float32 `json:"cardTime"`
@ -249,6 +264,32 @@ type Center struct {
HubCode int64 `json:"hubCode"`
}
type ListClusterReq struct {
CenterId int32 `path:"centerId"`
}
type ListClusterResp struct {
Code int32 `json:"code"`
Msg string `json:"msg"`
Data ClusterData `json:"data"`
}
type ClusterData struct {
TotalCount int `json:"totalCount"`
Clusters []ComputeCluster `json:"clusters"`
}
type ComputeCluster struct {
Id int64 `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
JcceDomainId int64 `json:"jcceDomainId"`
JcceDomainName string `json:"jcceDomainName"`
Longitude float64 `json:"longitude"`
Latitude float64 `json:"latitude"`
Description string `json:"description"`
}
type CpResp struct {
POpsAtFp16 float32 `json:"pOpsAtFp16"`
}
@ -265,17 +306,27 @@ type DomainResourceResp struct {
}
type DomainResource struct {
Id int64 `json:"id"` // id
DomainId string `json:"domain_id"` // 资源域id
DomainName string `json:"domain_name"` // 资源域名称
JobCount int64 `json:"job_count"` // 资源域任务数量
DomainSource int64 `json:"domain_source"` // 资源域数据来源0-nudt1-鹏城
Stack string `json:"stack"` // 技术栈
ResourceType string `json:"resource_type"` // 资源类型
Cpu string `json:"cpu"` // cpu
Memory string `json:"memory"` // 内存
Disk string `json:"disk"` // 存储
NodeCount string `json:"nodeCount"` //节点数量
Id int64 `json:"id"` // id
DomainId string `json:"domainId"` // 资源域id
DomainName string `json:"domainName"` // 资源域名称
JobCount int64 `json:"jobCount"` // 资源域任务数量
DomainSource int64 `json:"domainSource"` // 资源域数据来源0-nudt1-鹏城
Stack string `json:"stack"` // 技术栈
ResourceType string `json:"resourceType"` // 资源类型
Cpu float64 `json:"cpu"` // cpu使用率
Memory float64 `json:"memory"` // 内存使用率
Disk float64 `json:"disk"` // 存储使用率
NodeCount float64 `json:"nodeCount"` //节点使用率
Description string `json:"description"` //集群描述
ClusterName string `json:"clusterName"` //集群名称
CpuTotal float64 `json:"cpuTotal"` //cpu总核数
MemoryTotal float64 `json:"memoryTotal"` //内存总量Gi
DiskTotal float64 `json:"diskTotal"` //存储总量GB
NodeTotal float64 `json:"nodeTotal"` //容器节点数
CpuUsage float64 `json:"cpuUsage"` //cpu已使用核数
MemoryUsage float64 `json:"memoryUsage"` //内存已使用Gi
DiskUsage float64 `json:"diskUsage"` //存储已使用GB
NodeUsage float64 `json:"nodeUsage"` //容器节点已使用
}
type ResourcePanelConfigReq struct {
@ -320,6 +371,27 @@ type ResourcePanelConfigResp struct {
UpdateTime string `json:"updateTime"` //更新时间
}
type ClusterMetrics struct {
Code int `json:"code,omitempty"`
Msg string `json:"msg,omitempty"`
Data []MetricResult `json:"data,omitempty"`
}
type MetricResult struct {
MetricName string `json:"metric_name, omitempty"`
MetricData MetricData `json:"data, omitempty"`
}
type MetricData struct {
Result []map[string]interface{} `json:"result"`
ResultType string `json:"resultType"`
}
type ResultData struct {
Status string `json:"status"`
Data MetricData `json:"data"`
}
type Job struct {
SlurmVersion string `json:"slurmVersion"`
Name string `json:"name"`

View File

@ -36,25 +36,27 @@ type (
}
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-是)
ServiceName string `db:"service_name"`
Result string `db:"result"`
YamlString string `db:"yaml_string"`
JobId string `db:"job_id"`
Command string `db:"command"`
FlavorId string `db:"flavor_id"`
ImageUrl string `db:"image_url"`
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-是)
ServiceName string `db:"service_name"`
Result string `db:"result"`
YamlString string `db:"yaml_string"`
JobId string `db:"job_id"`
Command string `db:"command"`
FlavorId string `db:"flavor_id"`
ImageUrl string `db:"image_url"`
SubscriptionId string `db:"subscription_id"`
ItemVersionId string `db:"itemVersion_id"`
}
)

View File

@ -0,0 +1,24 @@
package model
import "github.com/zeromicro/go-zero/core/stores/sqlx"
var _ ComputeClusterModel = (*customComputeClusterModel)(nil)
type (
// ComputeClusterModel is an interface to be customized, add more methods here,
// and implement the added methods in customComputeClusterModel.
ComputeClusterModel interface {
computeClusterModel
}
customComputeClusterModel struct {
*defaultComputeClusterModel
}
)
// NewComputeClusterModel returns a model for the database table.
func NewComputeClusterModel(conn sqlx.SqlConn) ComputeClusterModel {
return &customComputeClusterModel{
defaultComputeClusterModel: newComputeClusterModel(conn),
}
}

View File

@ -0,0 +1,92 @@
// Code generated by goctl. DO NOT EDIT.
package model
import (
"context"
"database/sql"
"fmt"
"strings"
"github.com/zeromicro/go-zero/core/stores/builder"
"github.com/zeromicro/go-zero/core/stores/sqlc"
"github.com/zeromicro/go-zero/core/stores/sqlx"
"github.com/zeromicro/go-zero/core/stringx"
)
var (
computeClusterFieldNames = builder.RawFieldNames(&ComputeCluster{})
computeClusterRows = strings.Join(computeClusterFieldNames, ",")
computeClusterRowsExpectAutoSet = strings.Join(stringx.Remove(computeClusterFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",")
computeClusterRowsWithPlaceHolder = strings.Join(stringx.Remove(computeClusterFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?"
)
type (
computeClusterModel interface {
Insert(ctx context.Context, data *ComputeCluster) (sql.Result, error)
FindOne(ctx context.Context, id int64) (*ComputeCluster, error)
Update(ctx context.Context, data *ComputeCluster) error
Delete(ctx context.Context, id int64) error
}
defaultComputeClusterModel struct {
conn sqlx.SqlConn
table string
}
ComputeCluster struct {
Id int64 `db:"id"` // 集群id
Name sql.NullString `db:"name"` // 集群名
Type sql.NullString `db:"type"` // 集群类型
CenterId sql.NullInt64 `db:"center_id"` // 数据中心id
CenterName sql.NullString `db:"center_name"` // 数据中心名称
JcceDomainId sql.NullInt64 `db:"jcce_domain_id"` // JCCE侧域ID
JcceDomainName sql.NullString `db:"jcce_domain_name"` // JCCE侧域名
Longitude sql.NullFloat64 `db:"longitude"` // 经度
Latitude sql.NullFloat64 `db:"latitude"` // 纬度
Description sql.NullString `db:"description"` // 描述
}
)
func newComputeClusterModel(conn sqlx.SqlConn) *defaultComputeClusterModel {
return &defaultComputeClusterModel{
conn: conn,
table: "`compute_cluster`",
}
}
func (m *defaultComputeClusterModel) Delete(ctx context.Context, id int64) error {
query := fmt.Sprintf("delete from %s where `id` = ?", m.table)
_, err := m.conn.ExecCtx(ctx, query, id)
return err
}
func (m *defaultComputeClusterModel) FindOne(ctx context.Context, id int64) (*ComputeCluster, error) {
query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", computeClusterRows, m.table)
var resp ComputeCluster
err := m.conn.QueryRowCtx(ctx, &resp, query, id)
switch err {
case nil:
return &resp, nil
case sqlc.ErrNotFound:
return nil, ErrNotFound
default:
return nil, err
}
}
func (m *defaultComputeClusterModel) Insert(ctx context.Context, data *ComputeCluster) (sql.Result, error) {
query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, computeClusterRowsExpectAutoSet)
ret, err := m.conn.ExecCtx(ctx, query, data.Name, data.Type, data.CenterId, data.CenterName, data.JcceDomainId, data.JcceDomainName, data.Longitude, data.Latitude, data.Description)
return ret, err
}
func (m *defaultComputeClusterModel) Update(ctx context.Context, data *ComputeCluster) error {
query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, computeClusterRowsWithPlaceHolder)
_, err := m.conn.ExecCtx(ctx, query, data.Name, data.Type, data.CenterId, data.CenterName, data.JcceDomainId, data.JcceDomainName, data.Longitude, data.Latitude, data.Description, data.Id)
return err
}
func (m *defaultComputeClusterModel) tableName() string {
return m.table
}

View File

@ -53,6 +53,8 @@ type (
CreateTime time.Time `db:"create_time"` // 数据创建时间
UpdateTime time.Time `db:"update_time"` // 数据更新时间
DeleteFlag int64 `db:"delete_flag"` // 是否删除 0:未删除1:已经删除
Description string `db:"description"` //集群描述
ClusterName string `db:"cluster_name"` //集群名称
}
)

View File

@ -12,14 +12,15 @@ import "time"
// assembly: hongmouer.his.models.go
// class:HongMouer.HIS.Models.DataSet
// version:2023-05-06 09:58
type DataSet struct {
Id *int `gorm:"column:primaryKey;id" json:"Id"` //type:*int comment:id version:2023-05-06 09:58
Name string `gorm:"column:name" json:"Name"` //type:string comment:文件名称 version:2023-05-06 09:58
Md5 string `gorm:"column:md5" json:"Md5"` //type:string comment:md5 version:2023-05-06 09:58
Type string `gorm:"column:type" json:"Type"` //type:string comment: version:2023-05-06 09:58
type File struct {
Id *int `gorm:"column:id" json:"Id"` //type:*int comment:id version:2023-05-06 09:58
Name string `gorm:"column:name" json:"Name"` //type:string comment:文件名称 version:2023-05-06 09:58
Kind string `gorm:"column:kind" json:"Kind"`
DataType string `gorm:"column:data_type" json:"dataType"` //type:string comment: version:2023-05-06 09:58
Suffix string `gorm:"column:suffix" json:"Suffix"` //type:string comment:后缀名 version:2023-05-06 09:58
Bucket string `gorm:"column:bucket" json:"Bucket"` //type:string comment:桶 version:2023-05-06 09:58
Size *int `gorm:"column:size" json:"Size"` //type:*int comment:大小 version:2023-05-06 09:58
Hash string `gorm:"column:hash" json:"Hash"` //type:string comment:hash version:2023-05-06 09:58
Status string `gorm:"column:status" json:"Status"` //type:string comment:hash version:2023-05-06 09:58
DeletedFlag *int `gorm:"column:deleted_flag" json:"DeletedFlag"` //type:*int comment:是否删除 version:2023-05-06 09:58
CreatedBy *int `gorm:"column:created_by" json:"CreatedBy"` //type:*int comment:创建人 version:2023-05-06 09:58
CreatedTime *time.Time `gorm:"column:created_time" json:"CreatedTime"` //type:*time.Time comment:创建时间 version:2023-05-06 09:58
@ -30,5 +31,5 @@ type DataSet struct {
// TableName 表名:data_set
// 说明:
func TableName() string {
return "data_set"
return "t_file"
}

View File

@ -4,7 +4,7 @@ NacosConfig:
ServerConfigs:
# - IpAddr: 127.0.0.1
# Port: 8848
- IpAddr: 10.101.15.7
- IpAddr: nacos.jcce.dev
Port: 8848
ClientConfig:
NamespaceId: test

View File

@ -25,6 +25,8 @@ message AiInfo {
string imageUrl =11;
string command = 12;
string flavorId =13;
string subscriptionId =14;
string itemVersionId =15;
}
message CloudInfo {

View File

@ -104,19 +104,21 @@ type AiInfo struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ServiceName string `protobuf:"bytes,1,opt,name=serviceName,proto3" json:"serviceName,omitempty"`
TaskId int64 `protobuf:"varint,2,opt,name=taskId,proto3" json:"taskId,omitempty"`
ProjectId string `protobuf:"bytes,3,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"`
Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
Status string `protobuf:"bytes,5,opt,name=status,proto3" json:"status,omitempty"`
StartTime string `protobuf:"bytes,6,opt,name=startTime,proto3" json:"startTime,omitempty"`
RunningTime int64 `protobuf:"varint,7,opt,name=runningTime,proto3" json:"runningTime,omitempty"`
Result string `protobuf:"bytes,8,opt,name=result,proto3" json:"result,omitempty"`
JobId string `protobuf:"bytes,9,opt,name=jobId,proto3" json:"jobId,omitempty"`
CreateTime string `protobuf:"bytes,10,opt,name=createTime,proto3" json:"createTime,omitempty"`
ImageUrl string `protobuf:"bytes,11,opt,name=imageUrl,proto3" json:"imageUrl,omitempty"`
Command string `protobuf:"bytes,12,opt,name=command,proto3" json:"command,omitempty"`
FlavorId string `protobuf:"bytes,13,opt,name=flavorId,proto3" json:"flavorId,omitempty"`
ServiceName string `protobuf:"bytes,1,opt,name=serviceName,proto3" json:"serviceName,omitempty"`
TaskId int64 `protobuf:"varint,2,opt,name=taskId,proto3" json:"taskId,omitempty"`
ProjectId string `protobuf:"bytes,3,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"`
Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
Status string `protobuf:"bytes,5,opt,name=status,proto3" json:"status,omitempty"`
StartTime string `protobuf:"bytes,6,opt,name=startTime,proto3" json:"startTime,omitempty"`
RunningTime int64 `protobuf:"varint,7,opt,name=runningTime,proto3" json:"runningTime,omitempty"`
Result string `protobuf:"bytes,8,opt,name=result,proto3" json:"result,omitempty"`
JobId string `protobuf:"bytes,9,opt,name=jobId,proto3" json:"jobId,omitempty"`
CreateTime string `protobuf:"bytes,10,opt,name=createTime,proto3" json:"createTime,omitempty"`
ImageUrl string `protobuf:"bytes,11,opt,name=imageUrl,proto3" json:"imageUrl,omitempty"`
Command string `protobuf:"bytes,12,opt,name=command,proto3" json:"command,omitempty"`
FlavorId string `protobuf:"bytes,13,opt,name=flavorId,proto3" json:"flavorId,omitempty"`
SubscriptionId string `protobuf:"bytes,14,opt,name=subscriptionId,proto3" json:"subscriptionId,omitempty"`
ItemVersionId string `protobuf:"bytes,15,opt,name=itemVersionId,proto3" json:"itemVersionId,omitempty"`
}
func (x *AiInfo) Reset() {
@ -242,6 +244,20 @@ func (x *AiInfo) GetFlavorId() string {
return ""
}
func (x *AiInfo) GetSubscriptionId() string {
if x != nil {
return x.SubscriptionId
}
return ""
}
func (x *AiInfo) GetItemVersionId() string {
if x != nil {
return x.ItemVersionId
}
return ""
}
type CloudInfo struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -759,7 +775,7 @@ var file_pcmCore_proto_rawDesc = []byte{
0x6c, 0x6f, 0x75, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2f, 0x0a, 0x0a,
0x41, 0x69, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b,
0x32, 0x0f, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x41, 0x69, 0x49, 0x6e, 0x66,
0x6f, 0x52, 0x0a, 0x41, 0x69, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x22, 0xed, 0x02,
0x6f, 0x52, 0x0a, 0x41, 0x69, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x22, 0xbb, 0x03,
0x0a, 0x06, 0x41, 0x69, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61,
@ -782,90 +798,95 @@ var file_pcmCore_proto_rawDesc = []byte{
0x6d, 0x61, 0x67, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61,
0x6e, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e,
0x64, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x6c, 0x61, 0x76, 0x6f, 0x72, 0x49, 0x64, 0x18, 0x0d, 0x20,
0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x6c, 0x61, 0x76, 0x6f, 0x72, 0x49, 0x64, 0x22, 0xbb, 0x02,
0x0a, 0x09, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x20, 0x0a, 0x0b, 0x73,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a,
0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x74,
0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73,
0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65,
0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x04, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d,
0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61,
0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73,
0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61,
0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65,
0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d,
0x65, 0x12, 0x20, 0x0a, 0x0b, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x54, 0x69, 0x6d, 0x65,
0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x54,
0x69, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x0a, 0x20,
0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x79,
0x61, 0x6d, 0x6c, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52,
0x0a, 0x79, 0x61, 0x6d, 0x6c, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0xa9, 0x04, 0x0a, 0x07,
0x48, 0x70, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69,
0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65,
0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73,
0x6b, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49,
0x64, 0x12, 0x14, 0x0a, 0x05, 0x6a, 0x6f, 0x62, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x52, 0x05, 0x6a, 0x6f, 0x62, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73,
0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61,
0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65,
0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d,
0x65, 0x12, 0x20, 0x0a, 0x0b, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x54, 0x69, 0x6d, 0x65,
0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x54,
0x69, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x08, 0x20,
0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x77,
0x6f, 0x72, 0x6b, 0x44, 0x69, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x77, 0x6f,
0x72, 0x6b, 0x44, 0x69, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x77, 0x61, 0x6c, 0x6c, 0x54, 0x69, 0x6d,
0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x77, 0x61, 0x6c, 0x6c, 0x54, 0x69, 0x6d,
0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6d, 0x64, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x18, 0x0b,
0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6d, 0x64, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x12,
0x1c, 0x0a, 0x09, 0x64, 0x65, 0x72, 0x69, 0x76, 0x65, 0x64, 0x45, 0x73, 0x18, 0x0c, 0x20, 0x01,
0x28, 0x09, 0x52, 0x09, 0x64, 0x65, 0x72, 0x69, 0x76, 0x65, 0x64, 0x45, 0x73, 0x12, 0x18, 0x0a,
0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x6c, 0x6f, 0x63, 0x6b,
0x49, 0x64, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x49,
0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x18,
0x0f, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x4e, 0x6f, 0x64, 0x65,
0x73, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x43, 0x70, 0x75, 0x18, 0x10, 0x20,
0x01, 0x28, 0x0d, 0x52, 0x08, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x43, 0x70, 0x75, 0x12, 0x18, 0x0a,
0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x18, 0x12, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x78, 0x69, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x13, 0x20,
0x01, 0x28, 0x0d, 0x52, 0x08, 0x65, 0x78, 0x69, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a,
0x07, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x49, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07,
0x61, 0x73, 0x73, 0x6f, 0x63, 0x49, 0x64, 0x22, 0x34, 0x0a, 0x0c, 0x53, 0x79, 0x6e, 0x63, 0x49,
0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18,
0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d,
0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x22, 0x43, 0x0a,
0x0b, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04,
0x6b, 0x69, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64,
0x12, 0x20, 0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61,
0x6d, 0x65, 0x22, 0xad, 0x01, 0x0a, 0x0c, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x52,
0x65, 0x73, 0x70, 0x12, 0x32, 0x0a, 0x0b, 0x48, 0x70, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69,
0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f,
0x72, 0x65, 0x2e, 0x48, 0x70, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x48, 0x70, 0x63, 0x49,
0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x0d, 0x43, 0x6c, 0x6f, 0x75, 0x64,
0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12,
0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x49, 0x6e,
0x66, 0x6f, 0x52, 0x0d, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73,
0x74, 0x12, 0x2f, 0x0a, 0x0a, 0x41, 0x69, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x18,
0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e,
0x41, 0x69, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x41, 0x69, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69,
0x73, 0x74, 0x32, 0x7b, 0x0a, 0x07, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x12, 0x37, 0x0a,
0x08, 0x53, 0x79, 0x6e, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x2e, 0x70, 0x63, 0x6d, 0x43,
0x6f, 0x72, 0x65, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x1a,
0x15, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x49, 0x6e,
0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x37, 0x0a, 0x08, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69,
0x73, 0x74, 0x12, 0x14, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x49, 0x6e, 0x66,
0x6f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f,
0x72, 0x65, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x42,
0x0a, 0x5a, 0x08, 0x2f, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x6c, 0x61, 0x76, 0x6f, 0x72, 0x49, 0x64, 0x12, 0x26, 0x0a,
0x0e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18,
0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x24, 0x0a, 0x0d, 0x69, 0x74, 0x65, 0x6d, 0x56, 0x65, 0x72,
0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x69, 0x74,
0x65, 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0xbb, 0x02, 0x0a, 0x09,
0x43, 0x6c, 0x6f, 0x75, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x65, 0x72,
0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x74,
0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x74, 0x61, 0x73,
0x6b, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f,
0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73,
0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73,
0x70, 0x61, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65,
0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61,
0x74, 0x75, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75,
0x73, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x08,
0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12,
0x20, 0x0a, 0x0b, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x09,
0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x54, 0x69, 0x6d,
0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28,
0x09, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x79, 0x61, 0x6d,
0x6c, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x79,
0x61, 0x6d, 0x6c, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0xa9, 0x04, 0x0a, 0x07, 0x48, 0x70,
0x63, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49,
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12,
0x14, 0x0a, 0x05, 0x6a, 0x6f, 0x62, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
0x6a, 0x6f, 0x62, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61,
0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75,
0x73, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06,
0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12,
0x20, 0x0a, 0x0b, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x07,
0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x54, 0x69, 0x6d,
0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28,
0x09, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x77, 0x6f, 0x72,
0x6b, 0x44, 0x69, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x77, 0x6f, 0x72, 0x6b,
0x44, 0x69, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x77, 0x61, 0x6c, 0x6c, 0x54, 0x69, 0x6d, 0x65, 0x18,
0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x77, 0x61, 0x6c, 0x6c, 0x54, 0x69, 0x6d, 0x65, 0x12,
0x1c, 0x0a, 0x09, 0x63, 0x6d, 0x64, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x18, 0x0b, 0x20, 0x01,
0x28, 0x09, 0x52, 0x09, 0x63, 0x6d, 0x64, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x12, 0x1c, 0x0a,
0x09, 0x64, 0x65, 0x72, 0x69, 0x76, 0x65, 0x64, 0x45, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09,
0x52, 0x09, 0x64, 0x65, 0x72, 0x69, 0x76, 0x65, 0x64, 0x45, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63,
0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c,
0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x49, 0x64,
0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x49, 0x64, 0x12,
0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0f, 0x20,
0x01, 0x28, 0x0d, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12,
0x1a, 0x0a, 0x08, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x43, 0x70, 0x75, 0x18, 0x10, 0x20, 0x01, 0x28,
0x0d, 0x52, 0x08, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x43, 0x70, 0x75, 0x12, 0x18, 0x0a, 0x07, 0x76,
0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65,
0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
0x18, 0x12, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12,
0x1a, 0x0a, 0x08, 0x65, 0x78, 0x69, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x13, 0x20, 0x01, 0x28,
0x0d, 0x52, 0x08, 0x65, 0x78, 0x69, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61,
0x73, 0x73, 0x6f, 0x63, 0x49, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x61, 0x73,
0x73, 0x6f, 0x63, 0x49, 0x64, 0x22, 0x34, 0x0a, 0x0c, 0x53, 0x79, 0x6e, 0x63, 0x49, 0x6e, 0x66,
0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x22, 0x43, 0x0a, 0x0b, 0x49,
0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x69,
0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x12, 0x20,
0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65,
0x22, 0xad, 0x01, 0x0a, 0x0c, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73,
0x70, 0x12, 0x32, 0x0a, 0x0b, 0x48, 0x70, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74,
0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65,
0x2e, 0x48, 0x70, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x48, 0x70, 0x63, 0x49, 0x6e, 0x66,
0x6f, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x0d, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x49, 0x6e,
0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70,
0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x49, 0x6e, 0x66, 0x6f,
0x52, 0x0d, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x12,
0x2f, 0x0a, 0x0a, 0x41, 0x69, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x41, 0x69,
0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x41, 0x69, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74,
0x32, 0x7b, 0x0a, 0x07, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x12, 0x37, 0x0a, 0x08, 0x53,
0x79, 0x6e, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72,
0x65, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e,
0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x49, 0x6e, 0x66, 0x6f,
0x52, 0x65, 0x73, 0x70, 0x12, 0x37, 0x0a, 0x08, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74,
0x12, 0x14, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x4c,
0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65,
0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x42, 0x0a, 0x5a,
0x08, 0x2f, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
}
var (

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc v3.19.4
// - protoc v4.22.2
// source: pcmCore.proto
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.
type PcmCoreClient interface {
//SyncInfo Synchronous data information
// SyncInfo Synchronous data information
SyncInfo(ctx context.Context, in *SyncInfoReq, opts ...grpc.CallOption) (*SyncInfoResp, error)
//InfoList
// InfoList
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
// for forward compatibility
type PcmCoreServer interface {
//SyncInfo Synchronous data information
// SyncInfo Synchronous data information
SyncInfo(context.Context, *SyncInfoReq) (*SyncInfoResp, error)
//InfoList
// InfoList
InfoList(context.Context, *InfoListReq) (*InfoListResp, error)
mustEmbedUnimplementedPcmCoreServer()
}

View File

@ -4,7 +4,7 @@ NacosConfig:
ServerConfigs:
# - IpAddr: 127.0.0.1
# Port: 8848
- IpAddr: 10.101.15.7
- IpAddr: nacos.jcce.dev
Port: 8848
ClientConfig:
NamespaceId: test

View File

@ -32,7 +32,7 @@ func NewListHistoryJobLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Li
func (l *ListHistoryJobLogic) ListHistoryJob(in *hpcAC.ListHistoryJobReq) (*hpcAC.ListHistoryJobResp, error) {
var resp hpcAC.ListHistoryJobResp
//historyJobUrl := "hpc/openapi/v2/historyjobs?"
historyJobUrl := "hpc/openapi/v2/historyjobs?"
getTokenLogic := NewGetACTokenLogic(l.ctx, l.svcCtx)
tokenResp, _ := getTokenLogic.GetACToken(&hpcAC.ACTokenReq{})
@ -45,22 +45,20 @@ func (l *ListHistoryJobLogic) ListHistoryJob(in *hpcAC.ListHistoryJobReq) (*hpcA
c := http.Client{Timeout: time.Duration(3) * time.Second}
params := url.Values{}
params.Add("strClusterIDList", strconv.FormatInt(clusterId, 10))
params.Add("strClusterNameList", strconv.FormatInt(clusterId, 10))
params.Add("startTime", in.StartTime)
params.Add("endTime", in.EndTime)
params.Add("timeType", in.TimeType)
params.Add("start", string(in.Start))
params.Add("limit", string(in.Limit))
params.Add("start", strconv.FormatInt(int64(in.Start), 10))
params.Add("limit", strconv.FormatInt(int64(in.Limit), 10))
params.Add("isQueryByQueueTime", in.IsQueryByQueueTime)
//reqUrl, err := http.NewRequest("GET", "https://api01.hpccube.com:65106/"+historyJobUrl+params.Encode(), nil)
reqUrl, err := http.NewRequest("GET", "https://api01.hpccube.com:65106/hpc/openapi/v2/historyjobs?strClusterNameList=1638523853&startTime=2022-12-05+01%3A01%3A01&endTime=2023-12-08+01%3A01%3A01&timeType=CUSTOM&start=0&limit=25&isQueryByQueueTime=true", nil)
reqUrl, err := http.NewRequest("GET", "https://api01.hpccube.com:65106/"+historyJobUrl+params.Encode(), nil)
if err != nil {
log.Fatal(err)
}
reqUrl.Header.Add("token", token)
respUrl, err := c.Do(reqUrl)
if err != nil {

View File

@ -2,7 +2,7 @@ NacosConfig:
DataId: pcm-th-rpc.yaml
Group: DEFAULT_GROUP
ServerConfigs:
- IpAddr: 119.45.100.73
- IpAddr: nacos.jcce.dev
Port: 8848
ClientConfig:
NamespaceId: test

View File

@ -40,7 +40,6 @@ func (l *DailyPowerScreenLogic) DailyPowerScreen(in *ceph.DailyPowerScreenReq) (
if err != nil {
fmt.Println(err)
}
fmt.Println(body)
resp.Code = 200
resp.Msg = "Success"
} else if statusCode != 200 {

View File

@ -40,7 +40,6 @@ func (l *PerCenterComputerPowerScreenLogic) PerCenterComputerPowerScreen(in *cep
if err != nil {
fmt.Println(err)
}
fmt.Println(body)
resp.Code = 200
resp.Msg = "Success"
} else if statusCode != 200 {

View File

@ -79,8 +79,6 @@ func (l *StorageScreenLogic) StorageScreen(in *ceph.StorageScreenReq) (*ceph.Sto
usingStorageScale += item.StorageScale
}
}
fmt.Println(usedStorageScale)
fmt.Println(usingStorageScale)
var floatUsedStorageScale float32 = float32(usedStorageScale)
var floatUsingStorageScale float32 = float32(usingStorageScale)

11
common/tool/decimal.go Normal file
View File

@ -0,0 +1,11 @@
package tool
import (
"fmt"
"strconv"
)
func FloatConv(num float64) float64 {
num, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", num), 64)
return num
}

30
common/tool/file.go Normal file
View File

@ -0,0 +1,30 @@
package tool
import (
"os"
"path/filepath"
)
// DirSize 获取整体文件夹大小
func GetDirSize(path string) (int64, error) {
var size int64
err := filepath.Walk(path, func(_ string, info os.FileInfo, err error) error {
if !info.IsDir() {
size += info.Size()
}
return err
})
return size, err
}
// PathExists 判断文件夹是否存在
func PathExists(path string) (bool, error) {
_, err := os.Stat(path)
if err == nil {
return true, nil
}
if os.IsNotExist(err) {
return false, nil
}
return false, err
}

View File

@ -75,6 +75,22 @@ func HttpClient(method string, url string, payload io.Reader, token string) ([]b
return body, err
}
func HttpGet(method string, url string) ([]byte, error) {
request, err := http.NewRequest(method, url, nil)
client := &http.Client{}
res, err := client.Do(request)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
log.Fatal(err)
}
return body, err
}
// 发送POST请求
// url:请求地址data:POST请求提交的数据,contentType:请求体格式application/json
// content:请求放回的内容

View File

@ -19,7 +19,7 @@ spec:
hostAliases:
- hostnames:
- nacos.jcce.dev
ip: 10.101.15.7
ip: nacos_host
imagePullSecrets:
- name: SECRET_NAME
containers:

View File

@ -19,7 +19,7 @@ spec:
hostAliases:
- hostnames:
- nacos.jcce.dev
ip: 10.101.15.7
ip: nacos_host
imagePullSecrets:
- name: SECRET_NAME
containers:

View File

@ -19,7 +19,7 @@ spec:
hostAliases:
- hostnames:
- nacos.jcce.dev
ip: 10.101.15.7
ip: nacos_host
imagePullSecrets:
- name: SECRET_NAME
containers:

View File

@ -19,7 +19,7 @@ spec:
hostAliases:
- hostnames:
- nacos.jcce.dev
ip: 10.101.15.7
ip: nacos_host
imagePullSecrets:
- name: SECRET_NAME
containers:

View File

@ -19,7 +19,7 @@ spec:
hostAliases:
- hostnames:
- nacos.jcce.dev
ip: 10.101.15.7
ip: nacos_host
imagePullSecrets:
- name: SECRET_NAME
containers:

View File

@ -19,7 +19,7 @@ spec:
hostAliases:
- hostnames:
- nacos.jcce.dev
ip: 10.101.15.7
ip: nacos_host
imagePullSecrets:
- name: SECRET_NAME
containers:

4
go.mod
View File

@ -7,7 +7,7 @@ require (
github.com/JCCE-nudt/zero-contrib/zrpc/registry/nacos v0.0.0-20230419021610-13bbc83fbc3c
github.com/Masterminds/squirrel v1.5.4
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1704
github.com/aws/aws-sdk-go-v2 v1.18.0
github.com/aws/aws-sdk-go v1.44.294
github.com/aws/aws-sdk-go-v2/config v1.18.25
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.67
github.com/aws/aws-sdk-go-v2/service/s3 v1.33.1
@ -21,6 +21,7 @@ require (
github.com/nacos-group/nacos-sdk-go/v2 v2.2.1
github.com/pkg/errors v0.9.1
github.com/robfig/cron/v3 v3.0.1
github.com/shopspring/decimal v1.3.1
github.com/sirupsen/logrus v1.9.0
github.com/zeromicro/go-queue v1.1.8
github.com/zeromicro/go-zero v1.5.1
@ -37,6 +38,7 @@ require (
require (
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/aws/aws-sdk-go-v2 v1.18.0 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.13.24 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.3 // indirect

3
go.sum
View File

@ -433,6 +433,8 @@ github.com/aliyun/alibaba-cloud-sdk-go v1.61.1704/go.mod h1:RcDobYh8k5VP6TNybz9m
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
github.com/aws/aws-sdk-go v1.44.294 h1:3x7GaEth+pDU9HwFcAU0awZlEix5CEdyIZvV08SlHa8=
github.com/aws/aws-sdk-go v1.44.294/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/aws-sdk-go-v2 v1.18.0 h1:882kkTpSFhdgYRKVZ/VCgf7sd0ru57p2JCxz4/oN5RY=
github.com/aws/aws-sdk-go-v2 v1.18.0/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 h1:dK82zF6kkPeCo8J1e+tGx4JdvDIQzj7ygIoLg8WMuGs=
@ -991,6 +993,7 @@ github.com/segmentio/kafka-go v0.4.38/go.mod h1:ikyuGon/60MN/vXFgykf7Zm8P5Be49gJ
github.com/shirou/gopsutil v2.19.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc=
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=