Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PARL
提交
0ebb57de
P
PARL
项目概览
PaddlePaddle
/
PARL
通知
67
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
3
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PARL
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
3
合并请求
3
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
0ebb57de
编写于
8月 19, 2020
作者:
B
Bo Zhou
提交者:
GitHub
8月 19, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
comiit (#392)
上级
78417815
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
19 addition
and
15 deletion
+19
-15
parl/remote/scripts.py
parl/remote/scripts.py
+11
-5
parl/remote/tests/log_server_test.py
parl/remote/tests/log_server_test.py
+1
-4
parl/remote/tests/reset_job_test.py
parl/remote/tests/reset_job_test.py
+1
-1
parl/remote/worker.py
parl/remote/worker.py
+6
-5
未找到文件。
parl/remote/scripts.py
浏览文件 @
0ebb57de
...
@@ -171,22 +171,28 @@ def start_master(port, cpu_num, monitor_port, debug, log_server_port_range):
...
@@ -171,22 +171,28 @@ def start_master(port, cpu_num, monitor_port, debug, log_server_port_range):
# Redirect the output to DEVNULL to solve the warning log.
# Redirect the output to DEVNULL to solve the warning log.
_
=
subprocess
.
Popen
(
_
=
subprocess
.
Popen
(
master_command
,
stdout
=
FNULL
,
stderr
=
subprocess
.
STDOUT
)
master_command
,
stdout
=
FNULL
,
stderr
=
subprocess
.
STDOUT
,
close_fds
=
True
)
if
cpu_num
>
0
:
if
cpu_num
>
0
:
# Sleep 1s for master ready
# Sleep 1s for master ready
time
.
sleep
(
1
)
time
.
sleep
(
1
)
_
=
subprocess
.
Popen
(
_
=
subprocess
.
Popen
(
worker_command
,
stdout
=
FNULL
,
stderr
=
subprocess
.
STDOUT
)
worker_command
,
stdout
=
FNULL
,
stderr
=
subprocess
.
STDOUT
,
close_fds
=
True
)
if
_IS_WINDOWS
:
if
_IS_WINDOWS
:
# TODO(@zenghsh3) redirecting stdout of monitor subprocess to FNULL will cause occasional failure
# TODO(@zenghsh3) redirecting stdout of monitor subprocess to FNULL will cause occasional failure
tmp_file
=
tempfile
.
TemporaryFile
()
tmp_file
=
tempfile
.
TemporaryFile
()
_
=
subprocess
.
Popen
(
monitor_command
,
stdout
=
tmp_file
)
_
=
subprocess
.
Popen
(
monitor_command
,
stdout
=
tmp_file
,
close_fds
=
True
)
tmp_file
.
close
()
tmp_file
.
close
()
else
:
else
:
_
=
subprocess
.
Popen
(
_
=
subprocess
.
Popen
(
monitor_command
,
stdout
=
FNULL
,
stderr
=
subprocess
.
STDOUT
)
monitor_command
,
stdout
=
FNULL
,
stderr
=
subprocess
.
STDOUT
,
close_fds
=
True
)
FNULL
.
close
()
FNULL
.
close
()
if
cpu_num
>
0
:
if
cpu_num
>
0
:
...
@@ -285,7 +291,7 @@ def start_worker(address, cpu_num, log_server_port_range):
...
@@ -285,7 +291,7 @@ def start_worker(address, cpu_num, log_server_port_range):
str
(
cpu_num
),
"--log_server_port"
,
str
(
cpu_num
),
"--log_server_port"
,
str
(
log_server_port
)
str
(
log_server_port
)
]
]
p
=
subprocess
.
Popen
(
command
)
p
=
subprocess
.
Popen
(
command
,
close_fds
=
True
)
if
not
is_log_server_started
(
get_ip_address
(),
log_server_port
):
if
not
is_log_server_started
(
get_ip_address
(),
log_server_port
):
click
.
echo
(
"# Fail to start the log server."
)
click
.
echo
(
"# Fail to start the log server."
)
...
...
parl/remote/tests/log_server_test.py
浏览文件 @
0ebb57de
...
@@ -138,10 +138,7 @@ class TestLogServer(unittest.TestCase):
...
@@ -138,10 +138,7 @@ class TestLogServer(unittest.TestCase):
else
:
else
:
FNULL
=
open
(
os
.
devnull
,
'w'
)
FNULL
=
open
(
os
.
devnull
,
'w'
)
monitor_proc
=
subprocess
.
Popen
(
monitor_proc
=
subprocess
.
Popen
(
command
,
command
,
stdout
=
FNULL
,
stderr
=
subprocess
.
STDOUT
,
close_fds
=
True
)
stdout
=
FNULL
,
stderr
=
subprocess
.
STDOUT
,
)
# Start worker
# Start worker
cluster_addr
=
'localhost:{}'
.
format
(
master_port
)
cluster_addr
=
'localhost:{}'
.
format
(
master_port
)
...
...
parl/remote/tests/reset_job_test.py
浏览文件 @
0ebb57de
...
@@ -69,7 +69,7 @@ class TestJob(unittest.TestCase):
...
@@ -69,7 +69,7 @@ class TestJob(unittest.TestCase):
file_path
=
__file__
.
replace
(
'reset_job_test'
,
'simulate_client'
)
file_path
=
__file__
.
replace
(
'reset_job_test'
,
'simulate_client'
)
command
=
[
sys
.
executable
,
file_path
]
command
=
[
sys
.
executable
,
file_path
]
proc
=
subprocess
.
Popen
(
command
)
proc
=
subprocess
.
Popen
(
command
,
close_fds
=
True
)
for
_
in
range
(
6
):
for
_
in
range
(
6
):
if
master
.
cpu_num
==
0
:
if
master
.
cpu_num
==
0
:
break
break
...
...
parl/remote/worker.py
浏览文件 @
0ebb57de
...
@@ -227,7 +227,11 @@ class Worker(object):
...
@@ -227,7 +227,11 @@ class Worker(object):
# Redirect the output to DEVNULL
# Redirect the output to DEVNULL
FNULL
=
open
(
os
.
devnull
,
'w'
)
FNULL
=
open
(
os
.
devnull
,
'w'
)
for
_
in
range
(
job_num
):
for
_
in
range
(
job_num
):
subprocess
.
Popen
(
command
,
stdout
=
FNULL
,
stderr
=
subprocess
.
STDOUT
)
subprocess
.
Popen
(
command
,
stdout
=
FNULL
,
stderr
=
subprocess
.
STDOUT
,
close_fds
=
True
)
FNULL
.
close
()
FNULL
.
close
()
new_jobs
=
[]
new_jobs
=
[]
...
@@ -402,10 +406,7 @@ class Worker(object):
...
@@ -402,10 +406,7 @@ class Worker(object):
else
:
else
:
FNULL
=
open
(
os
.
devnull
,
'w'
)
FNULL
=
open
(
os
.
devnull
,
'w'
)
log_server_proc
=
subprocess
.
Popen
(
log_server_proc
=
subprocess
.
Popen
(
command
,
command
,
stdout
=
FNULL
,
stderr
=
subprocess
.
STDOUT
,
close_fds
=
True
)
stdout
=
FNULL
,
stderr
=
subprocess
.
STDOUT
,
)
FNULL
.
close
()
FNULL
.
close
()
log_server_address
=
"{}:{}"
.
format
(
self
.
worker_ip
,
port
)
log_server_address
=
"{}:{}"
.
format
(
self
.
worker_ip
,
port
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录