updated getJobLog api logic

Former-commit-id: ff312781e1ec873ab7a6637cead3f466809cd001
This commit is contained in:
tzwang 2024-04-25 16:51:59 +08:00
parent 1281f6d61b
commit f3ce064dae
5 changed files with 14 additions and 4 deletions

View File

@ -923,7 +923,7 @@ service pcm {
get /schedule/ai/getAlgorithms/:adapterId/:resourceType/:taskType/:dataset (AiAlgorithmsReq) returns (AiAlgorithmsResp) get /schedule/ai/getAlgorithms/:adapterId/:resourceType/:taskType/:dataset (AiAlgorithmsReq) returns (AiAlgorithmsResp)
@handler ScheduleGetAiJobLogLogHandler @handler ScheduleGetAiJobLogLogHandler
get /schedule/ai/getJobLog/:taskId/:instanceNum (AiJobLogReq) returns (AiJobLogResp) get /schedule/ai/getJobLog/:adapterId/:taskId/:instanceNum (AiJobLogReq) returns (AiJobLogResp)
@handler ScheduleSubmitHandler @handler ScheduleSubmitHandler
post /schedule/submit (ScheduleReq) returns (ScheduleResp) post /schedule/submit (ScheduleReq) returns (ScheduleResp)

View File

@ -72,6 +72,8 @@ type (
} }
AiJobLogReq { AiJobLogReq {
AdapterId string `path:"adapterId"`
ClusterId string `path:"clusterId"`
TaskId string `path:"taskId"` TaskId string `path:"taskId"`
instanceNum string `path:"instanceNum"` instanceNum string `path:"instanceNum"`
} }

View File

@ -1147,7 +1147,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
}, },
{ {
Method: http.MethodGet, Method: http.MethodGet,
Path: "/schedule/ai/getJobLog/:taskId/:instanceNum", Path: "/schedule/ai/getJobLog/:adapterId/:taskId/:instanceNum",
Handler: schedule.ScheduleGetAiJobLogLogHandler(serverCtx), Handler: schedule.ScheduleGetAiJobLogLogHandler(serverCtx),
}, },
{ {

View File

@ -24,7 +24,13 @@ func NewScheduleGetAiJobLogLogLogic(ctx context.Context, svcCtx *svc.ServiceCont
} }
func (l *ScheduleGetAiJobLogLogLogic) ScheduleGetAiJobLogLog(req *types.AiJobLogReq) (resp *types.AiJobLogResp, err error) { func (l *ScheduleGetAiJobLogLogLogic) ScheduleGetAiJobLogLog(req *types.AiJobLogReq) (resp *types.AiJobLogResp, err error) {
// todo: add your logic here and delete this line resp = &types.AiJobLogResp{}
return log, err := l.svcCtx.Scheduler.AiService.AiCollectorAdapterMap[req.AdapterId][req.ClusterId].GetTrainingTaskLog(l.ctx, req.TaskId, req.InstanceNum)
if err != nil {
return nil, err
}
resp.Log = log
return resp, nil
} }

View File

@ -5536,6 +5536,8 @@ type AiAlgorithmsResp struct {
} }
type AiJobLogReq struct { type AiJobLogReq struct {
AdapterId string `path:"adapterId"`
ClusterId string `path:"clusterId"`
TaskId string `path:"taskId"` TaskId string `path:"taskId"`
InstanceNum string `path:"instanceNum"` InstanceNum string `path:"instanceNum"`
} }