Browse Source

查询core端任务列表

pull/9/head
zw 2 years ago
parent
commit
4c588d923d
17 changed files with 1448 additions and 233 deletions
  1. +232
    -232
      adaptor/PCM-CORE/api/desc/core/pcm-core.api
  2. +3
    -0
      adaptor/PCM-CORE/api/desc/pcm.api
  3. +2
    -1
      adaptor/PCM-CORE/api/internal/logic/core/scheduletasklogic.go
  4. +4
    -0
      adaptor/PCM-CORE/api/internal/mqs/kq/ScheduleCloud.go
  5. +27
    -0
      adaptor/PCM-CORE/model/hpcmodel.go
  6. +118
    -0
      adaptor/PCM-CORE/model/hpcmodel_gen.go
  7. +6
    -0
      adaptor/PCM-CORE/rpc/etc/pcmcore.yaml
  8. +10
    -0
      adaptor/PCM-CORE/rpc/internal/config/config.go
  9. +44
    -0
      adaptor/PCM-CORE/rpc/internal/logic/infolistlogic.go
  10. +31
    -0
      adaptor/PCM-CORE/rpc/internal/logic/syncinfologic.go
  11. +35
    -0
      adaptor/PCM-CORE/rpc/internal/server/pcmcoreserver.go
  12. +19
    -0
      adaptor/PCM-CORE/rpc/internal/svc/servicecontext.go
  13. +53
    -0
      adaptor/PCM-CORE/rpc/pb/pcmCore.proto
  14. +623
    -0
      adaptor/PCM-CORE/rpc/pcmCore/pcmCore.pb.go
  15. +150
    -0
      adaptor/PCM-CORE/rpc/pcmCore/pcmCore_grpc.pb.go
  16. +39
    -0
      adaptor/PCM-CORE/rpc/pcmcore.go
  17. +52
    -0
      adaptor/PCM-CORE/rpc/pcmcoreclient/pcmcore.go

+ 232
- 232
adaptor/PCM-CORE/api/desc/core/pcm-core.api View File

@@ -1,261 +1,261 @@
syntax = "v1"

info(
title: "gateway"
desc: "gateway端微服务"
author: "zhouqj"
email: "450705171@qq.com"
title: "gateway"
desc: "gateway端微服务"
author: "zhouqj"
email: "450705171@qq.com"
)

