From bdb1ad3d59b71ada208eedac64ae5dc35799f6c7 Mon Sep 17 00:00:00 2001 From: zhangwei <894646498@qq.com> Date: Mon, 16 Oct 2023 10:27:49 +0800 Subject: [PATCH] =?UTF-8?q?redis=E9=98=9F=E5=88=97=E6=9B=BF=E6=8D=A2kafka?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 744a11a0d88e451f77fd3ea525f219e968bba701 --- api/desc/ai/pcm-ai.api | 2 +- .../logic/core/scheduletaskbyyamllogic.go | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/api/desc/ai/pcm-ai.api b/api/desc/ai/pcm-ai.api index d41f7f4a..da96190a 100644 --- a/api/desc/ai/pcm-ai.api +++ b/api/desc/ai/pcm-ai.api @@ -341,7 +341,7 @@ type ImportTasks { TotalFileCount uint32 `json:"totalFileCount,omitempty"` CreateTime uint32 `json:"createTime,omitempty"` ElapsedTime uint32 `json:"elapsedTime,omitempty"` - AnnotationFormatConfig []interface{} `json:"annotationFormatConfig,omitempty"` + AnnotationFormatConfig []interface{} `json:"annotationFormatConfig,omitempty"` } /******************taskList end*************************/ /******************ListTrainingJobs start*************************/ diff --git a/api/internal/logic/core/scheduletaskbyyamllogic.go b/api/internal/logic/core/scheduletaskbyyamllogic.go index f1350c7b..763cd798 100644 --- a/api/internal/logic/core/scheduletaskbyyamllogic.go +++ b/api/internal/logic/core/scheduletaskbyyamllogic.go @@ -50,14 +50,13 @@ func (l *ScheduleTaskByYamlLogic) ScheduleTaskByYaml(req *types.ScheduleTaskByYa // 遍历子任务放入任务队列中 for _, task := range req.Tasks { task.TaskId = taskModel.Id - //taskBytes, err := json.Marshal(task) - //if err != nil { - // return err - //} - //l.svcCtx.RedisClient.Publish(context.Background(), "test", &mqs.Msg{ - // Topic: task.TaskType, - // Body: taskBytes, - //}) + // 将任务数据转换成消息体 + reqMessage, err := json.Marshal(task) + if err != nil { + logx.Error(err) + return err + } + l.svcCtx.RedisClient.Publish(context.Background(), task.TaskType, reqMessage) } return nil }