Skip to content

Commit da6d21d

Browse files
authored
do not fail the entire report if a branch cannot be found (#104)
1 parent 1e3d4a8 commit da6d21d

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

report.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,22 @@
4040
exectime = {}
4141

4242
for branch in branches:
43-
cursor.execute("SELECT date FROM [%s] ORDER BY date DESC LIMIT 1" % branch)
44-
v = cursor.fetchone()[0]
43+
try:
44+
cursor.execute("SELECT date FROM [%s] ORDER BY date DESC LIMIT 1" % branch)
45+
one = cursor.fetchone()
46+
if one == None:
47+
print("No such table '%s'; specify it using --branch=XXX when running test.py" % branch)
48+
# ignore this table and continue
49+
branches.remove(branch)
50+
continue
51+
else:
52+
v = one[0]
53+
except:
54+
print("No such table '%s'; specify it using --branch=XXX when running test.py" % branch)
55+
# ignore this table and continue
56+
branches.remove(branch)
57+
continue
58+
4559
dates_str[branch] = str(datetime.datetime.fromtimestamp(v).strftime('%Y-%m-%d %H:%M:%S'))
4660
cursor.execute('''CREATE INDEX IF NOT EXISTS [idx_%s_date] ON [%s](date)''' % (branch,branch))
4761

0 commit comments

Comments
 (0)