type (
submitJobReq {
SlurmVersion string `json:"slurmVersion"`
submitJobReq {
SlurmVersion string `json:"slurmVersion"`

/****************parmas from ac********************/
Apptype string `json:"apptype,optional"`
Appname string `json:"appname,optional"`
StrJobManagerID int64 `json:"strJobManagerID,optional"`
MapAppJobInfo MapAppJobInfo `json:"mapAppJobInfo,optional"`
/****************parmas from ac********************/
/****************parmas from ac********************/
Apptype string `json:"apptype,optional"`
Appname string `json:"appname,optional"`
StrJobManagerID int64 `json:"strJobManagerID,optional"`
MapAppJobInfo MapAppJobInfo `json:"mapAppJobInfo,optional"`
/****************parmas from ac********************/

Account string `json:"account,optional"` //
Acctg_freq string `json:"acctg_freq,optional"`
Alloc_node string `json:"alloc_node,optional"`
Alloc_resp_port int32 `json:"alloc_resp_port,optional"`
Alloc_sid int32 `json:"alloc_sid,optional"`
Argc int32 `json:"argc,optional"`
Argv []Argv `json:"Argv,optional"`
Array_inx string `json:"array_inx,optional"`
Begin_time int64 `json:"begin_time,optional"`
Ckpt_interval int32 `json:"ckpt_interval,optional"`
Ckpt_dir string `json:"ckpt_dir,optional"`
Comment string `json:"comment,optional"`
Contiguous int32 `json:"contiguous,optional"`
Cpu_bind string `json:"cpu_bind,optional"`
Cpu_bind_type int32 `json:"cpu_bind_type,optional"`
Dependency string `json:"dependency,optional"`
End_time int64 `json:"end_time,optional"`
Environment []Environment `json:"Environment,optional"`
Env_size int32 `json:"env_size,optional"`
Exc_nodes string `json:"exc_nodes,optional"`
Features string `json:"features,optional"`
Gres string `json:"gres,optional"`
Group_id int32 `json:"group_id,optional"`
Immediate int32 `json:"immediate,optional"`
Job_id int32 `json:"job_id,optional"`
Kill_on_node_fail int32 `json:"kill_on_node_fail,optional"`
Licenses string `json:"licenses,optional"`
Mail_type int32 `json:"mail_type,optional"`
Mail_user string `json:"mail_user,optional"`
Mem_bind string `json:"mem_bind,optional"`
Mem_bind_type int32 `json:"mem_bind_type,optional"`
Name string `json:"name,optional"` //
Network string `json:"network,optional"`
Nice int32 `json:"nice,optional"`
Num_tasks int32 `json:"num_tasks,optional"`
Open_mode int32 `json:"open_mode,optional"`
Other_port int32 `json:"other_port,optional"`
Overcommit int32 `json:"overcommit,optional"`
Partition string `json:"partition,optional"`
Plane_size int32 `json:"plane_size,optional"`
Priority int32 `json:"priority,optional"`
Profile int32 `json:"profile,optional"`
Qos string `json:"qos,optional"`
Resp_host string `json:"resp_host,optional"`
Req_nodes string `json:"req_nodes,optional"`
Requeue int32 `json:"requeue,optional"`
Reservation string `json:"reservation,optional"`
Script string `json:"script,optional"` //
Shared int32 `json:"shared,optional"`
Spank_job_env_size int32 `json:"spank_job_env_size,optional"`
Task_dist int32 `json:"task_dist,optional"`
Time_limit int32 `json:"time_limit,optional"`
Time_min int32 `json:"time_min,optional"`
User_id int32 `json:"user_id,optional"` //
Wait_all_nodes int32 `json:"wait_all_nodes,optional"`
Warn_signal int32 `json:"warn_signal,optional"`
Warn_time int32 `json:"warn_time,optional"`
Work_dir string `json:"work_dir,optional"`
Cpus_per_task int32 `json:"cpus_per_task,optional"`
Min_cpus int32 `json:"min_cpus,optional"` //
Max_cpus int32 `json:"max_cpus,optional"`
Min_nodes int32 `json:"min_nodes,optional"`
Max_nodes int32 `json:"max_nodes,optional"`
Boards_per_node int32 `json:"boards_per_node,optional"`
Sockets_per_board int32 `json:"sockets_per_board,optional"`
Sockets_per_node int32 `json:"sockets_per_node,optional"`
Cores_per_socket int32 `json:"cores_per_socket,optional"`
Threads_per_core int32 `json:"threads_per_core,optional"`
Ntasks_per_node int32 `json:"ntasks_per_node,optional"`
Ntasks_per_socket int32 `json:"ntasks_per_socket,optional"`
Ntasks_per_core int32 `json:"ntasks_per_core,optional"`
Ntasks_per_board int32 `json:"ntasks_per_board,optional"`
Pn_min_cpus int32 `json:"pn_min_cpus,optional"`
Pn_min_memory int32 `json:"pn_min_memory,optional"`
Pn_min_tmp_disk int32 `json:"pn_min_tmp_disk,optional"`
Reboot int32 `json:"reboot,optional"`
Rotate int32 `json:"rotate,optional"`
Req_switch int32 `json:"req_switch,optional"`
Std_err string `json:"std_err,optional"`
Std_in string `json:"std_in,optional"`
Std_out string `json:"std_out,optional"`
Wait4switch int32 `json:"wait4switch,optional"`
Wckey string `json:"wckey,optional"`
}
Account string `json:"account,optional"` //
Acctg_freq string `json:"acctg_freq,optional"`
Alloc_node string `json:"alloc_node,optional"`
Alloc_resp_port int32 `json:"alloc_resp_port,optional"`
Alloc_sid int32 `json:"alloc_sid,optional"`
Argc int32 `json:"argc,optional"`
Argv []Argv `json:"Argv,optional"`
Array_inx string `json:"array_inx,optional"`
Begin_time int64 `json:"begin_time,optional"`
Ckpt_interval int32 `json:"ckpt_interval,optional"`
Ckpt_dir string `json:"ckpt_dir,optional"`
Comment string `json:"comment,optional"`
Contiguous int32 `json:"contiguous,optional"`
Cpu_bind string `json:"cpu_bind,optional"`
Cpu_bind_type int32 `json:"cpu_bind_type,optional"`
Dependency string `json:"dependency,optional"`
End_time int64 `json:"end_time,optional"`
Environment []Environment `json:"Environment,optional"`
Env_size int32 `json:"env_size,optional"`
Exc_nodes string `json:"exc_nodes,optional"`
Features string `json:"features,optional"`
Gres string `json:"gres,optional"`
Group_id int32 `json:"group_id,optional"`
Immediate int32 `json:"immediate,optional"`
Job_id int32 `json:"job_id,optional"`
Kill_on_node_fail int32 `json:"kill_on_node_fail,optional"`
Licenses string `json:"licenses,optional"`
Mail_type int32 `json:"mail_type,optional"`
Mail_user string `json:"mail_user,optional"`
Mem_bind string `json:"mem_bind,optional"`
Mem_bind_type int32 `json:"mem_bind_type,optional"`
Name string `json:"name,optional"` //
Network string `json:"network,optional"`
Nice int32 `json:"nice,optional"`
Num_tasks int32 `json:"num_tasks,optional"`
Open_mode int32 `json:"open_mode,optional"`
Other_port int32 `json:"other_port,optional"`
Overcommit int32 `json:"overcommit,optional"`
Partition string `json:"partition,optional"`
Plane_size int32 `json:"plane_size,optional"`
Priority int32 `json:"priority,optional"`
Profile int32 `json:"profile,optional"`
Qos string `json:"qos,optional"`
Resp_host string `json:"resp_host,optional"`
Req_nodes string `json:"req_nodes,optional"`
Requeue int32 `json:"requeue,optional"`
Reservation string `json:"reservation,optional"`
Script string `json:"script,optional"` //
Shared int32 `json:"shared,optional"`
Spank_job_env_size int32 `json:"spank_job_env_size,optional"`
Task_dist int32 `json:"task_dist,optional"`
Time_limit int32 `json:"time_limit,optional"`
Time_min int32 `json:"time_min,optional"`
User_id int32 `json:"user_id,optional"` //
Wait_all_nodes int32 `json:"wait_all_nodes,optional"`
Warn_signal int32 `json:"warn_signal,optional"`
Warn_time int32 `json:"warn_time,optional"`
Work_dir string `json:"work_dir,optional"`
Cpus_per_task int32 `json:"cpus_per_task,optional"`
Min_cpus int32 `json:"min_cpus,optional"` //
Max_cpus int32 `json:"max_cpus,optional"`
Min_nodes int32 `json:"min_nodes,optional"`
Max_nodes int32 `json:"max_nodes,optional"`
Boards_per_node int32 `json:"boards_per_node,optional"`
Sockets_per_board int32 `json:"sockets_per_board,optional"`
Sockets_per_node int32 `json:"sockets_per_node,optional"`
Cores_per_socket int32 `json:"cores_per_socket,optional"`
Threads_per_core int32 `json:"threads_per_core,optional"`
Ntasks_per_node int32 `json:"ntasks_per_node,optional"`
Ntasks_per_socket int32 `json:"ntasks_per_socket,optional"`
Ntasks_per_core int32 `json:"ntasks_per_core,optional"`
Ntasks_per_board int32 `json:"ntasks_per_board,optional"`
Pn_min_cpus int32 `json:"pn_min_cpus,optional"`
Pn_min_memory int32 `json:"pn_min_memory,optional"`
Pn_min_tmp_disk int32 `json:"pn_min_tmp_disk,optional"`
Reboot int32 `json:"reboot,optional"`
Rotate int32 `json:"rotate,optional"`
Req_switch int32 `json:"req_switch,optional"`
Std_err string `json:"std_err,optional"`
Std_in string `json:"std_in,optional"`
Std_out string `json:"std_out,optional"`
Wait4switch int32 `json:"wait4switch,optional"`
Wckey string `json:"wckey,optional"`
}

submitJobResp {
//Job_id int32 `json:"job_id"`
//Step_id int32 `json:"step_id"`
//Error_code int32 `json:"error_code"`
submitJobResp {
//Job_id int32 `json:"job_id"`
//Step_id int32 `json:"step_id"`
//Error_code int32 `json:"error_code"`

Code string `json:"code"` //Error_code 返回码 in Tianhe
Msg string `json:"msg"`
Data string `json:"data"` //Job_id 作业id in Tianhe
}
Code string `json:"code"` //Error_code 返回码 in Tianhe
Msg string `json:"msg"`
Data string `json:"data"` //Job_id 作业id in Tianhe
}

MapAppJobInfo {
GAP_CMD_FILE string `json:"GAP_CMD_FILE"` //命令行内容
GAP_NNODE string `json:"GAP_NNODE"` //节点个数(当指定该参数时,GAP_NODE_STRING必须为"")
GAP_NODE_STRING string `json:"GAP_NODE_STRING,optional"` //指定节点(当指定该参数时,GAP_NNODE必须为"")
GAP_SUBMIT_TYPE string `json:"GAP_SUBMIT_TYPE"` //cmd(命令行模式)
GAP_JOB_NAME string `json:"GAP_JOB_NAME"` //作业名称
GAP_WORK_DIR string `json:"GAP_WORK_DIR"` //工作路径
GAP_QUEUE string `json:"GAP_QUEUE"` //队列名称
GAP_NPROC string `json:"GAP_NPROC,optional"` //总核心数(GAP_NPROC和GAP_PPN选其一填写)
GAP_PPN string `json:"GAP_PPN,optional"` //CPU核心/节点(GAP_NPROC和GAP_PPN选其一填写)
GAP_NGPU string `json:"GAP_NGPU,optional"` //GPU卡数/节点
GAP_NDCU string `json:"GAP_NDCU,optional"` //DCU卡数/节点
GAP_JOB_MEM string `json:"GAP_JOB_MEM,optional"` //每个节点内存值,单位为MB/GB
GAP_WALL_TIME string `json:"GAP_WALL_TIME"` //最大运行时长(HH:MM:ss)
GAP_EXCLUSIVE string `json:"GAP_EXCLUSIVE,optional"` // 是否独占节点,1为独占,空为非独占
GAP_APPNAME string `json:"GAP_APPNAME"` //BASE(基础应用),支持填写具体的应用英文名称
GAP_MULTI_SUB string `json:"GAP_MULTI_SUB,optional"` //作业组长度,建议为小于等于50的正整数
GAP_STD_OUT_FILE string `json:"GAP_STD_OUT_FILE"` //工作路径/std.out.%j
GAP_STD_ERR_FILE string `json:"GAP_STD_ERR_FILE"` //工作路径/std.err.%j
}
MapAppJobInfo {
GAP_CMD_FILE string `json:"GAP_CMD_FILE"` //命令行内容
GAP_NNODE string `json:"GAP_NNODE"` //节点个数(当指定该参数时,GAP_NODE_STRING必须为"")
GAP_NODE_STRING string `json:"GAP_NODE_STRING,optional"` //指定节点(当指定该参数时,GAP_NNODE必须为"")
GAP_SUBMIT_TYPE string `json:"GAP_SUBMIT_TYPE"` //cmd(命令行模式)
GAP_JOB_NAME string `json:"GAP_JOB_NAME"` //作业名称
GAP_WORK_DIR string `json:"GAP_WORK_DIR"` //工作路径
GAP_QUEUE string `json:"GAP_QUEUE"` //队列名称
GAP_NPROC string `json:"GAP_NPROC,optional"` //总核心数(GAP_NPROC和GAP_PPN选其一填写)
GAP_PPN string `json:"GAP_PPN,optional"` //CPU核心/节点(GAP_NPROC和GAP_PPN选其一填写)
GAP_NGPU string `json:"GAP_NGPU,optional"` //GPU卡数/节点
GAP_NDCU string `json:"GAP_NDCU,optional"` //DCU卡数/节点
GAP_JOB_MEM string `json:"GAP_JOB_MEM,optional"` //每个节点内存值,单位为MB/GB
GAP_WALL_TIME string `json:"GAP_WALL_TIME"` //最大运行时长(HH:MM:ss)
GAP_EXCLUSIVE string `json:"GAP_EXCLUSIVE,optional"` // 是否独占节点,1为独占,空为非独占
GAP_APPNAME string `json:"GAP_APPNAME"` //BASE(基础应用),支持填写具体的应用英文名称
GAP_MULTI_SUB string `json:"GAP_MULTI_SUB,optional"` //作业组长度,建议为小于等于50的正整数
GAP_STD_OUT_FILE string `json:"GAP_STD_OUT_FILE"` //工作路径/std.out.%j
GAP_STD_ERR_FILE string `json:"GAP_STD_ERR_FILE"` //工作路径/std.err.%j
}

Argv {
Argv string `json:"argv,optional"`
}
Argv {
Argv string `json:"argv,optional"`
}

Environment {
Environment string `json:"environment,optional"`
}
Environment {
Environment string `json:"environment,optional"`
}
)

