天河增加返回信息字段
Former-commit-id: 66fb94eb655a18525883a706496594a34155b34b
This commit is contained in:
parent
9eb9f871cf
commit
09dd42f873
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue