天河对接完成

This commit is contained in:
zhouqunjie 2023-04-27 00:43:52 -07:00
parent 7c1d1372e6
commit dbd3eb0139
3 changed files with 5 additions and 5 deletions

View File

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

View File

@ -21,7 +21,6 @@ var configFile = flag.String("f", "adaptor/PCM-HPC/PCM-TH/rpc/etc/hpcth.yaml", "
func main() { func main() {
//--------------------
flag.Parse() flag.Parse()
var bootstrapConfig commonConfig.BootstrapConfig var bootstrapConfig commonConfig.BootstrapConfig

View File

@ -7,10 +7,12 @@ import (
"PCM/common/enum" "PCM/common/enum"
"context" "context"
"github.com/zeromicro/go-zero/core/logx" "github.com/zeromicro/go-zero/core/logx"
"strconv"
"time" "time"
) )
func InitCron(svc *svc.ServiceContext) { func InitCron(svc *svc.ServiceContext) {
svc.Cron.Start()
submitJobLogic := NewSubmitJobLogic(context.Background(), svc) submitJobLogic := NewSubmitJobLogic(context.Background(), svc)
listLogic := NewListJobLogic(context.Background(), svc) listLogic := NewListJobLogic(context.Background(), svc)
svc.Cron.AddFunc("*/5 * * * * ?", func() { svc.Cron.AddFunc("*/5 * * * * ?", func() {
@ -36,11 +38,10 @@ func InitCron(svc *svc.ServiceContext) {
for index, _ := range infoList.HpcInfoList { for index, _ := range infoList.HpcInfoList {
for _, job := range listJob.Jobs { for _, job := range listJob.Jobs {
if job.Name == infoList.HpcInfoList[index].Name { if job.Name == infoList.HpcInfoList[index].Name {
infoList.HpcInfoList[index].JobId = string(job.JobId) infoList.HpcInfoList[index].JobId = strconv.Itoa(int(job.JobId))
infoList.HpcInfoList[index].StartTime = time.Unix(job.StartTime, 0).String() infoList.HpcInfoList[index].StartTime = time.Unix(job.StartTime, 0).String()
infoList.HpcInfoList[index].RunningTime = time.Now().Sub(time.Unix(job.StartTime, 0)).Milliseconds() infoList.HpcInfoList[index].RunningTime = time.Now().Sub(time.Unix(job.StartTime, 0)).Milliseconds()
infoList.HpcInfoList[index].Status = enum.State(job.JobState).String() infoList.HpcInfoList[index].Status = enum.State(job.JobState).String()
} }
} }
} }
@ -63,7 +64,7 @@ func submitJob(infoList *pcmcoreclient.InfoListResp, submitJobLogic *SubmitJobLo
} }
jobResult, _ := submitJobLogic.SubmitJob(&submitReq) jobResult, _ := submitJobLogic.SubmitJob(&submitReq)
infoList.HpcInfoList[index].Status = "Pending" infoList.HpcInfoList[index].Status = "Pending"
infoList.HpcInfoList[index].JobId = string(jobResult.SubmitResponseMsg[0].JobId) infoList.HpcInfoList[index].JobId = strconv.Itoa(int(jobResult.SubmitResponseMsg[0].JobId))
} }
} }
} }