type (
getRegionResp {
Code string `json:"code"`
Msg string `json:"msg"`
Data RegionNum `json:"data"`
}
RegionNum {
RegionSum int64 `json:"regionSum"`
SoftStackSum int64 `json:"softStackSum"`
}
getRegionResp {
Code string `json:"code"`
Msg string `json:"msg"`
Data RegionNum `json:"data"`
}
RegionNum {
RegionSum int64 `json:"regionSum"`
SoftStackSum int64 `json:"softStackSum"`
}
)

type (
listRegionResp {
Code string `json:"code"`
Msg string `json:"msg"`
Data []Region `json:"data"`
}
Region {
RegionName string `json:"RegionName"` // 域名
SoftStack string `json:"SoftStack"` // 软件栈
SlurmNum int64 `json:"SlurmNum"` // 超算域适配slurm数量
AdaptorInterfaceSum int64 `json:"AdaptorInterfaceSum"` // 适配接口数量
RunningJobs int64 `json:"runningJobs"`
}
listRegionResp {
Code string `json:"code"`
Msg string `json:"msg"`
Data []Region `json:"data"`
}
Region {
RegionName string `json:"RegionName"` // 域名
SoftStack string `json:"SoftStack"` // 软件栈
SlurmNum int64 `json:"SlurmNum"` // 超算域适配slurm数量
AdaptorInterfaceSum int64 `json:"AdaptorInterfaceSum"` // 适配接口数量
RunningJobs int64 `json:"runningJobs"`
}
)

type (
scheduleTaskReq {
TaskId int64 `yaml:"taskId"`
Operate string `yaml:"operate"`
Kind string `yaml:"kind"`
Name string `yaml:"name"`
Description string `yaml:"description"`
ServiceName string `yaml:"serviceName"`
Metadata interface{} `yaml:"metadata"`
}
scheduleTaskResp {
Code int32 `json:"code"`
Msg string `json:"msg"`
}
scheduleTaskReq {
TaskId int64 `yaml:"taskId"`
Operate string `yaml:"operate"`
Kind string `yaml:"kind"`
Name string `yaml:"name"`
Description string `yaml:"description"`
ServiceName string `yaml:"serviceName"`
Metadata interface{} `yaml:"metadata"`
}
scheduleTaskResp {
Code int32 `json:"code"`
Msg string `json:"msg"`
}
)

type (
taskListResp {
Code int32 `json:"code"`
Msg string `json:"msg"`
Data Data `json:"data"`
}
Data {
TotalCount int `json:"totalCount"`
CardTime int `json:"cardTime"`
TotalRunTime int `json:"totalRunTime"`
Tasks []Task `json:"tasks"`
}
Task {
Name string `json:"name"`
Status string `json:"status"`
Strategy int `json:"strategy"`
ServiceName string `json:"serviceName"`
SynergyStatus string `json:"synergyStatus"`
}
taskListResp {
Code int32 `json:"code"`
Msg string `json:"msg"`
Data Data `json:"data"`
}
Data {
TotalCount int `json:"totalCount"`
CardTime int `json:"cardTime"`
TotalRunTime int `json:"totalRunTime"`
Tasks []Task `json:"tasks"`
}
Task {
Name string `json:"name"`
Status string `json:"status"`
Strategy int `json:"strategy"`
ServiceName string `json:"serviceName"`
SynergyStatus string `json:"synergyStatus"`
}
)

