提交 b3c5808e 编写于 作者: G gongweibao

rm cloud EOF

上级 b79784ee
...@@ -13,7 +13,6 @@ typedef int paddle_master_client; ...@@ -13,7 +13,6 @@ typedef int paddle_master_client;
import "C" import "C"
import ( import (
"io"
"sync" "sync"
"unsafe" "unsafe"
...@@ -93,12 +92,6 @@ func paddle_set_dataset(client C.paddle_master_client, path **C.char, size C.int ...@@ -93,12 +92,6 @@ func paddle_set_dataset(client C.paddle_master_client, path **C.char, size C.int
func paddle_next_record(client C.paddle_master_client, record **C.uchar) C.int { func paddle_next_record(client C.paddle_master_client, record **C.uchar) C.int {
c := get(client) c := get(client)
r, err := c.NextRecord() r, err := c.NextRecord()
if err == io.EOF {
// EOF
*record = (*C.uchar)(nullPtr)
return -1
}
if err != nil { if err != nil {
// Error // Error
// TODO: return the type of error? // TODO: return the type of error?
......
package master package master
import ( import (
"io"
"os" "os"
"time" "time"
...@@ -70,8 +69,6 @@ func (c *Client) getRecords() { ...@@ -70,8 +69,6 @@ func (c *Client) getRecords() {
if err != nil { if err != nil {
log.Errorln(err) log.Errorln(err)
} }
c.ch <- record{nil, io.EOF}
} }
// We treat a task as finished whenever the last data // We treat a task as finished whenever the last data
......
...@@ -2,7 +2,6 @@ package master_test ...@@ -2,7 +2,6 @@ package master_test
import ( import (
"fmt" "fmt"
"io"
"net" "net"
"net/http" "net/http"
"net/rpc" "net/rpc"
...@@ -70,12 +69,8 @@ func TestNextRecord(t *testing.T) { ...@@ -70,12 +69,8 @@ func TestNextRecord(t *testing.T) {
for pass := 0; pass < 50; pass++ { for pass := 0; pass < 50; pass++ {
received := make(map[byte]bool) received := make(map[byte]bool)
for i := 0; i <= total; i++ { for i := 0; i < total; i++ {
r, err := c.NextRecord() r, err := c.NextRecord()
if err == io.EOF {
break
}
if err != nil { if err != nil {
t.Fatal(pass, i, "Read error:", err) t.Fatal(pass, i, "Read error:", err)
} }
......
...@@ -28,16 +28,11 @@ class client(object): ...@@ -28,16 +28,11 @@ class client(object):
# return format: (record, errno) # return format: (record, errno)
# errno = 0: ok # errno = 0: ok
# = -1: EOF
# < -1: error # < -1: error
def next_record(self): def next_record(self):
p = ctypes.c_char_p() p = ctypes.c_char_p()
ret = ctypes.pointer(p) ret = ctypes.pointer(p)
size = lib.paddle_next_record(self.c, ret) size = lib.paddle_next_record(self.c, ret)
if size == -1:
# EOF
return None, -1
if size < -1: if size < -1:
# Error # Error
return None, size return None, size
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册