“fe83adfbcbeb6b6d4cf05ce77c48068b6ab854b8”上不存在“paddlespeech/s2t/exps/wav2vec2/bin/test_wav.py”
提交 2bbadf8e 编写于 作者: 叶剑武

Merge branch 'select_unlock_devices_first' into 'master'

Prefer to select unlocked devices in CI

See merge request !377
......@@ -9,3 +9,4 @@ mace/codegen/opencl_bin/
mace/codegen/tuning/
mace/codegen/version/
build/
docs/_build/
......@@ -86,6 +86,11 @@ 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":
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
......
......@@ -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,11 +106,10 @@ 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"],
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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册