Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
c2079443
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看板
未验证
提交
c2079443
编写于
3月 29, 2023
作者:
K
Kim
提交者:
GitHub
3月 29, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CodeStyle][PLR1722] replace `exit()` with `sys.exit()` (#52151)
* fix PLR1722 * fix issue * fix error
上级
df423557
变更
27
隐藏空白更改
内联
并排
Showing
27 changed file
with
50 addition
and
42 deletion
+50
-42
python/paddle/distributed/auto_parallel/tuner/profiler.py
python/paddle/distributed/auto_parallel/tuner/profiler.py
+2
-1
python/paddle/distributed/fleet/launch.py
python/paddle/distributed/fleet/launch.py
+1
-1
python/paddle/distributed/fleet/launch_utils.py
python/paddle/distributed/fleet/launch_utils.py
+2
-2
python/paddle/distributed/utils/launch_utils.py
python/paddle/distributed/utils/launch_utils.py
+2
-2
python/paddle/fluid/tests/cpp_extension/test_cpp_extension_jit.py
...addle/fluid/tests/cpp_extension/test_cpp_extension_jit.py
+1
-1
python/paddle/fluid/tests/cpp_extension/test_cpp_extension_setup.py
...dle/fluid/tests/cpp_extension/test_cpp_extension_setup.py
+1
-1
python/paddle/fluid/tests/custom_runtime/test_custom_cpu_plugin.py
...ddle/fluid/tests/custom_runtime/test_custom_cpu_plugin.py
+1
-1
python/paddle/fluid/tests/custom_runtime/test_custom_cpu_profiler_plugin.py
...d/tests/custom_runtime/test_custom_cpu_profiler_plugin.py
+1
-1
python/paddle/fluid/tests/custom_runtime/test_custom_cpu_to_static.py
...e/fluid/tests/custom_runtime/test_custom_cpu_to_static.py
+1
-1
python/paddle/fluid/tests/custom_runtime/test_custom_op_setup.py
...paddle/fluid/tests/custom_runtime/test_custom_op_setup.py
+1
-1
python/paddle/fluid/tests/unittests/dygraph_to_static/test_mobile_net.py
...luid/tests/unittests/dygraph_to_static/test_mobile_net.py
+2
-1
python/paddle/fluid/tests/unittests/multi_process.py
python/paddle/fluid/tests/unittests/multi_process.py
+1
-1
test/custom_kernel/test_custom_kernel_dot.py
test/custom_kernel/test_custom_kernel_dot.py
+1
-1
test/custom_kernel/test_custom_kernel_load.py
test/custom_kernel/test_custom_kernel_load.py
+1
-1
test/custom_op/test_custom_relu_op_xpu_setup.py
test/custom_op/test_custom_relu_op_xpu_setup.py
+1
-1
test/legacy_test/test_error_clip.py
test/legacy_test/test_error_clip.py
+4
-2
tools/check_ctest_hung.py
tools/check_ctest_hung.py
+1
-1
tools/check_op_benchmark_result.py
tools/check_op_benchmark_result.py
+3
-2
tools/check_ut.py
tools/check_ut.py
+3
-2
tools/continuous_integration/bisect.py
tools/continuous_integration/bisect.py
+2
-2
tools/coverage/coverage_diff.py
tools/coverage/coverage_diff.py
+1
-1
tools/coverage/coverage_diff_list.py
tools/coverage/coverage_diff_list.py
+1
-1
tools/coverage/coverage_lines.py
tools/coverage/coverage_lines.py
+4
-4
tools/gen_ut_cmakelists.py
tools/gen_ut_cmakelists.py
+2
-1
tools/get_pr_ut.py
tools/get_pr_ut.py
+5
-4
tools/sampcd_processor.py
tools/sampcd_processor.py
+4
-4
tools/test_runner.py
tools/test_runner.py
+1
-1
未找到文件。
python/paddle/distributed/auto_parallel/tuner/profiler.py
浏览文件 @
c2079443
...
...
@@ -16,6 +16,7 @@ import argparse
import
json
import
os
import
pickle
import
sys
import
time
import
traceback
...
...
@@ -291,7 +292,7 @@ def profiler(args):
data_loader
.
_inner_dataloader
.
reset
()
del
data_loader
.
_inner_dataloader
exit
(
1
)
sys
.
exit
(
1
)
data_loader
.
_inner_dataloader
.
reset
()
del
data_loader
.
_inner_dataloader
...
...
python/paddle/distributed/fleet/launch.py
浏览文件 @
c2079443
...
...
@@ -476,7 +476,7 @@ def launch_collective(args):
except
:
logger
.
warning
(
"Terminating... exit"
)
terminate_local_procs
(
procs
)
exit
(
1
)
sys
.
exit
(
1
)
if
os
.
path
.
exists
(
tmp_dir
):
shutil
.
rmtree
(
tmp_dir
)
...
...
python/paddle/distributed/fleet/launch_utils.py
浏览文件 @
c2079443
...
...
@@ -370,7 +370,7 @@ def terminate_local_procs(procs):
time
.
sleep
(
3
)
logger
.
fatal
(
"can't kill all process and exit"
)
exit
(
1
)
sys
.
exit
(
1
)
def
get_host_name_ip
():
...
...
@@ -678,7 +678,7 @@ def watch_local_trainers(procs, nranks):
if
error
:
terminate_local_procs
(
procs
)
exit
(
1
)
sys
.
exit
(
1
)
except
KeyboardInterrupt
:
logger
.
warning
(
"KeyboardInterrupt, exit"
)
...
...
python/paddle/distributed/utils/launch_utils.py
浏览文件 @
c2079443
...
...
@@ -354,7 +354,7 @@ def terminate_local_procs(procs):
time
.
sleep
(
3
)
logger
.
fatal
(
"can't kill all process and exit"
)
exit
(
1
)
sys
.
exit
(
1
)
def
get_host_name_ip
():
...
...
@@ -543,7 +543,7 @@ def watch_local_trainers(procs, nranks):
if
error
:
terminate_local_procs
(
procs
)
exit
(
1
)
sys
.
exit
(
1
)
except
KeyboardInterrupt
:
logger
.
warning
(
"KeyboardInterrupt, exit"
)
...
...
python/paddle/fluid/tests/cpp_extension/test_cpp_extension_jit.py
浏览文件 @
c2079443
...
...
@@ -24,7 +24,7 @@ from paddle.utils.cpp_extension import load
if
os
.
name
==
'nt'
or
sys
.
platform
.
startswith
(
'darwin'
):
# only support Linux now
exit
()
sys
.
exit
()
# Compile and load cpp extension Just-In-Time.
sources
=
[
"custom_extension.cc"
,
"custom_sub.cc"
]
...
...
python/paddle/fluid/tests/cpp_extension/test_cpp_extension_setup.py
浏览文件 @
c2079443
...
...
@@ -318,5 +318,5 @@ class TestCppExtensionSetupInstall(unittest.TestCase):
if
__name__
==
'__main__'
:
if
os
.
name
==
'nt'
or
sys
.
platform
.
startswith
(
'darwin'
):
# only support Linux now
exit
()
sys
.
exit
()
unittest
.
main
()
python/paddle/fluid/tests/custom_runtime/test_custom_cpu_plugin.py
浏览文件 @
c2079443
...
...
@@ -326,5 +326,5 @@ class TestCustomCPUPlugin(unittest.TestCase):
if
__name__
==
'__main__'
:
if
os
.
name
==
'nt'
or
sys
.
platform
.
startswith
(
'darwin'
):
# only support Linux now
exit
()
sys
.
exit
()
unittest
.
main
()
python/paddle/fluid/tests/custom_runtime/test_custom_cpu_profiler_plugin.py
浏览文件 @
c2079443
...
...
@@ -71,5 +71,5 @@ class TestCustomCPUProfilerPlugin(unittest.TestCase):
if
__name__
==
'__main__'
:
if
os
.
name
==
'nt'
or
sys
.
platform
.
startswith
(
'darwin'
):
# only support Linux now
exit
()
sys
.
exit
()
unittest
.
main
()
python/paddle/fluid/tests/custom_runtime/test_custom_cpu_to_static.py
浏览文件 @
c2079443
...
...
@@ -279,5 +279,5 @@ class TestCustomCPUPlugin(unittest.TestCase):
if
__name__
==
'__main__'
:
if
os
.
name
==
'nt'
or
sys
.
platform
.
startswith
(
'darwin'
):
# only support Linux now
exit
()
sys
.
exit
()
unittest
.
main
()
python/paddle/fluid/tests/custom_runtime/test_custom_op_setup.py
浏览文件 @
c2079443
...
...
@@ -284,5 +284,5 @@ class TestNewCustomOpSetUpInstall(unittest.TestCase):
if
__name__
==
"__main__"
:
if
os
.
name
==
'nt'
or
sys
.
platform
.
startswith
(
'darwin'
):
# only support Linux now
exit
()
sys
.
exit
()
unittest
.
main
()
python/paddle/fluid/tests/unittests/dygraph_to_static/test_mobile_net.py
浏览文件 @
c2079443
...
...
@@ -13,6 +13,7 @@
# limitations under the License.
import
os
import
sys
import
tempfile
import
time
import
unittest
...
...
@@ -508,7 +509,7 @@ def train_mobilenet(args, to_static):
print
(
"wrong model name, please try model = MobileNetV1 or MobileNetV2"
)
exit
()
sys
.
exit
()
optimizer
=
create_optimizer
(
args
=
args
,
parameter_list
=
net
.
parameters
())
...
...
python/paddle/fluid/tests/unittests/multi_process.py
浏览文件 @
c2079443
...
...
@@ -51,7 +51,7 @@ def train_abort(prefix):
if
trainer_id
==
0
:
try
:
# train abort
exit
(
1
)
sys
.
exit
(
1
)
except
SystemExit
:
name
=
"abort>>> selected_gpus:{} worker_endpoints:{} trainers_num:{} current_endpoint:{} trainer_id:{}"
.
format
(
selected_gpus
,
...
...
test/custom_kernel/test_custom_kernel_dot.py
浏览文件 @
c2079443
...
...
@@ -91,5 +91,5 @@ class TestCustomKernelDotC(unittest.TestCase):
if
__name__
==
'__main__'
:
if
os
.
name
==
'nt'
or
sys
.
platform
.
startswith
(
'darwin'
):
# only support Linux now
exit
()
sys
.
exit
()
unittest
.
main
()
test/custom_kernel/test_custom_kernel_load.py
浏览文件 @
c2079443
...
...
@@ -88,5 +88,5 @@ class TestCustomKernelLoad(unittest.TestCase):
if
__name__
==
'__main__'
:
if
os
.
name
==
'nt'
or
sys
.
platform
.
startswith
(
'darwin'
):
# only support Linux now
exit
()
sys
.
exit
()
unittest
.
main
()
test/custom_op/test_custom_relu_op_xpu_setup.py
浏览文件 @
c2079443
...
...
@@ -346,5 +346,5 @@ if __name__ == '__main__':
# compile, install the custom op egg into site-packages under background
# Currently custom XPU op does not support Windows
if
os
.
name
==
'nt'
:
exit
()
sys
.
exit
()
unittest
.
main
()
test/legacy_test/test_error_clip.py
浏览文件 @
c2079443
...
...
@@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
sys
import
paddle
from
paddle
import
fluid
...
...
@@ -80,6 +82,6 @@ for data in train_reader():
(
out1
.
clip
(
min
=
CLIP_MIN
,
max
=
CLIP_MAX
)
==
out1_clip
).
all
()
and
(
out2
==
out2_clip
).
all
()
):
exit
(
1
)
sys
.
exit
(
1
)
exit
(
0
)
sys
.
exit
(
0
)
tools/check_ctest_hung.py
浏览文件 @
c2079443
...
...
@@ -31,7 +31,7 @@ Diff: set(['test_parallel_executor_crf'])
"""
if
len
(
sys
.
argv
)
<
2
:
print
(
usage
)
exit
(
0
)
sys
.
exit
(
0
)
logfile
=
sys
.
argv
[
1
]
started
=
set
()
...
...
tools/check_op_benchmark_result.py
浏览文件 @
c2079443
...
...
@@ -16,6 +16,7 @@ import argparse
import
json
import
logging
import
os
import
sys
def
check_path_exists
(
path
):
...
...
@@ -153,7 +154,7 @@ def update_api_info_file(fail_case_list, api_info_file):
def
summary_results
(
check_results
,
api_info_file
):
"""Summary results and return exit code."""
"""Summary results and return
sys.
exit code."""
for
case_name
in
check_results
[
"speed"
]:
logging
.
error
(
"Check speed result with case
\"
%s
\"
failed."
%
case_name
)
...
...
@@ -217,4 +218,4 @@ if __name__ == "__main__":
case_name
,
develop_result
,
pr_result
,
check_results
)
exit
(
summary_results
(
check_results
,
args
.
api_info_file
))
sys
.
exit
(
summary_results
(
check_results
,
args
.
api_info_file
))
tools/check_ut.py
浏览文件 @
c2079443
...
...
@@ -16,6 +16,7 @@
import
os
import
os.path
import
sys
from
github
import
Github
...
...
@@ -36,11 +37,11 @@ class PRChecker:
pr_id
=
os
.
getenv
(
'GIT_PR_ID'
)
if
not
pr_id
:
print
(
'No PR ID'
)
exit
(
0
)
sys
.
exit
(
0
)
print
(
pr_id
)
if
not
os
.
path
.
isfile
(
filename
):
print
(
'No author to check'
)
exit
(
0
)
sys
.
exit
(
0
)
self
.
repo
=
self
.
github
.
get_repo
(
'PaddlePaddle/Paddle'
)
pr
=
self
.
repo
.
get_pull
(
int
(
pr_id
))
user
=
pr
.
user
.
login
...
...
tools/continuous_integration/bisect.py
浏览文件 @
c2079443
...
...
@@ -107,7 +107,7 @@ while True:
if
not
commits
:
sys
.
stdout
.
write
(
'no commits to bisect
\n
'
)
exit
()
sys
.
exit
()
# checkout the picked branch.
pick_idx
=
len
(
commits
)
/
2
pick
=
commits
[
pick_idx
]
...
...
@@ -129,7 +129,7 @@ while True:
subprocess
.
check_output
([
cmd
],
shell
=
True
)
except
subprocess
.
CalledProcessError
as
e
:
sys
.
stderr
.
write
(
'failed to build commit: %s
\n
%s
\n
'
%
(
pick
,
e
))
exit
()
sys
.
exit
()
# test the selected branch.
passed
=
True
try
:
...
...
tools/coverage/coverage_diff.py
浏览文件 @
c2079443
...
...
@@ -117,7 +117,7 @@ def get_info_file_lines(info_file, diff_file):
if
__name__
==
'__main__'
:
if
len
(
sys
.
argv
)
<
3
:
exit
()
sys
.
exit
()
info_file
=
sys
.
argv
[
1
]
diff_file
=
sys
.
argv
[
2
]
...
...
tools/coverage/coverage_diff_list.py
浏览文件 @
c2079443
...
...
@@ -58,7 +58,7 @@ def filter_by(list_file, max_rate):
if
__name__
==
'__main__'
:
if
len
(
sys
.
argv
)
<
2
:
exit
()
sys
.
exit
()
list_file
=
sys
.
argv
[
1
]
max_rate
=
float
(
sys
.
argv
[
2
])
...
...
tools/coverage/coverage_lines.py
浏览文件 @
c2079443
...
...
@@ -47,21 +47,21 @@ def get_lines(info_file):
if
total
==
0
:
print
(
'no data found'
)
exit
()
sys
.
exit
()
return
hits
/
total
if
__name__
==
'__main__'
:
if
len
(
sys
.
argv
)
<
3
:
exit
()
sys
.
exit
()
info_file
=
sys
.
argv
[
1
]
expected
=
float
(
sys
.
argv
[
2
])
if
not
os
.
path
.
isfile
(
info_file
):
print
(
'info file {} is not exists, ignored'
.
format
(
info_file
))
exit
()
sys
.
exit
()
actual
=
get_lines
(
info_file
)
actual
=
round
(
actual
,
3
)
...
...
@@ -73,7 +73,7 @@ if __name__ == '__main__':
)
)
exit
(
1
)
sys
.
exit
(
1
)
print
(
'expected >= {} %, actual {} %, passed'
.
format
(
...
...
tools/gen_ut_cmakelists.py
浏览文件 @
c2079443
...
...
@@ -15,6 +15,7 @@
import
argparse
import
os
import
re
import
sys
# port range (21200, 23000) is reserved for dist-ops
...
...
@@ -556,7 +557,7 @@ class CMakeGenerator:
print
(
e
)
print
(
f
"[ERROR FILE]:
{
current_work_dir
}
/testslist.csv"
)
print
(
f
"[ERROR LINE
{
i
+
1
}
]:
{
line
.
strip
()
}
"
)
exit
(
1
)
sys
.
exit
(
1
)
for
sub
in
sub_dirs
:
cmds
+=
f
"add_subdirectory(
{
sub
}
)
\n
"
...
...
tools/get_pr_ut.py
浏览文件 @
c2079443
...
...
@@ -19,6 +19,7 @@ import platform
import
re
import
ssl
import
subprocess
import
sys
import
time
import
urllib.request
...
...
@@ -52,7 +53,7 @@ class PRChecker:
pr_id
=
os
.
getenv
(
'GIT_PR_ID'
)
if
not
pr_id
:
print
(
'PREC No PR ID'
)
exit
(
0
)
sys
.
exit
(
0
)
suffix
=
os
.
getenv
(
'PREC_SUFFIX'
)
if
suffix
:
self
.
suffix
=
suffix
...
...
@@ -311,7 +312,7 @@ class PRChecker:
)
if
not
ret
:
print
(
'PREC download file_ut.json failed'
)
exit
(
1
)
sys
.
exit
(
1
)
with
open
(
'ut_file_map.json'
)
as
jsonfile
:
file_ut_map
=
json
.
load
(
jsonfile
)
...
...
@@ -371,7 +372,7 @@ class PRChecker:
ut_list
.
append
(
ut
.
rstrip
(
'
\r\n
'
))
else
:
print
(
'PREC download prec_delta failed'
)
exit
(
1
)
sys
.
exit
(
1
)
PRECISION_TEST_Cases_ratio
=
format
(
float
(
len
(
ut_list
))
/
float
(
self
.
get_all_count
()),
'.2f'
)
...
...
@@ -484,7 +485,7 @@ class PRChecker:
ut_list
.
append
(
ut
.
rstrip
(
'
\r\n
'
))
else
:
print
(
'PREC download prec_delta failed'
)
exit
(
1
)
sys
.
exit
(
1
)
print
(
"hitMapFiles: %s"
%
hitMapFiles
)
print
(
"ipipe_log_param_PRECISION_TEST: true"
)
print
(
...
...
tools/sampcd_processor.py
浏览文件 @
c2079443
...
...
@@ -432,7 +432,7 @@ def execute_samplecode(tfname):
else
:
logger
.
error
(
"Error: fail to parse python version!"
)
result
=
False
exit
(
1
)
sys
.
exit
(
1
)
logger
.
info
(
"----example code check----"
)
logger
.
info
(
"executing sample code: %s"
,
tfname
)
...
...
@@ -724,7 +724,7 @@ if __name__ == '__main__':
filenames
=
get_filenames
(
args
.
full_test
)
if
len
(
filenames
)
==
0
and
len
(
whl_error
)
==
0
:
logger
.
info
(
"-----API_PR.spec is the same as API_DEV.spec-----"
)
exit
(
0
)
sys
.
exit
(
0
)
logger
.
info
(
"API_PR is diff from API_DEV: %s"
,
filenames
)
threads
=
multiprocessing
.
cpu_count
()
...
...
@@ -760,7 +760,7 @@ if __name__ == '__main__':
"In addition, mistakes found in sample codes: %s"
,
temp
[
1
]
)
logger
.
info
(
"----------------------------------------------------"
)
exit
(
1
)
sys
.
exit
(
1
)
else
:
timeovered_test
=
{}
for
temp
in
result
:
...
...
@@ -810,7 +810,7 @@ if __name__ == '__main__':
logger
.
info
(
"Mistakes found in sample codes. Please recheck the sample codes."
)
exit
(
1
)
sys
.
exit
(
1
)
logger
.
info
(
"Sample code check is successful!"
)
...
...
tools/test_runner.py
浏览文件 @
c2079443
...
...
@@ -63,7 +63,7 @@ def main():
paddle
.
disable_static
()
if
some_test_failed
:
exit
(
1
)
sys
.
exit
(
1
)
if
__name__
==
'__main__'
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录