Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
d62fab02
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2301
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看板
未验证
提交
d62fab02
编写于
4月 24, 2023
作者:
C
Chitsing KUI
提交者:
GitHub
4月 24, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[LAUNCH] save env log for each worker (#53207) (#53236)
* save env log for each worker * fix ut
上级
12faca53
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
41 addition
and
1 deletion
+41
-1
python/paddle/distributed/launch/controllers/controller.py
python/paddle/distributed/launch/controllers/controller.py
+34
-0
python/paddle/distributed/launch/job/container.py
python/paddle/distributed/launch/job/container.py
+4
-0
python/paddle/fluid/tests/unittests/test_run.py
python/paddle/fluid/tests/unittests/test_run.py
+3
-1
未找到文件。
python/paddle/distributed/launch/controllers/controller.py
浏览文件 @
d62fab02
...
@@ -65,6 +65,7 @@ class ControllerBase:
...
@@ -65,6 +65,7 @@ class ControllerBase:
if
len
(
self
.
pod
.
containers
)
>
0
:
if
len
(
self
.
pod
.
containers
)
>
0
:
self
.
ctx
.
logger
.
debug
(
self
.
pod
.
containers
[
0
])
self
.
ctx
.
logger
.
debug
(
self
.
pod
.
containers
[
0
])
self
.
save_pod_env
()
self
.
ctx
.
status
.
run
()
self
.
ctx
.
status
.
run
()
self
.
pod
.
deploy
()
self
.
pod
.
deploy
()
...
@@ -254,6 +255,39 @@ class Controller(ControllerBase):
...
@@ -254,6 +255,39 @@ class Controller(ControllerBase):
try
:
try
:
os
.
makedirs
(
os
.
path
.
dirname
(
f
),
exist_ok
=
True
)
os
.
makedirs
(
os
.
path
.
dirname
(
f
),
exist_ok
=
True
)
with
open
(
f
,
'a+'
)
as
fd
:
with
open
(
f
,
'a+'
)
as
fd
:
if
fd
.
tell
()
==
0
:
fd
.
write
(
str
(
os
.
environ
))
fd
.
write
(
"
\n
"
)
fd
.
write
(
str
(
info
))
fd
.
write
(
str
(
info
))
fd
.
write
(
"
\n
"
)
except
Exception
as
e
:
except
Exception
as
e
:
self
.
ctx
.
logger
.
error
(
f
"save log failed because
{
e
}
"
)
self
.
ctx
.
logger
.
error
(
f
"save log failed because
{
e
}
"
)
def
save_pod_env
(
self
):
assert
(
len
(
self
.
pod
.
containers
)
+
len
(
self
.
pod
.
init_containers
)
>
0
),
"No container in the pod"
if
not
self
.
ctx
.
args
.
log_dir
:
return
for
c
in
self
.
pod
.
init_containers
:
self
.
_save_container_env
(
c
,
is_init
=
True
)
for
c
in
self
.
pod
.
containers
:
self
.
_save_container_env
(
c
)
def
_save_container_env
(
self
,
container
,
is_init
=
False
):
f
=
os
.
path
.
join
(
self
.
ctx
.
args
.
log_dir
,
f
'envlog.init.
{
container
.
rank
}
'
if
is_init
else
f
'envlog.
{
container
.
rank
}
'
,
)
try
:
os
.
makedirs
(
os
.
path
.
dirname
(
f
),
exist_ok
=
True
)
with
open
(
f
,
'w'
)
as
fd
:
for
k
,
v
in
sorted
(
container
.
env
.
items
()):
fd
.
write
(
str
(
f
"
{
k
}
=
{
v
}
\n
"
))
except
Exception
as
e
:
self
.
ctx
.
logger
.
error
(
f
"save pod env log failed because
{
e
}
"
)
python/paddle/distributed/launch/job/container.py
浏览文件 @
d62fab02
...
@@ -39,6 +39,10 @@ class Container:
...
@@ -39,6 +39,10 @@ class Container:
self
.
_log_handler
=
None
self
.
_log_handler
=
None
self
.
_shell
=
False
self
.
_shell
=
False
@
property
def
env
(
self
):
return
self
.
_env
@
property
@
property
def
entrypoint
(
self
):
def
entrypoint
(
self
):
return
self
.
_entrypoint
return
self
.
_entrypoint
...
...
python/paddle/fluid/tests/unittests/test_run.py
浏览文件 @
d62fab02
...
@@ -52,7 +52,9 @@ def get_files(pth, prefix):
...
@@ -52,7 +52,9 @@ def get_files(pth, prefix):
return
[
return
[
f
f
for
f
in
listdir
(
pth
)
for
f
in
listdir
(
pth
)
if
isfile
(
join
(
pth
,
f
))
and
not
f
.
endswith
(
'gpu.log'
)
if
isfile
(
join
(
pth
,
f
))
and
not
f
.
endswith
(
'gpu.log'
)
and
not
f
.
startswith
(
'envlog'
)
]
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录