From 4970484d37a50d25fab14e7178d8569f6473a24a Mon Sep 17 00:00:00 2001 From: Helin Wang Date: Thu, 15 Jun 2017 00:33:09 +0000 Subject: [PATCH] improve comment, fix build error --- go/master/client.go | 4 +++- go/master/client_internal_test.go | 9 +++++---- go/master/service.go | 4 ++-- go/pserver/cclient/test/main.c | 1 + 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/go/master/client.go b/go/master/client.go index 73c945ddc..db6b17d2f 100644 --- a/go/master/client.go +++ b/go/master/client.go @@ -34,6 +34,8 @@ func (c *Client) getRecords() { for { t, err := c.getTask() if err != nil { + // TODO(helin): wait before move on with next + // getTask call. log.Println(err) continue } @@ -125,7 +127,7 @@ func (c *Client) taskFinished(taskID int) error { // NextRecord returns next record in the dataset. // -// NextRecord will block until next record is available. It is +// NextRecord will block until the next record is available. It is // thread-safe. func (c *Client) NextRecord() []byte { return <-c.ch diff --git a/go/master/client_internal_test.go b/go/master/client_internal_test.go index 362668202..00fcca0e2 100644 --- a/go/master/client_internal_test.go +++ b/go/master/client_internal_test.go @@ -75,6 +75,7 @@ func TestGetFinishTask(t *testing.T) { } f.Close() + // Manually intialize client to avoid calling c.getRecords() c := &Client{} c.conn = connection.New() go c.monitorMaster(TestAddresser(fmt.Sprintf(":%d", p))) @@ -85,19 +86,19 @@ func TestGetFinishTask(t *testing.T) { for idx := 0; idx < totalTask; idx++ { task, err := c.getTask() if err != nil { - t.Fatal(err, " pass:", i) + t.Fatalf("Error: %v, pass: %d\n", err, i) } tasks = append(tasks, task) } _, err = c.getTask() if err == nil { - t.Fatal("Should get error. Pass:", i) + t.Fatalf("Should get error, pass: %d\n", i) } err = c.taskFinished(tasks[0].ID) if err != nil { - t.Fatal(err, "pass:", i) + t.Fatalf("Error: %v, pass: %d\n", err, i) } tasks = tasks[1:] task, err := c.getTask() @@ -109,7 +110,7 @@ func TestGetFinishTask(t *testing.T) { for _, task := range tasks { err = c.taskFinished(task.ID) if err != nil { - t.Fatal(err, " pass:", i) + t.Fatalf("Error: %v, pass: %d\n", err, i) } } } diff --git a/go/master/service.go b/go/master/service.go index 2e165138f..55e1e2d1a 100644 --- a/go/master/service.go +++ b/go/master/service.go @@ -207,12 +207,12 @@ func (s *Service) checkTimeoutFunc(taskID int, epoch int) func() { t.NumTimeout++ if t.NumTimeout > s.timeoutMax { - log.Warningf("Task %v failed %d times, discard.\n", t.Task, t.NumTimeout) + log.Warningf("Task %v timed out %d times, discard.\n", t.Task, t.NumTimeout) s.taskQueues.Failed = append(s.taskQueues.Failed, t.Task) return } - log.Warningf("Task %v failed %d times, retry.\n", t.Task, t.NumTimeout) + log.Warningf("Task %v timed out %d times, retry.\n", t.Task, t.NumTimeout) s.taskQueues.Todo = append(s.taskQueues.Todo, t) } } diff --git a/go/pserver/cclient/test/main.c b/go/pserver/cclient/test/main.c index 07e1b86b4..03f749d4e 100644 --- a/go/pserver/cclient/test/main.c +++ b/go/pserver/cclient/test/main.c @@ -1,4 +1,5 @@ #include +#include #include "libpaddle_pserver_cclient.h" -- GitLab