Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
4970484d
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
4970484d
编写于
6月 15, 2017
作者:
H
Helin Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
improve comment, fix build error
上级
7b9080ef
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
11 addition
and
7 deletion
+11
-7
go/master/client.go
go/master/client.go
+3
-1
go/master/client_internal_test.go
go/master/client_internal_test.go
+5
-4
go/master/service.go
go/master/service.go
+2
-2
go/pserver/cclient/test/main.c
go/pserver/cclient/test/main.c
+1
-0
未找到文件。
go/master/client.go
浏览文件 @
4970484d
...
@@ -34,6 +34,8 @@ func (c *Client) getRecords() {
...
@@ -34,6 +34,8 @@ func (c *Client) getRecords() {
for
{
for
{
t
,
err
:=
c
.
getTask
()
t
,
err
:=
c
.
getTask
()
if
err
!=
nil
{
if
err
!=
nil
{
// TODO(helin): wait before move on with next
// getTask call.
log
.
Println
(
err
)
log
.
Println
(
err
)
continue
continue
}
}
...
@@ -125,7 +127,7 @@ func (c *Client) taskFinished(taskID int) error {
...
@@ -125,7 +127,7 @@ func (c *Client) taskFinished(taskID int) error {
// NextRecord returns next record in the dataset.
// 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.
// thread-safe.
func
(
c
*
Client
)
NextRecord
()
[]
byte
{
func
(
c
*
Client
)
NextRecord
()
[]
byte
{
return
<-
c
.
ch
return
<-
c
.
ch
...
...
go/master/client_internal_test.go
浏览文件 @
4970484d
...
@@ -75,6 +75,7 @@ func TestGetFinishTask(t *testing.T) {
...
@@ -75,6 +75,7 @@ func TestGetFinishTask(t *testing.T) {
}
}
f
.
Close
()
f
.
Close
()
// Manually intialize client to avoid calling c.getRecords()
c
:=
&
Client
{}
c
:=
&
Client
{}
c
.
conn
=
connection
.
New
()
c
.
conn
=
connection
.
New
()
go
c
.
monitorMaster
(
TestAddresser
(
fmt
.
Sprintf
(
":%d"
,
p
)))
go
c
.
monitorMaster
(
TestAddresser
(
fmt
.
Sprintf
(
":%d"
,
p
)))
...
@@ -85,19 +86,19 @@ func TestGetFinishTask(t *testing.T) {
...
@@ -85,19 +86,19 @@ func TestGetFinishTask(t *testing.T) {
for
idx
:=
0
;
idx
<
totalTask
;
idx
++
{
for
idx
:=
0
;
idx
<
totalTask
;
idx
++
{
task
,
err
:=
c
.
getTask
()
task
,
err
:=
c
.
getTask
()
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
,
" pass:"
,
i
)
t
.
Fatal
f
(
"Error: %v, pass: %d
\n
"
,
err
,
i
)
}
}
tasks
=
append
(
tasks
,
task
)
tasks
=
append
(
tasks
,
task
)
}
}
_
,
err
=
c
.
getTask
()
_
,
err
=
c
.
getTask
()
if
err
==
nil
{
if
err
==
nil
{
t
.
Fatal
(
"Should get error. Pass:
"
,
i
)
t
.
Fatal
f
(
"Should get error, pass: %d
\n
"
,
i
)
}
}
err
=
c
.
taskFinished
(
tasks
[
0
]
.
ID
)
err
=
c
.
taskFinished
(
tasks
[
0
]
.
ID
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
,
"pass:"
,
i
)
t
.
Fatal
f
(
"Error: %v, pass: %d
\n
"
,
err
,
i
)
}
}
tasks
=
tasks
[
1
:
]
tasks
=
tasks
[
1
:
]
task
,
err
:=
c
.
getTask
()
task
,
err
:=
c
.
getTask
()
...
@@ -109,7 +110,7 @@ func TestGetFinishTask(t *testing.T) {
...
@@ -109,7 +110,7 @@ func TestGetFinishTask(t *testing.T) {
for
_
,
task
:=
range
tasks
{
for
_
,
task
:=
range
tasks
{
err
=
c
.
taskFinished
(
task
.
ID
)
err
=
c
.
taskFinished
(
task
.
ID
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
,
" pass:"
,
i
)
t
.
Fatal
f
(
"Error: %v, pass: %d
\n
"
,
err
,
i
)
}
}
}
}
}
}
...
...
go/master/service.go
浏览文件 @
4970484d
...
@@ -207,12 +207,12 @@ func (s *Service) checkTimeoutFunc(taskID int, epoch int) func() {
...
@@ -207,12 +207,12 @@ func (s *Service) checkTimeoutFunc(taskID int, epoch int) func() {
t
.
NumTimeout
++
t
.
NumTimeout
++
if
t
.
NumTimeout
>
s
.
timeoutMax
{
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
)
s
.
taskQueues
.
Failed
=
append
(
s
.
taskQueues
.
Failed
,
t
.
Task
)
return
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
)
s
.
taskQueues
.
Todo
=
append
(
s
.
taskQueues
.
Todo
,
t
)
}
}
}
}
...
...
go/pserver/cclient/test/main.c
浏览文件 @
4970484d
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include "libpaddle_pserver_cclient.h"
#include "libpaddle_pserver_cclient.h"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录