修复client日志打印报错

This commit is contained in:
JeshuaRen 2024-05-16 09:59:26 +08:00
parent 1fc424a494
commit e972db321f
5 changed files with 4 additions and 7 deletions

View File

@ -1,6 +1,8 @@
{
"logger": {
"output": "stdout",
"output": "file",
"outputFileName": "schedulerclient",
"outputDirectory": "log",
"level": "debug"
},
"rabbitMQ": {

View File

@ -3,7 +3,6 @@ package state
import (
"context"
"fmt"
"gitlink.org.cn/cloudream/common/pkgs/logger"
schsdk "gitlink.org.cn/cloudream/common/sdks/scheduler"
jobmod "gitlink.org.cn/cloudream/scheduler/common/models/job"
"gitlink.org.cn/cloudream/scheduler/common/pkgs/prescheduler"
@ -54,13 +53,11 @@ func (s *MultiInstanceInit) do(rtx jobmgr.JobStateRunContext, jo *jobmgr.Job) {
// 创建实例并运行
instanceJob := job.NewInstanceJob(*instJobInfo, files)
jobID := rtx.Mgr.AddJob(jo.JobSetID, instanceJob, NewPreSchuduling(multInstJob.PreScheduler))
logger.Info("Init instance success, jobID: " + jobID)
// 在多实例任务中新增这个实例的任务ID
multInstJob.SubJobs = append(multInstJob.SubJobs, jobID)
rtx.Mgr.ChangeState(jo, NewMultiInstanceRunning(prescheduler.NewDefaultPreScheduler()))
logger.Info("Create multiInstance job success, jobID: " + jo.JobID)
}
func (s *MultiInstanceInit) Dump(ctx jobmgr.JobStateRunContext, job *jobmgr.Job) jobmod.JobStateDump {

View File

@ -28,7 +28,6 @@ func (s *MultiInstanceRunning) Run(rtx jobmgr.JobStateRunContext, job *jobmgr.Jo
}
func (s *MultiInstanceRunning) do(rtx jobmgr.JobStateRunContext, jo *jobmgr.Job) {
logger.Info("start run multiInstanceRunning, jobID: " + jo.JobID)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@ -81,7 +80,6 @@ func (s *MultiInstanceRunning) do(rtx jobmgr.JobStateRunContext, jo *jobmgr.Job)
// 创建实例并运行
instanceJob := job.NewInstanceJob(*instJobInfo, files)
jobID := rtx.Mgr.AddJob(jo.JobSetID, instanceJob, NewPreSchuduling(*jobSchedule))
logger.Info("Create instance success, jobID: " + jobID)
// 在多实例任务中新增这个实例的任务ID
multInstJob.SubJobs = append(multInstJob.SubJobs, jobID)

View File

@ -74,6 +74,7 @@ func (m *Manager) ChangeState(job *Job, state JobState) {
lastState := mgrJob.state
mgrJob.state = state
logger.Info("jobID: %s change state from %s to %s", job.JobID, lastState, state)
go func() {
state.Run(JobStateRunContext{

View File

@ -48,7 +48,6 @@ func (svc *Service) SubmitJobSet(msg *mgrmq.SubmitJobSet) (*mgrmq.SubmitJobSetRe
case *schsdk.MultiInstanceJobInfo:
preSch, ok := msg.PreScheduleScheme.JobSchemes[info.LocalJobID]
logger.Info(">>>localJobID: " + info.LocalJobID)
job := job.NewMultiInstanceJob(*info, preSch)