type (
listCenterResp {
Code int32 `json:"code"`
Msg string `json:"msg"`
Data CenterData `json:"data"`
}
CenterData {
TotalCount int `json:"totalCount"`
Centers []Center `json:"centers"`
}
Center {
Id int64 `json:"id"`
CenterSource string `json:"centerSource"`
SourceId string `json:"sourceId"`
Name string `json:"name"`
Description string `json:"description"`
Type string `json:"type"`
Area string `json:"area"`
City string `json:"city"`
Longitude float64 `json:"longitude"`
Latitude float64 `json:"latitude"`
Status string `json:"status"`
UserNum int64 `json:"userNum"`
DeletedFlag int64 `json:"deletedFlag"`
CloudClusterNum int64 `json:"cloudClusterNum"`
CloudNodeNum int64 `json:"cloudNodeNum"`
CloudCpuNum int64 `json:"cloudCpuNum"`
CloudGpuNum int64 `json:"cloudGpuNum"`
CloudMngFlops int64 `json:"cloudMngFlops"`
CloudUmngFlops int64 `json:"cloudUmngFlops"`
CloudMngStorage int64 `json:"cloudMngStorage"`
CloudUmngStorage int64 `json:"cloudUmngStorage"`
AiClusterNum int64 `json:"aiClusterNum"`
AiNodeNum int64 `json:"aiNodeNum"`
AiCpuNum int64 `json:"aiCpuNum"`
AiGpuNum int64 `json:"aiGpuNum"`
AiMngFlops int64 `json:"aiMngFlops"`
AiUmngFlops int64 `json:"aiUmngFlops"`
AiMngStorage int64 `json:"aiMngStorage"`
AiUmngStorage int64 `json:"aiUmngStorage"`
HpcClusterNum int64 `json:"hpcClusterNum"`
HpcNodeNum int64 `json:"hpcNodeNum"`
HpcCpuNum int64 `json:"hpcCpuNum"`
HpcGpuNum int64 `json:"hpcGpuNum"`
HpcMngFlops int64 `json:"hpcMngFlops"`
HpcUmngFlops int64 `json:"hpcUmngFlops"`
HpcMngStorage int64 `json:"hpcMngStorage"`
HpcUmngStorage int64 `json:"hpcUmngStorage"`
Edwc bool `json:"edwc"`
Ydyl bool `json:"ydyl"`
}
listCenterResp {
Code int32 `json:"code"`
Msg string `json:"msg"`
Data CenterData `json:"data"`
}
CenterData {
TotalCount int `json:"totalCount"`
Centers []Center `json:"centers"`
}
Center {
Id int64 `json:"id"`
CenterSource string `json:"centerSource"`
SourceId string `json:"sourceId"`
Name string `json:"name"`
Description string `json:"description"`
Type string `json:"type"`
Area string `json:"area"`
City string `json:"city"`
Longitude float64 `json:"longitude"`
Latitude float64 `json:"latitude"`
Status string `json:"status"`
UserNum int64 `json:"userNum"`
DeletedFlag int64 `json:"deletedFlag"`
CloudClusterNum int64 `json:"cloudClusterNum"`
CloudNodeNum int64 `json:"cloudNodeNum"`
CloudCpuNum int64 `json:"cloudCpuNum"`
CloudGpuNum int64 `json:"cloudGpuNum"`
CloudMngFlops int64 `json:"cloudMngFlops"`
CloudUmngFlops int64 `json:"cloudUmngFlops"`
CloudMngStorage int64 `json:"cloudMngStorage"`
CloudUmngStorage int64 `json:"cloudUmngStorage"`
AiClusterNum int64 `json:"aiClusterNum"`
AiNodeNum int64 `json:"aiNodeNum"`
AiCpuNum int64 `json:"aiCpuNum"`
AiGpuNum int64 `json:"aiGpuNum"`
AiMngFlops int64 `json:"aiMngFlops"`
AiUmngFlops int64 `json:"aiUmngFlops"`
AiMngStorage int64 `json:"aiMngStorage"`
AiUmngStorage int64 `json:"aiUmngStorage"`
HpcClusterNum int64 `json:"hpcClusterNum"`
HpcNodeNum int64 `json:"hpcNodeNum"`
HpcCpuNum int64 `json:"hpcCpuNum"`
HpcGpuNum int64 `json:"hpcGpuNum"`
HpcMngFlops int64 `json:"hpcMngFlops"`
HpcUmngFlops int64 `json:"hpcUmngFlops"`
HpcMngStorage int64 `json:"hpcMngStorage"`
HpcUmngStorage int64 `json:"hpcUmngStorage"`
Edwc bool `json:"edwc"`
Ydyl bool `json:"ydyl"`
}
)

+ 3
- 0
adaptor/PCM-CORE/api/desc/pcm.api View File

@@ -37,6 +37,9 @@ service pcm {
@handler listRegionHandler
get /core/listRegion () returns (listRegionResp)

@handler syncInfoHandler
get /core/syncInfo (syncInfoReq) returns (syncInfoResp)
}

//hpc二级接口


+ 2
- 1
adaptor/PCM-CORE/api/internal/logic/core/scheduletasklogic.go View File

@@ -88,10 +88,11 @@ func (l *ScheduleTaskLogic) checkSubmitReq(req *types.ScheduleTaskReq) string {
var modelArtsReq modelartsclient.CreateTrainingJobReq
tool.Convert(req.Metadata, &modelArtsReq)
rows, _ = l.svcCtx.Db.Query("select id from ai where project_id = ? and name = ?", modelArtsReq.ProjectId, modelArtsReq.Metadata.Name)

}

if rows.Next() {
return "data already exists."
}

return ""
}

+ 4
- 0
adaptor/PCM-CORE/api/internal/mqs/kq/ScheduleCloud.go View File

@@ -36,11 +36,13 @@ func (l *ScheduleCloudMq) Consume(_, val string) error {
applyReq := kubenativeclient.ApplyReq{
YamlString: string(bytes),
}

applyResp, err := l.svcCtx.KubeNativeRpc.ApplyYaml(l.ctx, &applyReq)
if err != nil {
_, err = l.svcCtx.SqlConn.Exec("update task set status = ?,result = ? where id = ?", "failed", err.Error(), req.TaskId)
return nil
}

l.svcCtx.SqlConn.Exec("update task set status = ? where id = ?", "submitted", req.TaskId)
// 处理返回数据并入库
var clouds []model.Cloud
@@ -54,9 +56,11 @@ func (l *ScheduleCloudMq) Consume(_, val string) error {
Status: "submitted",
})
}

_, err = l.svcCtx.Db.NamedExec("insert into cloud (task_id,kind,namespace,name,api_version,status) values (:task_id,:kind,:namespace,:name,:api_version,:status)", clouds)
if err != nil {
return err
}

return nil
}

+ 27
- 0
adaptor/PCM-CORE/model/hpcmodel.go View File

@@ -0,0 +1,27 @@
package model

import (
"github.com/zeromicro/go-zero/core/stores/cache"
"github.com/zeromicro/go-zero/core/stores/sqlx"
)

var _ HpcModel = (*customHpcModel)(nil)

type (
// HpcModel is an interface to be customized, add more methods here,
// and implement the added methods in customHpcModel.
HpcModel interface {
hpcModel
}

customHpcModel struct {
*defaultHpcModel
}
)

// NewHpcModel returns a model for the database table.
func NewHpcModel(conn sqlx.SqlConn, c cache.CacheConf) HpcModel {
return &customHpcModel{
defaultHpcModel: newHpcModel(conn, c),
}
}

+ 118
- 0
adaptor/PCM-CORE/model/hpcmodel_gen.go View File

@@ -0,0 +1,118 @@
// 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/cache"
"github.com/zeromicro/go-zero/core/stores/sqlc"
"github.com/zeromicro/go-zero/core/stores/sqlx"
"github.com/zeromicro/go-zero/core/stringx"
)

