fix get task worker (#208)

Reviewed-on: https://git.infini.ltd/infini/console/pulls/208
Co-authored-by: liugq <silenceqi@hotmail.com>
Co-committed-by: liugq <silenceqi@hotmail.com>
This commit is contained in:
liugq 2023-10-30 17:17:29 +08:00 committed by medcl
parent adb031e6af
commit 4b63e81ae1
2 changed files with 3 additions and 3 deletions

View File

@ -681,7 +681,7 @@ func (h *APIHandler) getChildPipelineInfosFromGateway(pipelineTaskIDs map[string
for instID, taskIDs := range pipelineTaskIDs { for instID, taskIDs := range pipelineTaskIDs {
inst := &model2.TaskWorker{} inst := &model2.TaskWorker{}
inst.ID = instID inst.ID = instID
_, err = orm.Get(inst) _, err = orm.Get(&inst.Instance)
if err != nil { if err != nil {
log.Errorf("failed to get instance info, id: %s, err: %v", instID, err) log.Errorf("failed to get instance info, id: %s, err: %v", instID, err)
continue continue

View File

@ -66,7 +66,7 @@ func (p *scheduler) GetPreferenceInstance(config migration_model.ExecutionConfig
if p.CheckInstanceAvailable { if p.CheckInstanceAvailable {
tempInst := model.TaskWorker{} tempInst := model.TaskWorker{}
tempInst.ID = node.ID tempInst.ID = node.ID
_, err = orm.Get(&tempInst) _, err = orm.Get(&tempInst.Instance)
if err != nil { if err != nil {
log.Errorf("failed to get instance, err: %v", err) log.Errorf("failed to get instance, err: %v", err)
continue continue
@ -102,7 +102,7 @@ func (p *scheduler) GetInstance(instanceID string) (*model.TaskWorker, error) {
instance := model.TaskWorker{} instance := model.TaskWorker{}
instance.ID = instanceID instance.ID = instanceID
_, err := orm.Get(&instance) _, err := orm.Get(&instance.Instance)
if err != nil { if err != nil {
log.Errorf("failed to get instance [%s] from orm, err: %v", instance.ID, err) log.Errorf("failed to get instance [%s] from orm, err: %v", instance.ID, err)
return nil, err return nil, err