提交 4970484d 编写于 作者: H Helin Wang

improve comment, fix build error

上级 7b9080ef
......@@ -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
......
......@@ -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)
}
}
}
......
......@@ -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)
}
}
......
#include <stdio.h>
#include <stdlib.h>
#include "libpaddle_pserver_cclient.h"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册