Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
108b0fad
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看板
提交
108b0fad
编写于
7月 06, 2017
作者:
G
gongweibao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix by helin and wuyi's comments
上级
52cc601b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
18 addition
and
19 deletion
+18
-19
go/master/service.go
go/master/service.go
+18
-19
未找到文件。
go/master/service.go
浏览文件 @
108b0fad
...
...
@@ -39,9 +39,9 @@ type Task struct {
}
type
taskEntry
struct
{
NumTimeout
int
Task
Task
NumFail
ed
int
Task
Task
// A task fails if it's timeout or trainer reports it exits unnormally.
NumFail
ure
int
}
type
taskQueues
struct
{
...
...
@@ -53,11 +53,11 @@ type taskQueues struct {
// Service is the master server service.
type
Service
struct
{
chunksPerTask
int
timeoutDur
time
.
Duration
fail
ortimeoutMax
int
ready
chan
struct
{}
store
Store
chunksPerTask
int
timeoutDur
time
.
Duration
fail
ureMax
int
ready
chan
struct
{}
store
Store
mu
sync
.
Mutex
initDone
bool
...
...
@@ -92,11 +92,11 @@ func partition(chunks []Chunk, chunksPerTask int) []taskEntry {
}
// NewService creates a new service.
func
NewService
(
store
Store
,
chunksPerTask
int
,
timeoutDur
time
.
Duration
,
fail
ortimeout
Max
int
)
(
*
Service
,
error
)
{
func
NewService
(
store
Store
,
chunksPerTask
int
,
timeoutDur
time
.
Duration
,
fail
ure
Max
int
)
(
*
Service
,
error
)
{
s
:=
&
Service
{}
s
.
chunksPerTask
=
chunksPerTask
s
.
timeoutDur
=
timeoutDur
s
.
fail
ortimeoutMax
=
failortimeout
Max
s
.
fail
ureMax
=
failure
Max
s
.
taskQueues
=
taskQueues
{}
s
.
taskQueues
.
Pending
=
make
(
map
[
int
]
taskEntry
)
s
.
ready
=
make
(
chan
struct
{})
...
...
@@ -258,7 +258,7 @@ func (s *Service) SetDataset(globPaths []string, dummy *int) error {
return
nil
}
func
(
s
*
Service
)
checkTaskStatus
(
t
taskEntry
,
epoch
int
)
{
func
(
s
*
Service
)
procFailedTask
(
t
taskEntry
,
epoch
int
)
{
if
t
.
Task
.
Epoch
!=
epoch
{
// new epoch, task launched after the
// schedule of this timeout check or failed status report.
...
...
@@ -274,14 +274,14 @@ func (s *Service) checkTaskStatus(t taskEntry, epoch int) {
delete
(
s
.
taskQueues
.
Pending
,
t
.
Task
.
ID
)
t
.
Num
Timeout
++
if
t
.
Num
Timeout
+
t
.
NumFailed
>
s
.
failortimeout
Max
{
log
.
Warningf
(
"Task %v
timed out %d times and failed %d times, discard."
,
t
.
Task
,
t
.
NumTimeout
,
t
.
NumFailed
)
t
.
Num
Failure
++
if
t
.
Num
Failure
>
s
.
failure
Max
{
log
.
Warningf
(
"Task %v
failed %d times, discard."
,
t
.
Task
,
t
.
NumFailure
)
s
.
taskQueues
.
Failed
=
append
(
s
.
taskQueues
.
Failed
,
t
)
return
}
log
.
Warningf
(
"Task %v
timed out %d times and failed %d times, discard."
,
t
.
Task
,
t
.
NumTimeout
,
t
.
NumFailed
)
log
.
Warningf
(
"Task %v
failed %d times, discard."
,
t
.
Task
,
t
.
NumFailure
)
s
.
taskQueues
.
Todo
=
append
(
s
.
taskQueues
.
Todo
,
t
)
return
}
...
...
@@ -296,7 +296,7 @@ func (s *Service) checkTimeoutFunc(taskID int, epoch int) func() {
return
}
s
.
checkTaskStatus
(
t
,
epoch
)
s
.
procFailedTask
(
t
,
epoch
)
}
}
...
...
@@ -377,8 +377,7 @@ func (s *Service) TaskFinished(taskID int, dummy *int) error {
}
// task finished, reset timeout
t
.
NumTimeout
=
0
t
.
NumFailed
=
0
t
.
NumFailure
=
0
s
.
taskQueues
.
Done
=
append
(
s
.
taskQueues
.
Done
,
t
)
delete
(
s
.
taskQueues
.
Pending
,
taskID
)
...
...
@@ -413,6 +412,6 @@ func (s *Service) TaskFailed(taskID int, epoch int) error {
return
err
}
s
.
checkTaskStatus
(
t
,
epoch
)
s
.
procFailedTask
(
t
,
epoch
)
return
nil
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录