Skip to content

Commit

Permalink
feat: worker选取及恢复机制优化 TencentBlueKing#311
Browse files Browse the repository at this point in the history
  • Loading branch information
flyy1012 committed Nov 18, 2024
1 parent 2cb985d commit e25a544
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/backend/booster/bk_dist/controller/pkg/manager/remote/mgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ func (m *Mgr) SendFiles(req *types.RemoteTaskSendFileRequest) ([]string, error)
}

func (m *Mgr) retrySendFiles(h *dcProtocol.Host, failFiles []dcSDK.FileDesc, host chan string) {
blog.Debugf("remote: try to retry send fail file for work(%s) from pid(%d) to server %s with fail files %v", m.work.ID(), 1, h.Server, len(failFiles))
blog.Infof("remote: try to retry send fail file for work(%s) from pid(%d) to server %s with fail files %v", m.work.ID(), 1, h.Server, len(failFiles))
_, err := m.SendFiles(&types.RemoteTaskSendFileRequest{
Pid: 1,
Req: failFiles,
Expand All @@ -919,7 +919,7 @@ func (m *Mgr) retrySendFiles(h *dcProtocol.Host, failFiles []dcSDK.FileDesc, hos
if err != nil {
blog.Errorf("remote: try to retry send fail file for work(%s) from pid(%d) to server %s failed: %v", m.work.ID(), 1, h.Server, err)
} else {
blog.Debugf("remote: success to retry send fail file for work(%s) from pid(%d) to server %s with fail files %v", m.work.ID(), 1, h.Server, len(failFiles))
blog.Infof("remote: success to retry send fail file for work(%s) from pid(%d) to server %s with fail files %v", m.work.ID(), 1, h.Server, len(failFiles))
}
host <- h.Server
}
Expand Down Expand Up @@ -1628,16 +1628,17 @@ func (m *Mgr) getFailedFileCollectionByHost(server string) []*types.FileCollecti
func (m *Mgr) retrySendToolChain(handler dcSDK.RemoteWorkerHandler, req *types.RemoteTaskExecuteRequest, fileCollections []*types.FileCollectionInfo, host chan string) {
blog.Infof("remote: retry send tool chain for work(%s) from pid(%d) to server(%s)",
m.work.ID(), req.Pid, req.Server.Server)
if err := m.sendFileCollectionOnce(handler, req.Pid, req.Sandbox, req.Server, fileCollections); err != nil {
err := m.sendFileCollectionOnce(handler, req.Pid, req.Sandbox, req.Server, fileCollections)
if err != nil {
blog.Errorf("remote: retry send tool chain for work(%s) from pid(%d) to server(%s), "+
"send tool chain files failed: %v", m.work.ID(), req.Pid, req.Server.Server, err)
return

} else {
// enable worker
m.resource.EnableWorker(req.Server)
blog.Infof("remote: success to retry send tool chain for work(%s) from pid(%d) to server(%s)", m.work.ID(), req.Pid, req.Server.Server)
}
// enable worker
m.resource.EnableWorker(req.Server)
host <- req.Server.Server
blog.Infof("remote: success to retry send tool chain for work(%s) from pid(%d) to server(%s)", m.work.ID(), req.Pid, req.Server.Server)

}

func (m *Mgr) sendFileCollectionOnce(
Expand Down

0 comments on commit e25a544

Please sign in to comment.