var (
hpcFieldNames = builder.RawFieldNames(&Hpc{})
hpcRows = strings.Join(hpcFieldNames, ",")
hpcRowsExpectAutoSet = strings.Join(stringx.Remove(hpcFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",")
hpcRowsWithPlaceHolder = strings.Join(stringx.Remove(hpcFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?"

cachePcmHpcIdPrefix = "cache:pcm:hpc:id:"
)

type (
hpcModel interface {
Insert(ctx context.Context, data *Hpc) (sql.Result, error)
FindOne(ctx context.Context, id int64) (*Hpc, error)
Update(ctx context.Context, data *Hpc) error
Delete(ctx context.Context, id int64) error
}

defaultHpcModel struct {
sqlc.CachedConn
table string
}

Hpc struct {
Id int64 `db:"id"` // id
TaskId sql.NullInt64 `db:"task_id"` // 任务id
JobId sql.NullString `db:"job_id"` // 作业id
ServiceName sql.NullString `db:"service_name"` // 服务名称
StartTime sql.NullString `db:"start_time"` // 开始时间
RunningTime sql.NullInt64 `db:"running_time"` // 运行时间
CardCount sql.NullInt64 `db:"card_count"` // 卡数
CreatedBy sql.NullInt64 `db:"created_by"` // 创建人
CreatedTime sql.NullTime `db:"created_time"` // 创建时间
UpdatedBy sql.NullInt64 `db:"updated_by"` // 更新人
UpdatedTime sql.NullTime `db:"updated_time"` // 更新时间
DeletedFlag int64 `db:"deleted_flag"` // 是否删除(0-否,1-是)
}
)

func newHpcModel(conn sqlx.SqlConn, c cache.CacheConf) *defaultHpcModel {
return &defaultHpcModel{
CachedConn: sqlc.NewConn(conn, c),
table: "`hpc`",
}
}

func (m *defaultHpcModel) Delete(ctx context.Context, id int64) error {
pcmHpcIdKey := fmt.Sprintf("%s%v", cachePcmHpcIdPrefix, id)
_, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
query := fmt.Sprintf("delete from %s where `id` = ?", m.table)
return conn.ExecCtx(ctx, query, id)
}, pcmHpcIdKey)
return err
}

func (m *defaultHpcModel) FindOne(ctx context.Context, id int64) (*Hpc, error) {
pcmHpcIdKey := fmt.Sprintf("%s%v", cachePcmHpcIdPrefix, id)
var resp Hpc
err := m.QueryRowCtx(ctx, &resp, pcmHpcIdKey, func(ctx context.Context, conn sqlx.SqlConn, v interface{}) error {
query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", hpcRows, m.table)
return conn.QueryRowCtx(ctx, v, query, id)
})
switch err {
case nil:
return &resp, nil
case sqlc.ErrNotFound:
return nil, ErrNotFound
default:
return nil, err
}
}

func (m *defaultHpcModel) Insert(ctx context.Context, data *Hpc) (sql.Result, error) {
pcmHpcIdKey := fmt.Sprintf("%s%v", cachePcmHpcIdPrefix, data.Id)
ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, hpcRowsExpectAutoSet)
return conn.ExecCtx(ctx, query, data.TaskId, data.JobId, data.ServiceName, data.StartTime, data.RunningTime, data.CardCount, data.CreatedBy, data.CreatedTime, data.UpdatedBy, data.UpdatedTime, data.DeletedFlag)
}, pcmHpcIdKey)
return ret, err
}

func (m *defaultHpcModel) Update(ctx context.Context, data *Hpc) error {
pcmHpcIdKey := fmt.Sprintf("%s%v", cachePcmHpcIdPrefix, data.Id)
_, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, hpcRowsWithPlaceHolder)
return conn.ExecCtx(ctx, query, data.TaskId, data.JobId, data.ServiceName, data.StartTime, data.RunningTime, data.CardCount, data.CreatedBy, data.CreatedTime, data.UpdatedBy, data.UpdatedTime, data.DeletedFlag, data.Id)
}, pcmHpcIdKey)
return err
}

func (m *defaultHpcModel) formatPrimary(primary interface{}) string {
return fmt.Sprintf("%s%v", cachePcmHpcIdPrefix, primary)
}

func (m *defaultHpcModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary interface{}) error {
query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", hpcRows, m.table)
return conn.QueryRowCtx(ctx, v, query, primary)
}

func (m *defaultHpcModel) tableName() string {
return m.table
}

+ 6
- 0
adaptor/PCM-CORE/rpc/etc/pcmcore.yaml View File

@@ -0,0 +1,6 @@
Name: pcmcore.rpc
ListenOn: 0.0.0.0:8888
Etcd:
Hosts:
- 10.101.15.170:31890
Key: pcmcore.rpc

+ 10
- 0
adaptor/PCM-CORE/rpc/internal/config/config.go View File

@@ -0,0 +1,10 @@
package config

import "github.com/zeromicro/go-zero/zrpc"

type Config struct {
zrpc.RpcServerConf
DB struct {
DataSource string
}
}

+ 44
- 0
adaptor/PCM-CORE/rpc/internal/logic/infolistlogic.go View File

@@ -0,0 +1,44 @@
package logic

import (
"context"
"fmt"

"PCM/adaptor/PCM-CORE/rpc/internal/svc"
"PCM/adaptor/PCM-CORE/rpc/pcmCore"

"github.com/zeromicro/go-zero/core/logx"
)

type InfoListLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}

func NewInfoListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *InfoListLogic {
return &InfoListLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}

// InfoList
func (l *InfoListLogic) InfoList(in *pcmCore.InfoListReq) (*pcmCore.InfoListResp, error) {
var result *pcmCore.InfoListResp
// 查询任务id集合
taskRows, err := l.svcCtx.Db.Query("select id,kind from task where status not in ('Succeed','Completed')")
if err != nil {
return nil, err
}
for taskRows.Next() {
taskInfo := pcmCore.TaskInfo{}
taskRows.Scan(&taskInfo.TaskId, &taskInfo.Kind)
// 查询云智超中的数据列表
sql := fmt.Sprintf("select id from %s where status not in ('Succeed','Completed')", taskInfo.Kind)
l.svcCtx.Db.Query(sql)
result.TaskInfoList = append(result.TaskInfoList, &taskInfo)
}
return &pcmCore.InfoListResp{}, nil
}

+ 31
- 0
adaptor/PCM-CORE/rpc/internal/logic/syncinfologic.go View File

@@ -0,0 +1,31 @@
package logic

import (
"context"

"PCM/adaptor/PCM-CORE/rpc/internal/svc"
"PCM/adaptor/PCM-CORE/rpc/pcmCore"

"github.com/zeromicro/go-zero/core/logx"
)

type SyncInfoLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}

func NewSyncInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SyncInfoLogic {
return &SyncInfoLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}

// SyncInfo Synchronous data information
func (l *SyncInfoLogic) SyncInfo(in *pcmCore.SyncInfoReq) (*pcmCore.SyncInfoResp, error) {
// todo: add your logic here and delete this line

return &pcmCore.SyncInfoResp{}, nil
}

+ 35
- 0
adaptor/PCM-CORE/rpc/internal/server/pcmcoreserver.go View File

@@ -0,0 +1,35 @@
// Code generated by goctl. DO NOT EDIT.
// Source: pcmCore.proto

package server

import (
"context"

"PCM/adaptor/PCM-CORE/rpc/internal/logic"
"PCM/adaptor/PCM-CORE/rpc/internal/svc"
"PCM/adaptor/PCM-CORE/rpc/pcmCore"
)

type PcmCoreServer struct {
svcCtx *svc.ServiceContext
pcmCore.UnimplementedPcmCoreServer
}

func NewPcmCoreServer(svcCtx *svc.ServiceContext) *PcmCoreServer {
return &PcmCoreServer{
svcCtx: svcCtx,
}
}

