Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
9bd74dda
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9bd74dda
编写于
6月 12, 2017
作者:
H
Helin Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix some linter warnings
上级
41af738a
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
15 addition
and
8 deletion
+15
-8
go/connection/conn.go
go/connection/conn.go
+6
-1
go/master/service.go
go/master/service.go
+0
-1
go/pserver/client.go
go/pserver/client.go
+1
-1
go/pserver/service_test.go
go/pserver/service_test.go
+8
-5
未找到文件。
go/connection/conn.go
浏览文件 @
9bd74dda
...
@@ -2,6 +2,7 @@ package connection
...
@@ -2,6 +2,7 @@ package connection
import
(
import
(
"errors"
"errors"
"log"
"net/rpc"
"net/rpc"
"sync"
"sync"
)
)
...
@@ -62,7 +63,11 @@ func (c *Conn) Connect(addr string) error {
...
@@ -62,7 +63,11 @@ func (c *Conn) Connect(addr string) error {
c
.
waitConn
=
nil
c
.
waitConn
=
nil
}
}
}
else
{
}
else
{
client
.
Close
()
err
:=
client
.
Close
()
if
err
!=
nil
{
log
.
Println
(
err
)
}
return
errors
.
New
(
"client already set from a concurrent goroutine"
)
return
errors
.
New
(
"client already set from a concurrent goroutine"
)
}
}
...
...
go/master/service.go
浏览文件 @
9bd74dda
...
@@ -50,7 +50,6 @@ func partition(chunks []Chunk, chunksPerTask int) []taskEntry {
...
@@ -50,7 +50,6 @@ func partition(chunks []Chunk, chunksPerTask int) []taskEntry {
if
len
(
cur
.
Task
.
Chunks
)
>
0
{
if
len
(
cur
.
Task
.
Chunks
)
>
0
{
cur
.
Task
.
ID
=
id
cur
.
Task
.
ID
=
id
id
++
result
=
append
(
result
,
cur
)
result
=
append
(
result
,
cur
)
}
}
...
...
go/pserver/client.go
浏览文件 @
9bd74dda
...
@@ -83,7 +83,7 @@ func (c *Client) monitorPservers(l Lister, pserverNum int) {
...
@@ -83,7 +83,7 @@ func (c *Client) monitorPservers(l Lister, pserverNum int) {
}
}
monitor
()
monitor
()
for
_
=
range
ticker
.
C
{
for
range
ticker
.
C
{
monitor
()
monitor
()
}
}
}
}
...
...
go/pserver/service_test.go
浏览文件 @
9bd74dda
...
@@ -15,7 +15,7 @@ func TestFull(t *testing.T) {
...
@@ -15,7 +15,7 @@ func TestFull(t *testing.T) {
p
.
Name
=
"param_a"
p
.
Name
=
"param_a"
p
.
Content
=
[]
byte
{
1
,
0
,
0
,
0
,
2
,
0
,
0
,
0
,
3
,
0
,
0
,
0
}
p
.
Content
=
[]
byte
{
1
,
0
,
0
,
0
,
2
,
0
,
0
,
0
,
3
,
0
,
0
,
0
}
p
.
ElementType
=
pserver
.
Int32
p
.
ElementType
=
pserver
.
Int32
err
:=
s
.
InitParam
(
pserver
.
ParameterWithConfig
{
p
,
nil
},
nil
)
err
:=
s
.
InitParam
(
pserver
.
ParameterWithConfig
{
Param
:
p
,
Config
:
nil
},
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
FailNow
()
t
.
FailNow
()
}
}
...
@@ -24,7 +24,7 @@ func TestFull(t *testing.T) {
...
@@ -24,7 +24,7 @@ func TestFull(t *testing.T) {
p1
.
Name
=
"param_b"
p1
.
Name
=
"param_b"
p1
.
Content
=
[]
byte
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
}
p1
.
Content
=
[]
byte
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
}
p1
.
ElementType
=
pserver
.
Float32
p1
.
ElementType
=
pserver
.
Float32
err
=
s
.
InitParam
(
pserver
.
ParameterWithConfig
{
p1
,
nil
},
nil
)
err
=
s
.
InitParam
(
pserver
.
ParameterWithConfig
{
Param
:
p1
,
Config
:
nil
},
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
FailNow
()
t
.
FailNow
()
}
}
...
@@ -95,13 +95,14 @@ func TestUninitialized(t *testing.T) {
...
@@ -95,13 +95,14 @@ func TestUninitialized(t *testing.T) {
func
TestBlockUntilInitialized
(
t
*
testing
.
T
)
{
func
TestBlockUntilInitialized
(
t
*
testing
.
T
)
{
s
:=
pserver
.
NewService
()
s
:=
pserver
.
NewService
()
ch
:=
make
(
chan
struct
{},
2
)
ch
:=
make
(
chan
struct
{},
2
)
errCh
:=
make
(
chan
error
,
2
)
var
wg
sync
.
WaitGroup
var
wg
sync
.
WaitGroup
wg
.
Add
(
1
)
wg
.
Add
(
1
)
go
func
()
{
go
func
()
{
var
param
pserver
.
Parameter
var
param
pserver
.
Parameter
err
:=
s
.
GetParam
(
"param_a"
,
&
param
)
err
:=
s
.
GetParam
(
"param_a"
,
&
param
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
FailNow
()
errCh
<-
err
}
}
wg
.
Done
()
wg
.
Done
()
ch
<-
struct
{}{}
ch
<-
struct
{}{}
...
@@ -111,7 +112,7 @@ func TestBlockUntilInitialized(t *testing.T) {
...
@@ -111,7 +112,7 @@ func TestBlockUntilInitialized(t *testing.T) {
go
func
()
{
go
func
()
{
err
:=
s
.
Save
(
""
,
nil
)
err
:=
s
.
Save
(
""
,
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
FailNow
()
errCh
<-
err
}
}
wg
.
Done
()
wg
.
Done
()
ch
<-
struct
{}{}
ch
<-
struct
{}{}
...
@@ -123,6 +124,8 @@ func TestBlockUntilInitialized(t *testing.T) {
...
@@ -123,6 +124,8 @@ func TestBlockUntilInitialized(t *testing.T) {
case
<-
ch
:
case
<-
ch
:
// some function returned before initialization is completed.
// some function returned before initialization is completed.
t
.
FailNow
()
t
.
FailNow
()
case
<-
errCh
:
t
.
FailNow
()
default
:
default
:
}
}
...
@@ -130,7 +133,7 @@ func TestBlockUntilInitialized(t *testing.T) {
...
@@ -130,7 +133,7 @@ func TestBlockUntilInitialized(t *testing.T) {
p
.
Name
=
"param_a"
p
.
Name
=
"param_a"
p
.
Content
=
[]
byte
{
1
,
0
,
0
,
0
,
2
,
0
,
0
,
0
,
3
,
0
,
0
,
0
}
p
.
Content
=
[]
byte
{
1
,
0
,
0
,
0
,
2
,
0
,
0
,
0
,
3
,
0
,
0
,
0
}
p
.
ElementType
=
pserver
.
Int32
p
.
ElementType
=
pserver
.
Int32
err
:=
s
.
InitParam
(
pserver
.
ParameterWithConfig
{
p
,
nil
},
nil
)
err
:=
s
.
InitParam
(
pserver
.
ParameterWithConfig
{
Param
:
p
,
Config
:
nil
},
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
FailNow
()
t
.
FailNow
()
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录