提交 01a62511 编写于 作者: H Helin Wang

add curPass into log, remove JobTasks

上级 10794cf4
...@@ -78,12 +78,11 @@ type taskEntry struct { ...@@ -78,12 +78,11 @@ type taskEntry struct {
} }
type masterState struct { type masterState struct {
Todo []taskEntry Todo []taskEntry
Pending map[int]taskEntry // map from task ID to task entry Pending map[int]taskEntry // map from task ID to task entry
Done []taskEntry Done []taskEntry
Failed []taskEntry Failed []taskEntry
CurPass int CurPass int
JobTasks []taskEntry
} }
// Service is the master server service. // Service is the master server service.
...@@ -297,8 +296,7 @@ func (s *Service) SetDataset(globPaths []string, _ *int) error { ...@@ -297,8 +296,7 @@ func (s *Service) SetDataset(globPaths []string, _ *int) error {
return err return err
} }
s.state.JobTasks = partition(chunks, s.chunksPerTask) s.state.Todo = partition(chunks, s.chunksPerTask)
s.state.Todo = s.state.JobTasks
err = s.snapshot() err = s.snapshot()
if err != nil { if err != nil {
...@@ -361,6 +359,7 @@ func (s *Service) logFields() log.Fields { ...@@ -361,6 +359,7 @@ func (s *Service) logFields() log.Fields {
"pendingLen": len(s.state.Pending), "pendingLen": len(s.state.Pending),
"doneLen": len(s.state.Done), "doneLen": len(s.state.Done),
"failedLen": len(s.state.Failed), "failedLen": len(s.state.Failed),
"curPass": s.state.CurPass,
} }
} }
...@@ -431,7 +430,7 @@ func (s *Service) TaskFinished(taskID int, dummy *int) error { ...@@ -431,7 +430,7 @@ func (s *Service) TaskFinished(taskID int, dummy *int) error {
if len(s.state.Todo) == 0 && len(s.state.Pending) == 0 { if len(s.state.Todo) == 0 && len(s.state.Pending) == 0 {
// increase master side pass count if all tasks finished // increase master side pass count if all tasks finished
s.state.CurPass++ s.state.CurPass++
s.state.Todo = s.state.JobTasks s.state.Todo = append(s.state.Done, s.state.Failed...)
s.state.Done = []taskEntry{} s.state.Done = []taskEntry{}
// TODO(typhoonzero): deal with failed tasks // TODO(typhoonzero): deal with failed tasks
s.state.Failed = []taskEntry{} s.state.Failed = []taskEntry{}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册