// SyncInfo Synchronous data information
func (s *PcmCoreServer) SyncInfo(ctx context.Context, in *pcmCore.SyncInfoReq) (*pcmCore.SyncInfoResp, error) {
l := logic.NewSyncInfoLogic(ctx, s.svcCtx)
return l.SyncInfo(in)
}

// InfoList
func (s *PcmCoreServer) InfoList(ctx context.Context, in *pcmCore.InfoListReq) (*pcmCore.InfoListResp, error) {
l := logic.NewInfoListLogic(ctx, s.svcCtx)
return l.InfoList(in)
}

+ 19
- 0
adaptor/PCM-CORE/rpc/internal/svc/servicecontext.go View File

@@ -0,0 +1,19 @@
package svc

import (
"PCM/adaptor/PCM-CORE/rpc/internal/config"
sql "github.com/jmoiron/sqlx"
)

type ServiceContext struct {
Config config.Config
Db *sql.DB
}

func NewServiceContext(c config.Config) *ServiceContext {
db, _ := sql.Open("mysql", c.DB.DataSource)
return &ServiceContext{
Config: c,
Db: db,
}
}

+ 53
- 0
adaptor/PCM-CORE/rpc/pb/pcmCore.proto View File

@@ -0,0 +1,53 @@
syntax = "proto3";

package pcmCore;
option go_package = "/pcmCore";

message SyncInfoReq {
repeated Info infoList = 3;
}

message Info {
string TaskId = 1;
string Status = 2;
string StartTime = 3;
int64 RunningTime = 4;
}

message SyncInfoResp{
int64 Code = 1;
string Msg = 2;
}

message InfoListReq{
string Kind = 1;
string ServiceName = 2;
}

message InfoListResp{
repeated TaskInfo taskInfoList = 1;

}
message TaskInfo{
int64 taskId = 1;
string kind = 2;
repeated ExternalInfo ExternalInfoList = 3;
}

message ExternalInfo {
string externalField = 1;
string name = 2;
string status = 3;
}


// pcm core services
service pcmCore {

//SyncInfo Synchronous data information
rpc SyncInfo(SyncInfoReq) returns (SyncInfoResp);

//InfoList
rpc InfoList(InfoListReq) returns (InfoListResp);

}

+ 623
- 0
adaptor/PCM-CORE/rpc/pcmCore/pcmCore.pb.go View File

@@ -0,0 +1,623 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.30.0
// protoc v3.19.4
// source: pcmCore.proto

package pcmCore

import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)

const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)

type SyncInfoReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields

InfoList []*Info `protobuf:"bytes,3,rep,name=infoList,proto3" json:"infoList,omitempty"`
}

func (x *SyncInfoReq) Reset() {
*x = SyncInfoReq{}
if protoimpl.UnsafeEnabled {
mi := &file_pcmCore_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}

func (x *SyncInfoReq) String() string {
return protoimpl.X.MessageStringOf(x)
}

func (*SyncInfoReq) ProtoMessage() {}

func (x *SyncInfoReq) ProtoReflect() protoreflect.Message {
mi := &file_pcmCore_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}

// Deprecated: Use SyncInfoReq.ProtoReflect.Descriptor instead.
func (*SyncInfoReq) Descriptor() ([]byte, []int) {
return file_pcmCore_proto_rawDescGZIP(), []int{0}
}

func (x *SyncInfoReq) GetInfoList() []*Info {
if x != nil {
return x.InfoList
}
return nil
}

type Info struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields

TaskId string `protobuf:"bytes,1,opt,name=TaskId,proto3" json:"TaskId,omitempty"`
Status string `protobuf:"bytes,2,opt,name=Status,proto3" json:"Status,omitempty"`
StartTime string `protobuf:"bytes,3,opt,name=StartTime,proto3" json:"StartTime,omitempty"`
RunningTime int64 `protobuf:"varint,4,opt,name=RunningTime,proto3" json:"RunningTime,omitempty"`
}

func (x *Info) Reset() {
*x = Info{}
if protoimpl.UnsafeEnabled {
mi := &file_pcmCore_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}

func (x *Info) String() string {
return protoimpl.X.MessageStringOf(x)
}

func (*Info) ProtoMessage() {}

func (x *Info) ProtoReflect() protoreflect.Message {
mi := &file_pcmCore_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}

// Deprecated: Use Info.ProtoReflect.Descriptor instead.
func (*Info) Descriptor() ([]byte, []int) {
return file_pcmCore_proto_rawDescGZIP(), []int{1}
}

func (x *Info) GetTaskId() string {
if x != nil {
return x.TaskId
}
return ""
}

func (x *Info) GetStatus() string {
if x != nil {
return x.Status
}
return ""
}

func (x *Info) GetStartTime() string {
if x != nil {
return x.StartTime
}
return ""
}

func (x *Info) GetRunningTime() int64 {
if x != nil {
return x.RunningTime
}
return 0
}

type SyncInfoResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields

Code int64 `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"`
Msg string `protobuf:"bytes,2,opt,name=Msg,proto3" json:"Msg,omitempty"`
}

func (x *SyncInfoResp) Reset() {
*x = SyncInfoResp{}
if protoimpl.UnsafeEnabled {
mi := &file_pcmCore_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}

func (x *SyncInfoResp) String() string {
return protoimpl.X.MessageStringOf(x)
}

func (*SyncInfoResp) ProtoMessage() {}

func (x *SyncInfoResp) ProtoReflect() protoreflect.Message {
mi := &file_pcmCore_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}

// Deprecated: Use SyncInfoResp.ProtoReflect.Descriptor instead.
func (*SyncInfoResp) Descriptor() ([]byte, []int) {
return file_pcmCore_proto_rawDescGZIP(), []int{2}
}

func (x *SyncInfoResp) GetCode() int64 {
if x != nil {
return x.Code
}
return 0
}

func (x *SyncInfoResp) GetMsg() string {
if x != nil {
return x.Msg
}
return ""
}

type InfoListReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields

Kind string `protobuf:"bytes,1,opt,name=Kind,proto3" json:"Kind,omitempty"`
ServiceName string `protobuf:"bytes,2,opt,name=ServiceName,proto3" json:"ServiceName,omitempty"`
}

func (x *InfoListReq) Reset() {
*x = InfoListReq{}
if protoimpl.UnsafeEnabled {
mi := &file_pcmCore_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}

func (x *InfoListReq) String() string {
return protoimpl.X.MessageStringOf(x)
}

func (*InfoListReq) ProtoMessage() {}

func (x *InfoListReq) ProtoReflect() protoreflect.Message {
mi := &file_pcmCore_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}

// Deprecated: Use InfoListReq.ProtoReflect.Descriptor instead.
func (*InfoListReq) Descriptor() ([]byte, []int) {
return file_pcmCore_proto_rawDescGZIP(), []int{3}
}

func (x *InfoListReq) GetKind() string {
if x != nil {
return x.Kind
}
return ""
}

func (x *InfoListReq) GetServiceName() string {
if x != nil {
return x.ServiceName
}
return ""
}

type InfoListResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields

TaskInfoList []*TaskInfo `protobuf:"bytes,1,rep,name=taskInfoList,proto3" json:"taskInfoList,omitempty"`
}

