fix: update task_vm 0703

Former-commit-id: bd0465a6b4bdab9c8a2a1fe017397c07d030d6af
This commit is contained in:
qiwang 2024-07-03 11:26:10 +08:00
parent d4ccd8e716
commit d648394d08
2 changed files with 5 additions and 5 deletions

View File

@ -6,8 +6,8 @@ import (
)
var StatusMapping = map[string][]string{
"Running": {"RUNNING", "RUNNING", "CONFIGURING", "COMPLETING"},
"Succeeded": {"COMPLETED"},
"Running": {"RUNNING", "RUNNING", "CONFIGURING", "COMPLETING", "BUILD"},
"Succeeded": {"COMPLETED", "ACTIVE"},
"Failed": {"FAILED", "TIMEOUT", "DEADLINE", "OUT_OF_MEMORY", "BOOT_FAIL", "CANCELLED"},
}

View File

@ -59,8 +59,8 @@ func (l *PushTaskInfoLogic) PushTaskInfo(req *clientCore.PushTaskInfoReq) (*clie
}
case 02:
for _, vmInfo := range req.VmInfoList {
l.svcCtx.DbEngin.Exec("update task_vm set status = ?,start_time = ? where cluster_id = ? and task_id = ? and name = ?",
vmInfo.Status, vmInfo.StartTime, vmInfo.ClusterId, vmInfo.TaskId, vmInfo.Name)
l.svcCtx.DbEngin.Exec("update task_vm set status = ?,start_time = ?,server_id = ? where cluster_id = ? and task_id = ? and name = ?",
vmInfo.Status, vmInfo.StartTime, vmInfo.ServerId, vmInfo.ClusterId, vmInfo.TaskId, vmInfo.Name)
noticeInfo := clientCore.NoticeInfo{
TaskId: vmInfo.TaskId,
AdapterId: vmInfo.AdapterId,
@ -108,7 +108,7 @@ func (l *PushTaskInfoLogic) PushTaskInfo(req *clientCore.PushTaskInfoReq) (*clie
func syncTask(gorm *gorm.DB, noticeInfo clientCore.NoticeInfo) {
var allStatus string
tx := gorm.Raw("SELECT CONCAT_WS(',',GROUP_CONCAT(DISTINCT h.status) ,GROUP_CONCAT(DISTINCT a.status) ,GROUP_CONCAT(DISTINCT c.status))as status from task t left join task_hpc h on t.id = h.task_id left join task_cloud c on t.id = c.task_id left join task_vm v on t.id = v.task_id left join task_ai a on t.id = a.task_id where t.id = ?", noticeInfo.TaskId).Scan(&allStatus)
tx := gorm.Raw("SELECT CONCAT_WS(',',GROUP_CONCAT(DISTINCT h.status) ,GROUP_CONCAT(DISTINCT a.status) ,GROUP_CONCAT(DISTINCT c.status),GROUP_CONCAT(DISTINCT v.status))as status from task t left join task_hpc h on t.id = h.task_id left join task_cloud c on t.id = c.task_id left join task_vm v on t.id = v.task_id left join task_ai a on t.id = a.task_id where t.id = ?", noticeInfo.TaskId).Scan(&allStatus)
if tx.Error != nil {
logx.Error(tx.Error)
}