commit for zw
Former-commit-id: 37456dca050bf7b1f0321b8490a5c358e13b065f
This commit is contained in:
parent
d0bfea9fd4
commit
9eb9f871cf
|
@ -7,6 +7,7 @@ import (
|
||||||
"PCM/common/enum"
|
"PCM/common/enum"
|
||||||
"PCM/common/tool"
|
"PCM/common/tool"
|
||||||
"context"
|
"context"
|
||||||
|
"github.com/jinzhu/copier"
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
@ -41,7 +42,7 @@ 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 {
|
||||||
tool.Convert(job, infoList.HpcInfoList[index])
|
copier.CopyWithOption(infoList.HpcInfoList[index], job, copier.Option{Converters: tool.Converters})
|
||||||
infoList.HpcInfoList[index].JobId = strconv.Itoa(int(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 = int64(time.Now().Sub(time.Unix(job.StartTime, 0)).Seconds())
|
infoList.HpcInfoList[index].RunningTime = int64(time.Now().Sub(time.Unix(job.StartTime, 0)).Seconds())
|
||||||
|
@ -72,17 +73,19 @@ func submitJob(infoList *pcmcoreclient.InfoListResp, submitJobLogic *SubmitJobLo
|
||||||
}
|
}
|
||||||
jobResult, _ := submitJobLogic.SubmitJob(&submitReq)
|
jobResult, _ := submitJobLogic.SubmitJob(&submitReq)
|
||||||
// 任务失败
|
// 任务失败
|
||||||
if string(jobResult.SubmitResponseMsg[0].ErrorCode) != "" {
|
if jobResult.SubmitResponseMsg[0].ErrorCode != 0 {
|
||||||
infoList.HpcInfoList[index].Status = "Failed"
|
infoList.HpcInfoList[index].Status = "Failed"
|
||||||
infoList.HpcInfoList[index].ExitCode = jobResult.SubmitResponseMsg[0].ErrorCode
|
infoList.HpcInfoList[index].ExitCode = jobResult.SubmitResponseMsg[0].ErrorCode
|
||||||
// 查询失败的任务信息同步到core端
|
// 查询失败的任务信息同步到core端
|
||||||
historyResult, err := historyListLogic.ListHistoryJob(&hpcTH.ListHistoryJobReq{})
|
for index, _ := range infoList.HpcInfoList {
|
||||||
if err != nil {
|
historyResult, err := historyListLogic.ListHistoryJob(&hpcTH.ListHistoryJobReq{})
|
||||||
return
|
if err != nil {
|
||||||
}
|
return
|
||||||
for _, historyJob := range historyResult.HistoryJobs {
|
}
|
||||||
if infoList.HpcInfoList[index].Name == historyJob.Jobname {
|
for _, historyJob := range historyResult.HistoryJobs {
|
||||||
tool.Convert(historyJob, infoList.HpcInfoList[index])
|
if infoList.HpcInfoList[index].JobId == string(historyJob.Jobid) {
|
||||||
|
tool.Convert(historyJob, infoList.HpcInfoList[index])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue