提交 b3c5808e 编写于 作者: G gongweibao

rm cloud EOF

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