Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaomi
Mace
提交
2e3b2be6
Mace
项目概览
Xiaomi
/
Mace
通知
106
Star
40
Fork
27
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Mace
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2e3b2be6
编写于
4月 12, 2018
作者:
L
Liangliang He
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prefer to select unlocked devices in CI
上级
7d53c473
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
8 deletion
+29
-8
.gitignore
.gitignore
+1
-0
tools/bazel_adb_run.py
tools/bazel_adb_run.py
+6
-1
tools/sh_commands.py
tools/sh_commands.py
+22
-7
未找到文件。
.gitignore
浏览文件 @
2e3b2be6
...
...
@@ -9,3 +9,4 @@ mace/codegen/opencl_bin/
mace/codegen/tuning/
mace/codegen/version/
build/
docs/_build/
tools/bazel_adb_run.py
浏览文件 @
2e3b2be6
...
...
@@ -86,7 +86,12 @@ def main(unused_args):
target_socs
=
set
(
FLAGS
.
target_socs
.
split
(
','
))
target_devices
=
sh_commands
.
adb_devices
(
target_socs
=
target_socs
)
if
FLAGS
.
target_socs
==
"random"
:
target_devices
=
[
random
.
choice
(
target_devices
)]
unlocked_devices
=
\
[
d
for
d
in
target_devices
if
not
sh_commands
.
is_device_locked
(
d
)]
if
len
(
unlocked_devices
)
>
0
:
target_devices
=
[
random
.
choice
(
unlocked_devices
)]
else
:
target_devices
=
[
random
.
choice
(
target_devices
)]
target
=
FLAGS
.
target
host_bin_path
,
bin_name
=
sh_commands
.
bazel_target_to_bin
(
target
)
...
...
tools/sh_commands.py
浏览文件 @
2e3b2be6
...
...
@@ -20,6 +20,22 @@ def make_output_processor(buff):
return
process_output
def
device_lock_path
(
serialno
):
return
"/tmp/device-lock-%s"
%
serialno
def
device_lock
(
serialno
,
timeout
=
3600
):
return
filelock
.
FileLock
(
device_lock_path
(
serialno
),
timeout
=
timeout
)
def
is_device_locked
(
serialno
):
try
:
with
device_lock
(
serialno
,
timeout
=
0.000001
):
return
False
except
filelock
.
Timeout
:
return
True
################################
# adb commands
################################
...
...
@@ -90,12 +106,11 @@ def adb_run(serialno,
print
(
"====================================================================="
)
lock_path
=
"/tmp/device-lock-%s"
%
serialno
print
(
"Try to lock "
,
lock_path
)
with
filelock
.
FileLock
(
lock_path
,
timeout
=
3600
):
print
(
"Run on device: %s, %s, %s"
%
(
serialno
,
props
[
"ro.board.platform"
],
props
[
"ro.product.model"
]))
print
(
"Trying to lock device"
,
serialno
)
with
device_lock
(
serialno
):
print
(
"Run on device: %s, %s, %s"
%
(
serialno
,
props
[
"ro.board.platform"
],
props
[
"ro.product.model"
]))
sh
.
adb
(
"-s"
,
serialno
,
"shell"
,
"rm -rf %s"
%
device_bin_path
)
sh
.
adb
(
"-s"
,
serialno
,
"shell"
,
"mkdir -p %s"
%
device_bin_path
)
print
(
"Push %s to %s"
%
(
host_bin_full_path
,
device_bin_full_path
))
...
...
@@ -111,7 +126,7 @@ def adb_run(serialno,
"MACE_OUT_OF_RANGE_CHECK=%d MACE_OPENCL_PROFILING=%d "
"MACE_CPP_MIN_VLOG_LEVEL=%d %s %s"
%
(
out_of_range_check
,
opencl_profiling
,
vlog_level
,
device_bin_full_path
,
args
),
device_bin_full_path
,
args
),
_out
=
process_output
,
_bg
=
True
,
_err_to_out
=
True
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录