func (x *InfoListResp) Reset() {
*x = InfoListResp{}
if protoimpl.UnsafeEnabled {
mi := &file_pcmCore_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}

func (x *InfoListResp) String() string {
return protoimpl.X.MessageStringOf(x)
}

func (*InfoListResp) ProtoMessage() {}

func (x *InfoListResp) ProtoReflect() protoreflect.Message {
mi := &file_pcmCore_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}

// Deprecated: Use InfoListResp.ProtoReflect.Descriptor instead.
func (*InfoListResp) Descriptor() ([]byte, []int) {
return file_pcmCore_proto_rawDescGZIP(), []int{4}
}

func (x *InfoListResp) GetTaskInfoList() []*TaskInfo {
if x != nil {
return x.TaskInfoList
}
return nil
}

type TaskInfo struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields

TaskId int64 `protobuf:"varint,1,opt,name=taskId,proto3" json:"taskId,omitempty"`
Kind string `protobuf:"bytes,2,opt,name=kind,proto3" json:"kind,omitempty"`
ExternalInfoList []*ExternalInfo `protobuf:"bytes,3,rep,name=ExternalInfoList,proto3" json:"ExternalInfoList,omitempty"`
}

func (x *TaskInfo) Reset() {
*x = TaskInfo{}
if protoimpl.UnsafeEnabled {
mi := &file_pcmCore_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}

func (x *TaskInfo) String() string {
return protoimpl.X.MessageStringOf(x)
}

func (*TaskInfo) ProtoMessage() {}

func (x *TaskInfo) ProtoReflect() protoreflect.Message {
mi := &file_pcmCore_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}

// Deprecated: Use TaskInfo.ProtoReflect.Descriptor instead.
func (*TaskInfo) Descriptor() ([]byte, []int) {
return file_pcmCore_proto_rawDescGZIP(), []int{5}
}

func (x *TaskInfo) GetTaskId() int64 {
if x != nil {
return x.TaskId
}
return 0
}

func (x *TaskInfo) GetKind() string {
if x != nil {
return x.Kind
}
return ""
}

func (x *TaskInfo) GetExternalInfoList() []*ExternalInfo {
if x != nil {
return x.ExternalInfoList
}
return nil
}

type ExternalInfo struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields

ExternalField string `protobuf:"bytes,1,opt,name=externalField,proto3" json:"externalField,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"`
}

func (x *ExternalInfo) Reset() {
*x = ExternalInfo{}
if protoimpl.UnsafeEnabled {
mi := &file_pcmCore_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}

func (x *ExternalInfo) String() string {
return protoimpl.X.MessageStringOf(x)
}

func (*ExternalInfo) ProtoMessage() {}

func (x *ExternalInfo) ProtoReflect() protoreflect.Message {
mi := &file_pcmCore_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}

// Deprecated: Use ExternalInfo.ProtoReflect.Descriptor instead.
func (*ExternalInfo) Descriptor() ([]byte, []int) {
return file_pcmCore_proto_rawDescGZIP(), []int{6}
}

func (x *ExternalInfo) GetExternalField() string {
if x != nil {
return x.ExternalField
}
return ""
}

func (x *ExternalInfo) GetName() string {
if x != nil {
return x.Name
}
return ""
}

func (x *ExternalInfo) GetStatus() string {
if x != nil {
return x.Status
}
return ""
}

var File_pcmCore_proto protoreflect.FileDescriptor

var file_pcmCore_proto_rawDesc = []byte{
0x0a, 0x0d, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
0x07, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x22, 0x38, 0x0a, 0x0b, 0x53, 0x79, 0x6e, 0x63,
0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x29, 0x0a, 0x08, 0x69, 0x6e, 0x66, 0x6f, 0x4c,
0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x63, 0x6d, 0x43,
0x6f, 0x72, 0x65, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x69, 0x6e, 0x66, 0x6f, 0x4c, 0x69,
0x73, 0x74, 0x22, 0x76, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x54, 0x61,
0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x54, 0x61, 0x73, 0x6b,
0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x74,
0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x53,
0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x52, 0x75, 0x6e, 0x6e,
0x69, 0x6e, 0x67, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x52,
0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x34, 0x0a, 0x0c, 0x53, 0x79,
0x6e, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f,
0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10,
0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x4d, 0x73, 0x67,
0x22, 0x43, 0x0a, 0x0b, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12,
0x12, 0x0a, 0x04, 0x4b, 0x69, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4b,
0x69, 0x6e, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61,
0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x45, 0x0a, 0x0c, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73,
0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x35, 0x0a, 0x0c, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x6e, 0x66,
0x6f, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x63,
0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0c,
0x74, 0x61, 0x73, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x79, 0x0a, 0x08,
0x54, 0x61, 0x73, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b,
0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64,
0x12, 0x12, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x6b, 0x69, 0x6e, 0x64, 0x12, 0x41, 0x0a, 0x10, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c,
0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15,
0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61,
0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x10, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x49,
0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x60, 0x0a, 0x0c, 0x45, 0x78, 0x74, 0x65, 0x72,
0x6e, 0x61, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x24, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72,
0x6e, 0x61, 0x6c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d,
0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x12, 0x0a,
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,
0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28,
0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 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 (
file_pcmCore_proto_rawDescOnce sync.Once
file_pcmCore_proto_rawDescData = file_pcmCore_proto_rawDesc
)

func file_pcmCore_proto_rawDescGZIP() []byte {
file_pcmCore_proto_rawDescOnce.Do(func() {
file_pcmCore_proto_rawDescData = protoimpl.X.CompressGZIP(file_pcmCore_proto_rawDescData)
})
return file_pcmCore_proto_rawDescData
}

var file_pcmCore_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_pcmCore_proto_goTypes = []interface{}{
(*SyncInfoReq)(nil), // 0: pcmCore.SyncInfoReq
(*Info)(nil), // 1: pcmCore.Info
(*SyncInfoResp)(nil), // 2: pcmCore.SyncInfoResp
(*InfoListReq)(nil), // 3: pcmCore.InfoListReq
(*InfoListResp)(nil), // 4: pcmCore.InfoListResp
(*TaskInfo)(nil), // 5: pcmCore.TaskInfo
(*ExternalInfo)(nil), // 6: pcmCore.ExternalInfo
}
var file_pcmCore_proto_depIdxs = []int32{
1, // 0: pcmCore.SyncInfoReq.infoList:type_name -> pcmCore.Info
5, // 1: pcmCore.InfoListResp.taskInfoList:type_name -> pcmCore.TaskInfo
6, // 2: pcmCore.TaskInfo.ExternalInfoList:type_name -> pcmCore.ExternalInfo
0, // 3: pcmCore.pcmCore.SyncInfo:input_type -> pcmCore.SyncInfoReq
3, // 4: pcmCore.pcmCore.InfoList:input_type -> pcmCore.InfoListReq
2, // 5: pcmCore.pcmCore.SyncInfo:output_type -> pcmCore.SyncInfoResp
4, // 6: pcmCore.pcmCore.InfoList:output_type -> pcmCore.InfoListResp
5, // [5:7] is the sub-list for method output_type
3, // [3:5] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}

func init() { file_pcmCore_proto_init() }
func file_pcmCore_proto_init() {
if File_pcmCore_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_pcmCore_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SyncInfoReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_pcmCore_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Info); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_pcmCore_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SyncInfoResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_pcmCore_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*InfoListReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_pcmCore_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*InfoListResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_pcmCore_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TaskInfo); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_pcmCore_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ExternalInfo); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_pcmCore_proto_rawDesc,
NumEnums: 0,
NumMessages: 7,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_pcmCore_proto_goTypes,
DependencyIndexes: file_pcmCore_proto_depIdxs,
MessageInfos: file_pcmCore_proto_msgTypes,
}.Build()
File_pcmCore_proto = out.File
file_pcmCore_proto_rawDesc = nil
file_pcmCore_proto_goTypes = nil
file_pcmCore_proto_depIdxs = nil
}

