3
0
Fork 0
mirror of https://github.com/YosysHQ/sby.git synced 2025-08-10 07:10:54 +00:00

Add --livecsv

Gate csv dump on status updates.
Format 'csv' heading in yellow.
This commit is contained in:
Krystine Sherwin 2025-07-08 15:47:32 +12:00
parent e9f4f06fe9
commit e2b1e85090
No known key found for this signature in database
4 changed files with 12 additions and 6 deletions

View file

@ -61,6 +61,7 @@ jobcount = args.jobcount
init_config_file = args.init_config_file
status_show = args.status
status_reset = args.status_reset
status_live_csv = args.livecsv
if status_show or status_reset:
target = workdir_prefix or workdir or sbyfile
@ -467,7 +468,7 @@ def start_task(taskloop, taskname):
else:
junit_filename = "junit"
task = SbyTask(sbyconfig, my_workdir, early_logmsgs, reusedir, taskloop, name=taskname)
task = SbyTask(sbyconfig, my_workdir, early_logmsgs, reusedir, taskloop, name=taskname, live_csv=status_live_csv)
for k, v in exe_paths.items():
task.exe_paths[k] = v

View file

@ -29,6 +29,8 @@ def parser_func(release_version='unknown SBY version'):
help="maximum number of processes to run in parallel")
parser.add_argument("--sequential", action="store_true", dest="sequential",
help="run tasks in sequence, not in parallel")
parser.add_argument("--livecsv", action="store_true", dest="livecsv",
help="print live updates of property statuses during task execution in csv format")
parser.add_argument("--autotune", action="store_true", dest="autotune",
help="automatically find a well performing engine and engine configuration for each task")

View file

@ -825,13 +825,14 @@ class SbySummary:
class SbyTask(SbyConfig):
def __init__(self, sbyconfig, workdir, early_logs, reusedir, taskloop=None, logfile=None, name=None):
def __init__(self, sbyconfig, workdir, early_logs, reusedir, taskloop=None, logfile=None, name=None, live_csv=False):
super().__init__()
self.used_options = set()
self.models = dict()
self.workdir = workdir
self.reusedir = reusedir
self.name = name
self.live_csv = live_csv
self.status = "UNKNOWN"
self.total_time = 0
self.expect = list()
@ -1321,7 +1322,7 @@ class SbyTask(SbyConfig):
except FileNotFoundError:
status_path = f"{self.workdir}/status.sqlite"
self.status_db = SbyStatusDb(status_path, self)
self.status_db = SbyStatusDb(status_path, self, live_csv=self.live_csv)
def setup_procs(self, setupmode):
self.handle_non_engine_options()

View file

@ -4,6 +4,7 @@ import sqlite3
import os
import time
import json
import click
import re
from collections import defaultdict
from functools import wraps
@ -95,9 +96,10 @@ def transaction(method: Fn) -> Fn:
class SbyStatusDb:
def __init__(self, path: Path, task, timeout: float = 5.0):
def __init__(self, path: Path, task, timeout: float = 5.0, live_csv = False):
self.debug = False
self.task = task
self.live_csv = live_csv
self.con = sqlite3.connect(path, isolation_level=None, timeout=timeout)
self.db = self.con.cursor()
@ -238,7 +240,7 @@ class SbyStatusDb:
),
)
if True:
if self.live_csv:
csv = [
round(now - self.start_time, 2),
self.task.name,
@ -249,7 +251,7 @@ class SbyStatusDb:
property.status,
data.get("step", "DEPTH?"),
]
self.task.log(f"csv: {','.join(str(v) for v in csv)}")
self.task.log(f"{click.style('csv', fg='yellow')}: {','.join(str(v) for v in csv)}")
@transaction
def add_task_property_data(self, property: SbyProperty, kind: str, data: Any):