3
0
Fork 0
mirror of https://github.com/YosysHQ/sby.git synced 2025-08-15 09:25:31 +00:00

statuscsv: Better error handling

This commit is contained in:
Krystine Sherwin 2025-07-08 15:47:32 +12:00
parent 0fa5715909
commit 4a14207b37
No known key found for this signature in database

View file

@ -381,7 +381,7 @@ class SbyStatusDb:
rows = self.db.execute( rows = self.db.execute(
""" """
SELECT task.name as 'task_name', task.mode, task.created, SELECT task.name as 'task_name', task.mode, task.created,
task_property.src as 'location', task_property.hdlname, task_property_status.status, task_property.src as 'location', task_property.name, task_property.hdlname, task_property_status.status,
task_property_status.data, task_property_status.created as 'status_created', task_property_status.data, task_property_status.created as 'status_created',
task_property_status.id task_property_status.id
FROM task FROM task
@ -392,6 +392,7 @@ class SbyStatusDb:
def get_result(row): def get_result(row):
row = dict(row) row = dict(row)
row["name"] = json.loads(row.get("name", "null"))
row["data"] = json.loads(row.get("data", "null")) row["data"] = json.loads(row.get("data", "null"))
return row return row
@ -434,7 +435,7 @@ class SbyStatusDb:
for prop in prop_map.values(): for prop in prop_map.values():
# ignore UNKNOWNs if there are other statuses # ignore UNKNOWNs if there are other statuses
if len(prop) > 1: if len(prop) > 1 and "UNKNOWN" in prop:
del prop["UNKNOWN"] del prop["UNKNOWN"]
for status, (depth, row) in prop.items(): for status, (depth, row) in prop.items():
@ -442,19 +443,19 @@ class SbyStatusDb:
engine = prop_status['data'].get('engine', prop_status['data']['source']) engine = prop_status['data'].get('engine', prop_status['data']['source'])
time = prop_status['status_created'] - prop_status['created'] time = prop_status['status_created'] - prop_status['created']
name = prop_status['hdlname'] name = prop_status['hdlname']
# print as csv # print as csv
csv_line = [ csv_line = [
round(time, 2), round(time, 2),
prop_status['task_name'], prop_status['task_name'],
prop_status['mode'], prop_status['mode'],
engine, engine,
name, name or pretty_path(prop_status['name']),
prop_status['location'], prop_status['location'],
status, status,
depth, depth,
] ]
print(','.join(str(v) for v in csv_line)) print(','.join("N/A" if v is None else str(v) for v in csv_line))
def combine_statuses(statuses): def combine_statuses(statuses):