+ 150
- 0
adaptor/PCM-CORE/rpc/pcmCore/pcmCore_grpc.pb.go View File

@@ -0,0 +1,150 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc v3.19.4
// source: pcmCore.proto

package pcmCore

import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)

// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7

const (
PcmCore_SyncInfo_FullMethodName = "/pcmCore.pcmCore/SyncInfo"
PcmCore_InfoList_FullMethodName = "/pcmCore.pcmCore/InfoList"
)

// PcmCoreClient is the client API for PcmCore service.
//
// 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(ctx context.Context, in *SyncInfoReq, opts ...grpc.CallOption) (*SyncInfoResp, error)
// InfoList
InfoList(ctx context.Context, in *InfoListReq, opts ...grpc.CallOption) (*InfoListResp, error)
}

type pcmCoreClient struct {
cc grpc.ClientConnInterface
}

func NewPcmCoreClient(cc grpc.ClientConnInterface) PcmCoreClient {
return &pcmCoreClient{cc}
}

func (c *pcmCoreClient) SyncInfo(ctx context.Context, in *SyncInfoReq, opts ...grpc.CallOption) (*SyncInfoResp, error) {
out := new(SyncInfoResp)
err := c.cc.Invoke(ctx, PcmCore_SyncInfo_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}

func (c *pcmCoreClient) InfoList(ctx context.Context, in *InfoListReq, opts ...grpc.CallOption) (*InfoListResp, error) {
out := new(InfoListResp)
err := c.cc.Invoke(ctx, PcmCore_InfoList_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}

// PcmCoreServer is the server API for PcmCore service.
// All implementations must embed UnimplementedPcmCoreServer
// for forward compatibility
type PcmCoreServer interface {
// SyncInfo Synchronous data information
SyncInfo(context.Context, *SyncInfoReq) (*SyncInfoResp, error)
// InfoList
InfoList(context.Context, *InfoListReq) (*InfoListResp, error)
mustEmbedUnimplementedPcmCoreServer()
}

// UnimplementedPcmCoreServer must be embedded to have forward compatible implementations.
type UnimplementedPcmCoreServer struct {
}

func (UnimplementedPcmCoreServer) SyncInfo(context.Context, *SyncInfoReq) (*SyncInfoResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method SyncInfo not implemented")
}
func (UnimplementedPcmCoreServer) InfoList(context.Context, *InfoListReq) (*InfoListResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method InfoList not implemented")
}
func (UnimplementedPcmCoreServer) mustEmbedUnimplementedPcmCoreServer() {}

// UnsafePcmCoreServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to PcmCoreServer will
// result in compilation errors.
type UnsafePcmCoreServer interface {
mustEmbedUnimplementedPcmCoreServer()
}

func RegisterPcmCoreServer(s grpc.ServiceRegistrar, srv PcmCoreServer) {
s.RegisterService(&PcmCore_ServiceDesc, srv)
}

func _PcmCore_SyncInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SyncInfoReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PcmCoreServer).SyncInfo(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PcmCore_SyncInfo_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PcmCoreServer).SyncInfo(ctx, req.(*SyncInfoReq))
}
return interceptor(ctx, in, info, handler)
}

func _PcmCore_InfoList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(InfoListReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PcmCoreServer).InfoList(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PcmCore_InfoList_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PcmCoreServer).InfoList(ctx, req.(*InfoListReq))
}
return interceptor(ctx, in, info, handler)
}

// PcmCore_ServiceDesc is the grpc.ServiceDesc for PcmCore service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var PcmCore_ServiceDesc = grpc.ServiceDesc{
ServiceName: "pcmCore.pcmCore",
HandlerType: (*PcmCoreServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "SyncInfo",
Handler: _PcmCore_SyncInfo_Handler,
},
{
MethodName: "InfoList",
Handler: _PcmCore_InfoList_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "pcmCore.proto",
}

+ 39
- 0
adaptor/PCM-CORE/rpc/pcmcore.go View File

@@ -0,0 +1,39 @@
package main

import (
"flag"
"fmt"

"PCM/adaptor/PCM-CORE/rpc/internal/config"
"PCM/adaptor/PCM-CORE/rpc/internal/server"
"PCM/adaptor/PCM-CORE/rpc/internal/svc"
"PCM/adaptor/PCM-CORE/rpc/pcmCore"

"github.com/zeromicro/go-zero/core/conf"
"github.com/zeromicro/go-zero/core/service"
"github.com/zeromicro/go-zero/zrpc"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
)

var configFile = flag.String("f", "adaptor/PCM-CORE/rpc/etc/pcmcore.yaml", "the config file")

func main() {
flag.Parse()

var c config.Config
conf.MustLoad(*configFile, &c)
ctx := svc.NewServiceContext(c)

s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
pcmCore.RegisterPcmCoreServer(grpcServer, server.NewPcmCoreServer(ctx))

if c.Mode == service.DevMode || c.Mode == service.TestMode {
reflection.Register(grpcServer)
}
})
defer s.Stop()

fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
s.Start()
}

+ 52
- 0
adaptor/PCM-CORE/rpc/pcmcoreclient/pcmcore.go View File

@@ -0,0 +1,52 @@
// Code generated by goctl. DO NOT EDIT.
// Source: pcmCore.proto

package pcmcoreclient

import (
"context"

"PCM/adaptor/PCM-CORE/rpc/pcmCore"

"github.com/zeromicro/go-zero/zrpc"
"google.golang.org/grpc"
)

type (
ExternalInfo = pcmCore.ExternalInfo
Info = pcmCore.Info
InfoListReq = pcmCore.InfoListReq
InfoListResp = pcmCore.InfoListResp
SyncInfoReq = pcmCore.SyncInfoReq
SyncInfoResp = pcmCore.SyncInfoResp
TaskInfo = pcmCore.TaskInfo

PcmCore interface {
// SyncInfo Synchronous data information
SyncInfo(ctx context.Context, in *SyncInfoReq, opts ...grpc.CallOption) (*SyncInfoResp, error)
// InfoList
InfoList(ctx context.Context, in *InfoListReq, opts ...grpc.CallOption) (*InfoListResp, error)
}

defaultPcmCore struct {
cli zrpc.Client
}
)

func NewPcmCore(cli zrpc.Client) PcmCore {
return &defaultPcmCore{
cli: cli,
}
}

// SyncInfo Synchronous data information
func (m *defaultPcmCore) SyncInfo(ctx context.Context, in *SyncInfoReq, opts ...grpc.CallOption) (*SyncInfoResp, error) {
client := pcmCore.NewPcmCoreClient(m.cli.Conn())
return client.SyncInfo(ctx, in, opts...)
}

// InfoList
func (m *defaultPcmCore) InfoList(ctx context.Context, in *InfoListReq, opts ...grpc.CallOption) (*InfoListResp, error) {
client := pcmCore.NewPcmCoreClient(m.cli.Conn())
return client.InfoList(ctx, in, opts...)
}

Loading…
Cancel
Save