3
0
Fork 0
mirror of https://github.com/YosysHQ/sby.git synced 2025-08-17 02:12:17 +00:00

Add --taskstatus

Used for checking tasks in the status db.
Change `SBYStatusDB.all_tasks_status()` to use a `LEFT JOIN` to get a status of `UNKNOWN` for pending or aborted tasks (e.g. because they were ctrl+c'ed).
This commit is contained in:
Krystine Sherwin 2025-07-09 10:06:56 +12:00
parent 9589ce203a
commit cb81a97808
No known key found for this signature in database
3 changed files with 17 additions and 2 deletions

View file

@ -63,6 +63,7 @@ init_config_file = args.init_config_file
status_show = args.status
status_reset = args.status_reset
status_cancels = args.status_cancels
task_status = args.task_status
status_live_csv = args.livecsv
status_show_csv = args.statuscsv
status_latest = args.status_latest
@ -71,7 +72,7 @@ if autotune and linkmode:
print("ERROR: --link flag currently not available with --autotune")
sys.exit(1)
if status_show or status_reset or status_show_csv:
if status_show or status_reset or task_status or status_show_csv:
target = workdir_prefix or workdir or sbyfile
if target is None:
print("ERROR: Specify a .sby config file or working directory to use --status.")
@ -105,6 +106,9 @@ if status_show or status_reset or status_show_csv:
if status_show_csv:
status_db.print_status_summary_csv(tasknames, status_latest)
if task_status:
status_db.print_task_summary()
status_db.db.close()

View file

@ -86,6 +86,9 @@ def parser_func(release_version='unknown SBY version'):
parser.add_argument("--statuscancels", action="store_true", dest="status_cancels",
help="intertask cancellations can be triggered by the status database")
parser.add_argument("--taskstatus", action="store_true", dest="task_status",
help="display the status of tasks in the status database")
parser.add_argument("--init-config-file", dest="init_config_file",
help="create a default .sby config file")
parser.add_argument("sbyfile", metavar="<jobname>.sby | <dirname>", nargs="?",

View file

@ -301,7 +301,7 @@ class SbyStatusDb:
SELECT task.id, task.name, task.created,
task_status.status, task_status.created as 'status_created'
FROM task
INNER JOIN task_status ON task_status.task=task.id
LEFT JOIN task_status ON task_status.task=task.id
"""
).fetchall()
@ -399,6 +399,14 @@ class SbyStatusDb:
for display_name, statuses in sorted(properties.items()):
print(pretty_path(display_name), combine_statuses(statuses))
def print_task_summary(self):
tasks = self.all_tasks_status()
task_status = defaultdict(set)
for task in tasks.values():
task_status[task["name"]].add(task["status"] or "UNKNOWN")
for task_name, statuses in sorted(task_status.items()):
print(task_name, combine_statuses(statuses))
def get_status_data_joined(self, status_id: int):
row = self.db.execute(
"""