Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
tensorflow
提交
12890338
T
tensorflow
项目概览
xxadev
/
tensorflow
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
tensorflow
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
12890338
编写于
10月 10, 2018
作者:
R
Russell Power
提交者:
TensorFlower Gardener
10月 10, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Turn on worker watchdog in TPUEstimator.
PiperOrigin-RevId: 216618378
上级
9bad98c6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
24 addition
and
0 deletion
+24
-0
tensorflow/contrib/tpu/python/tpu/session_support.py
tensorflow/contrib/tpu/python/tpu/session_support.py
+18
-0
tensorflow/contrib/tpu/python/tpu/tpu_estimator.py
tensorflow/contrib/tpu/python/tpu/tpu_estimator.py
+6
-0
未找到文件。
tensorflow/contrib/tpu/python/tpu/session_support.py
浏览文件 @
12890338
...
...
@@ -35,6 +35,8 @@ from tensorflow.python.platform import tf_logging as logging
from
tensorflow.python.training
import
session_run_hook
from
tensorflow.python.training
import
training_util
_WATCHDOG
=
None
class
CoordinatorShutdownException
(
Exception
):
"""Raised when the coordinator needs to shutdown."""
...
...
@@ -256,6 +258,22 @@ class WatchdogManager(threading.Thread):
time
.
sleep
(
self
.
ping_interval
)
def
start_worker_watchdog
(
session
,
devices
=
None
,
ping_interval
=
60
,
shutdown_timeout
=
3600
):
"""Start global worker watchdog to shutdown workers on coordinator exit."""
global
_WATCHDOG
if
_WATCHDOG
is
None
:
# Ensure we can send a few pings before we timeout!
ping_interval
=
min
(
shutdown_timeout
/
10.
,
ping_interval
)
logging
.
info
(
'Enabling watchdog timer with %d second timeout'
,
shutdown_timeout
)
_WATCHDOG
=
WatchdogManager
(
session
,
devices
,
ping_interval
,
shutdown_timeout
)
_WATCHDOG
.
configure_and_run
()
class
GracefulShutdownHook
(
session_run_hook
.
SessionRunHook
):
"""Session hook that watches for shutdown events.
...
...
tensorflow/contrib/tpu/python/tpu/tpu_estimator.py
浏览文件 @
12890338
...
...
@@ -480,6 +480,12 @@ class TPUInfeedOutfeedSessionHook(session_run_hook.SessionRunHook):
self
.
_outfeed_controller
=
_OpQueueContext
(
name
=
'OutfeedController'
,
target
=
self
.
_run_outfeed
,
args
=
(
session
,))
# Enable the worker watchdog to terminate workers on coordinator exit.
watchdog_timeout
=
int
(
os
.
environ
.
get
(
'TF_TPU_WATCHDOG_TIMEOUT'
,
'0'
))
if
watchdog_timeout
>
0
:
session_support
.
start_worker_watchdog
(
session
,
shutdown_timeout
=
watchdog_timeout
)
def
before_run
(
self
,
run_context
):
self
.
_feed_error
=
None
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录