From 09dd42f873c5af84b33d23f27630dcb920aa2719 Mon Sep 17 00:00:00 2001 From: zhangwei <894646498@qq.com> Date: Mon, 29 May 2023 18:01:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A9=E6=B2=B3=E5=A2=9E=E5=8A=A0=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E4=BF=A1=E6=81=AF=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 66fb94eb655a18525883a706496594a34155b34b --- .../PCM-TH/rpc/internal/logic/cronlogic.go | 22 +++---------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/adaptor/PCM-HPC/PCM-TH/rpc/internal/logic/cronlogic.go b/adaptor/PCM-HPC/PCM-TH/rpc/internal/logic/cronlogic.go index c8a16483..a920ee6f 100644 --- a/adaptor/PCM-HPC/PCM-TH/rpc/internal/logic/cronlogic.go +++ b/adaptor/PCM-HPC/PCM-TH/rpc/internal/logic/cronlogic.go @@ -42,11 +42,12 @@ func InitCron(svc *svc.ServiceContext) { for index, _ := range infoList.HpcInfoList { for _, job := range listJob.Jobs { if job.Name == infoList.HpcInfoList[index].Name { - copier.CopyWithOption(infoList.HpcInfoList[index], job, copier.Option{Converters: tool.Converters}) + copier.CopyWithOption(&infoList.HpcInfoList[index], job, copier.Option{Converters: tool.Converters}) infoList.HpcInfoList[index].JobId = strconv.Itoa(int(job.JobId)) 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].Status = enum.State(job.JobState).String() + infoList.HpcInfoList[index].Version = "slurm 2.6.9" } } } @@ -66,29 +67,12 @@ func submitJob(infoList *pcmcoreclient.InfoListResp, submitJobLogic *SubmitJobLo for index, _ := range infoList.HpcInfoList { if infoList.HpcInfoList[index].Status == "Saved" { submitReq := hpcTH.SubmitJobReq{ - Account: "root", + Account: infoList.HpcInfoList[index].Account, Name: infoList.HpcInfoList[index].Name, Script: infoList.HpcInfoList[index].CmdScript, UserId: 123, } jobResult, _ := submitJobLogic.SubmitJob(&submitReq) - // 任务失败 - if jobResult.SubmitResponseMsg[0].ErrorCode != 0 { - infoList.HpcInfoList[index].Status = "Failed" - infoList.HpcInfoList[index].ExitCode = jobResult.SubmitResponseMsg[0].ErrorCode - // 查询失败的任务信息同步到core端 - for index, _ := range infoList.HpcInfoList { - historyResult, err := historyListLogic.ListHistoryJob(&hpcTH.ListHistoryJobReq{}) - if err != nil { - return - } - for _, historyJob := range historyResult.HistoryJobs { - if infoList.HpcInfoList[index].JobId == string(historyJob.Jobid) { - tool.Convert(historyJob, infoList.HpcInfoList[index]) - } - } - } - } // 任务提交成功 infoList.HpcInfoList[index].Status = "Pending" infoList.HpcInfoList[index].JobId = strconv.Itoa(int(jobResult.SubmitResponseMsg[0].JobId))