3
0
Fork 0
mirror of https://github.com/YosysHQ/sby.git synced 2025-08-14 17:05:31 +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

@ -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):