3
0
Fork 0
mirror of https://github.com/YosysHQ/sby.git synced 2025-08-13 00:30:57 +00:00

Use tasknames in --statuscsv

Also fix fallbacks for property statuses without a `task_property_status` entry.
This commit is contained in:
Krystine Sherwin 2025-07-08 15:47:34 +12:00
parent 2aa8d266ad
commit ceaeac43f7
No known key found for this signature in database
2 changed files with 11 additions and 6 deletions

View file

@ -97,7 +97,7 @@ if status_show or status_reset or status_show_csv:
status_db.print_status_summary() status_db.print_status_summary()
if status_show_csv: if status_show_csv:
status_db.print_status_summary_csv() status_db.print_status_summary_csv(tasknames)
status_db.db.close() status_db.db.close()

View file

@ -413,7 +413,7 @@ class SbyStatusDb:
return {row["id"]: parse_status_data_row(row) for row in rows} return {row["id"]: parse_status_data_row(row) for row in rows}
def print_status_summary_csv(self): def print_status_summary_csv(self, tasknames):
# get all statuses # get all statuses
all_properties = self.all_status_data_joined() all_properties = self.all_status_data_joined()
@ -424,6 +424,8 @@ class SbyStatusDb:
# find summary for each task/property combo # find summary for each task/property combo
prop_map: dict[(str, str), dict[str, (int, int)]] = {} prop_map: dict[(str, str), dict[str, (int, int)]] = {}
for row, prop_status in all_properties.items(): for row, prop_status in all_properties.items():
if tasknames and prop_status['task_name'] not in tasknames:
continue
status = prop_status['status'] status = prop_status['status']
this_depth = prop_status['data'].get('step') this_depth = prop_status['data'].get('step')
this_kind = prop_status['trace_kind'] this_kind = prop_status['trace_kind']
@ -471,7 +473,7 @@ def combine_statuses(statuses):
def parse_status_data_row(raw: sqlite3.Row): def parse_status_data_row(raw: sqlite3.Row):
row_dict = dict(raw) row_dict = dict(raw)
row_dict["name"] = json.loads(row_dict.get("name", "null")) row_dict["name"] = json.loads(row_dict.get("name", "null"))
row_dict["data"] = json.loads(row_dict.get("data", "null")) row_dict["data"] = json.loads(row_dict.get("data") or "{}")
return row_dict return row_dict
def format_status_data_csvline(row: dict|None) -> str: def format_status_data_csvline(row: dict|None) -> str:
@ -490,8 +492,11 @@ def format_status_data_csvline(row: dict|None) -> str:
] ]
return ','.join(csv_header) return ','.join(csv_header)
else: else:
engine = row['data'].get('engine', row['data']['source']) engine = row['data'].get('engine', row['data'].get('source'))
time = row['status_created'] - row['created'] try:
time = row['status_created'] - row['created']
except TypeError:
time = 0
name = row['hdlname'] name = row['hdlname']
depth = row['data'].get('step') depth = row['data'].get('step')
try: try:
@ -507,7 +512,7 @@ def format_status_data_csvline(row: dict|None) -> str:
name or pretty_path(row['name']), name or pretty_path(row['name']),
row['location'], row['location'],
row['kind'], row['kind'],
row['status'], row['status'] or "UNKNOWN",
trace_path, trace_path,
depth, depth,
] ]