From 8f1fd4af5b07019cd136dcc9507da11cca7a596a Mon Sep 17 00:00:00 2001 From: zhouqunjie Date: Sat, 22 Jun 2024 18:22:14 +0800 Subject: [PATCH 1/2] tasktypedict info Former-commit-id: c750780c2903b03418ab9fc51c6677f99c2268cc --- api/desc/core/pcm-core.api | 3 ++- api/internal/types/types.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/api/desc/core/pcm-core.api b/api/desc/core/pcm-core.api index 038b716f..516409cc 100644 --- a/api/desc/core/pcm-core.api +++ b/api/desc/core/pcm-core.api @@ -404,7 +404,8 @@ type ( TenantId string `json:"tenantId,omitempty" db:"tenant_id"` CreatedTime string `json:"createdTime,omitempty" db:"created_time" gorm:"autoCreateTime"` UpdatedTime string `json:"updatedTime,omitempty" db:"updated_time"` - AdapterTypeDict int `json:"adapterTypeDict" db:"create_time" gorm:"adapter_type_dict"` //任务类型(对应字典表的值 + AdapterTypeDict int `json:"adapterTypeDict" db:"adapter_type_dict" gorm:"adapter_type_dict"` //适配器类型(对应字典表的值 + TaskTypeDict int `json:"taskTypeDict" db:"task_type_dict" gorm:"task_type_dict"` //任务类型(对应字典表的值 } ) diff --git a/api/internal/types/types.go b/api/internal/types/types.go index 2dc15faf..86f165bd 100644 --- a/api/internal/types/types.go +++ b/api/internal/types/types.go @@ -347,7 +347,8 @@ type TaskModel struct { TenantId string `json:"tenantId,omitempty" db:"tenant_id"` CreatedTime string `json:"createdTime,omitempty" db:"created_time" gorm:"autoCreateTime"` UpdatedTime string `json:"updatedTime,omitempty" db:"updated_time"` - AdapterTypeDict int `json:"adapterTypeDict" db:"create_time" gorm:"adapter_type_dict"` //任务类型(对应字典表的值 + AdapterTypeDict int `json:"adapterTypeDict" db:"adapter_type_dict" gorm:"adapter_type_dict"` //适配器类型(对应字典表的值 + TaskTypeDict int `json:"taskTypeDict" db:"task_type_dict" gorm:"task_type_dict"` //任务类型(对应字典表的值 } type TaskDetailReq struct { From f193d6ab1fc49707351ca18636350aad6116a93d Mon Sep 17 00:00:00 2001 From: tzwang Date: Sat, 22 Jun 2024 19:20:14 +0800 Subject: [PATCH 2/2] fix noticeinfo bugs Former-commit-id: 6261719c61eeba3658966a3c90b5b391948ab3c5 --- api/internal/logic/inference/imageinferencelogic.go | 4 ++-- api/internal/scheduler/database/aiStorage.go | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/api/internal/logic/inference/imageinferencelogic.go b/api/internal/logic/inference/imageinferencelogic.go index fc842356..665f2ff7 100644 --- a/api/internal/logic/inference/imageinferencelogic.go +++ b/api/internal/logic/inference/imageinferencelogic.go @@ -333,9 +333,9 @@ func infer(opt *option.InferOption, clusters []*strategy.AssignedCluster, ts []s } if len(cs) == successStatusCount { - svcCtx.Scheduler.AiStorages.AddNoticeInfo(opt.AdapterId, adapterName, "", "", opt.TaskName, "failed", "任务失败") - } else { svcCtx.Scheduler.AiStorages.AddNoticeInfo(opt.AdapterId, adapterName, "", "", opt.TaskName, "completed", "任务完成") + } else { + svcCtx.Scheduler.AiStorages.AddNoticeInfo(opt.AdapterId, adapterName, "", "", opt.TaskName, "failed", "任务失败") } //save ai sub tasks diff --git a/api/internal/scheduler/database/aiStorage.go b/api/internal/scheduler/database/aiStorage.go index 511920b8..a812f7e2 100644 --- a/api/internal/scheduler/database/aiStorage.go +++ b/api/internal/scheduler/database/aiStorage.go @@ -311,12 +311,16 @@ func (s *AiStorage) GetStrategyCode(name string) (int64, error) { func (s *AiStorage) AddNoticeInfo(adapterId string, adapterName string, clusterId string, clusterName string, taskName string, noticeType string, incident string) { aId, err := strconv.ParseInt(adapterId, 10, 64) if err != nil { - return + logx.Errorf("adapterId convert failure, err: %v", err) } - cId, err := strconv.ParseInt(clusterId, 10, 64) - if err != nil { - return + var cId int64 + if clusterId != "" { + cId, err = strconv.ParseInt(clusterId, 10, 64) + if err != nil { + logx.Errorf("clusterId convert failure, err: %v", err) + } } + noticeInfo := clientCore.NoticeInfo{ AdapterId: aId, AdapterName: adapterName,