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:
parent
e9f4f06fe9
commit
e2b1e85090
4 changed files with 12 additions and 6 deletions
|
@ -61,6 +61,7 @@ jobcount = args.jobcount
|
||||||
init_config_file = args.init_config_file
|
init_config_file = args.init_config_file
|
||||||
status_show = args.status
|
status_show = args.status
|
||||||
status_reset = args.status_reset
|
status_reset = args.status_reset
|
||||||
|
status_live_csv = args.livecsv
|
||||||
|
|
||||||
if status_show or status_reset:
|
if status_show or status_reset:
|
||||||
target = workdir_prefix or workdir or sbyfile
|
target = workdir_prefix or workdir or sbyfile
|
||||||
|
@ -467,7 +468,7 @@ def start_task(taskloop, taskname):
|
||||||
else:
|
else:
|
||||||
junit_filename = "junit"
|
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():
|
for k, v in exe_paths.items():
|
||||||
task.exe_paths[k] = v
|
task.exe_paths[k] = v
|
||||||
|
|
|
@ -29,6 +29,8 @@ def parser_func(release_version='unknown SBY version'):
|
||||||
help="maximum number of processes to run in parallel")
|
help="maximum number of processes to run in parallel")
|
||||||
parser.add_argument("--sequential", action="store_true", dest="sequential",
|
parser.add_argument("--sequential", action="store_true", dest="sequential",
|
||||||
help="run tasks in sequence, not in parallel")
|
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",
|
parser.add_argument("--autotune", action="store_true", dest="autotune",
|
||||||
help="automatically find a well performing engine and engine configuration for each task")
|
help="automatically find a well performing engine and engine configuration for each task")
|
||||||
|
|
|
@ -825,13 +825,14 @@ class SbySummary:
|
||||||
|
|
||||||
|
|
||||||
class SbyTask(SbyConfig):
|
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__()
|
super().__init__()
|
||||||
self.used_options = set()
|
self.used_options = set()
|
||||||
self.models = dict()
|
self.models = dict()
|
||||||
self.workdir = workdir
|
self.workdir = workdir
|
||||||
self.reusedir = reusedir
|
self.reusedir = reusedir
|
||||||
self.name = name
|
self.name = name
|
||||||
|
self.live_csv = live_csv
|
||||||
self.status = "UNKNOWN"
|
self.status = "UNKNOWN"
|
||||||
self.total_time = 0
|
self.total_time = 0
|
||||||
self.expect = list()
|
self.expect = list()
|
||||||
|
@ -1321,7 +1322,7 @@ class SbyTask(SbyConfig):
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
status_path = f"{self.workdir}/status.sqlite"
|
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):
|
def setup_procs(self, setupmode):
|
||||||
self.handle_non_engine_options()
|
self.handle_non_engine_options()
|
||||||
|
|
|
@ -4,6 +4,7 @@ import sqlite3
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
|
import click
|
||||||
import re
|
import re
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
@ -95,9 +96,10 @@ def transaction(method: Fn) -> Fn:
|
||||||
|
|
||||||
|
|
||||||
class SbyStatusDb:
|
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.debug = False
|
||||||
self.task = task
|
self.task = task
|
||||||
|
self.live_csv = live_csv
|
||||||
|
|
||||||
self.con = sqlite3.connect(path, isolation_level=None, timeout=timeout)
|
self.con = sqlite3.connect(path, isolation_level=None, timeout=timeout)
|
||||||
self.db = self.con.cursor()
|
self.db = self.con.cursor()
|
||||||
|
@ -238,7 +240,7 @@ class SbyStatusDb:
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
if True:
|
if self.live_csv:
|
||||||
csv = [
|
csv = [
|
||||||
round(now - self.start_time, 2),
|
round(now - self.start_time, 2),
|
||||||
self.task.name,
|
self.task.name,
|
||||||
|
@ -249,7 +251,7 @@ class SbyStatusDb:
|
||||||
property.status,
|
property.status,
|
||||||
data.get("step", "DEPTH?"),
|
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
|
@transaction
|
||||||
def add_task_property_data(self, property: SbyProperty, kind: str, data: Any):
|
def add_task_property_data(self, property: SbyProperty, kind: str, data: Any):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue