catch all exceptions in testing script

old-commit-hash: 2ecf054891
commatwo_master
Willem Melching 5 years ago
parent 0c91414e2b
commit 9afaef9f89
  1. 51
      selfdrive/test/eon_testing_slave.py

@ -2,7 +2,6 @@
import re
import time
import json
import base64
import requests
import subprocess
from common.timeout import Timeout
@ -40,35 +39,33 @@ def heartbeat():
}
while True:
with open(os.path.join(work_dir, "selfdrive", "common", "version.h")) as _versionf:
version = _versionf.read().split('"')[1]
# subprocess.check_output(["/system/bin/screencap", "-p", "/tmp/screen.png"], cwd=work_dir, env=env)
# screenshot = base64.b64encode(open('/tmp/screen.png').read())
tmux = ""
try:
tmux = os.popen('tail -n 100 /tmp/tmux_out').read()
except:
pass
params = Params()
msg = {
'version': version,
'dongle_id': params.get("DongleId").rstrip().decode('utf8'),
'remote': subprocess.check_output(["git", "config", "--get", "remote.origin.url"], cwd=work_dir).decode('utf8').rstrip(),
'revision': subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=work_dir).decode('utf8').rstrip(),
'serial': subprocess.check_output(["getprop", "ro.boot.serialno"]).decode('utf8').rstrip(),
# 'screenshot': screenshot,
'tmux': tmux,
}
try:
with open(os.path.join(work_dir, "selfdrive", "common", "version.h")) as _versionf:
version = _versionf.read().split('"')[1]
# subprocess.check_output(["/system/bin/screencap", "-p", "/tmp/screen.png"], cwd=work_dir, env=env)
# screenshot = base64.b64encode(open('/tmp/screen.png').read())
tmux = ""
try:
tmux = os.popen('tail -n 100 /tmp/tmux_out').read()
except:
pass
params = Params()
msg = {
'version': version,
'dongle_id': params.get("DongleId").rstrip().decode('utf8'),
'remote': subprocess.check_output(["git", "config", "--get", "remote.origin.url"], cwd=work_dir).decode('utf8').rstrip(),
'revision': subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=work_dir).decode('utf8').rstrip(),
'serial': subprocess.check_output(["getprop", "ro.boot.serialno"]).decode('utf8').rstrip(),
# 'screenshot': screenshot,
'tmux': tmux,
}
with Timeout(10):
requests.post('http://%s/eon/heartbeat/' % MASTER_HOST, json=msg, timeout=5.0)
except:
print("Unable to reach master")
except Exception as e:
print("Unable to send heartbeat", e)
time.sleep(5)

Loading…
Cancel
Save