Skip to content

Commit 3408e27

Browse files
committed
genMetrics: remove unreferenced brittle use-case
genMetrics.py had code to scan designs, but this code would be brittle as it makes assumptions on layout. I ran it locally and it didn't look like it was maintained. Signed-off-by: Øyvind Harboe <[email protected]>
1 parent e22e4fc commit 3408e27

File tree

1 file changed

+14
-82
lines changed

1 file changed

+14
-82
lines changed

flow/util/genMetrics.py

Lines changed: 14 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,9 @@ def parse_args():
5151
"--output", "-o", required=False, default="metadata.json", help="Output file"
5252
)
5353
parser.add_argument("--hier", "-x", action="store_true", help="Hierarchical JSON")
54-
parser.add_argument("--logs", help="Path to logs", default=None)
55-
parser.add_argument(
56-
"--reports",
57-
help="Path to reports",
58-
default=None,
59-
)
60-
parser.add_argument(
61-
"--results",
62-
help="Path to results",
63-
default=None,
64-
)
54+
parser.add_argument("--logs", help="Path to logs")
55+
parser.add_argument("--reports", help="Path to reports")
56+
parser.add_argument("--results", help="Path to results")
6557
args = parser.parse_args()
6658

6759
return args
@@ -378,75 +370,15 @@ def extract_metrics(
378370

379371
args = parse_args()
380372
now = datetime.now()
381-
flow_variants = args.flowVariant.split()
382-
all_designs = True if args.design == "all_designs" else False
383-
designs = args.design.split()
384-
platforms = args.platform.split()
385-
386-
if all_designs or len(designs) > 1 or len(flow_variants) > 1:
387-
rootdir = "./logs"
388373

389-
all_df = pd.DataFrame()
390-
all_d = []
391-
392-
cwd = os.getcwd()
393-
for platform_it in os.scandir(rootdir):
394-
if not platform_it.is_dir():
395-
continue
396-
plt = platform_it.name
397-
if not plt in platforms:
398-
continue
399-
for design_it in os.scandir(platform_it.path):
400-
if not design_it.is_dir():
401-
continue
402-
des = design_it.name
403-
if not (all_designs or des in designs):
404-
continue
405-
for variant in flow_variants:
406-
log_dir = os.path.join(cwd, "logs", plt, des, variant)
407-
if not os.path.isdir(log_dir):
408-
continue
409-
if not os.path.isfile(os.path.join(log_dir, "6_report.json")):
410-
print(
411-
f"Skip extracting metrics for {plt}, {des}, {variant} as run did not complete"
412-
)
413-
continue
414-
print(f"Extract Metrics for {plt}, {des}, {variant}")
415-
file = "/".join(["reports", plt, des, variant, "metrics.json"])
416-
logPath = os.path.join(cwd, "logs", plt, des, variant)
417-
rptPath = os.path.join(cwd, "reports", plt, des, variant)
418-
resultPath = os.path.join(cwd, "results", plt, des, variant)
419-
metrics, df = extract_metrics(
420-
cwd,
421-
plt,
422-
des,
423-
variant,
424-
file,
425-
args.hier,
426-
logPath,
427-
rptPath,
428-
resultPath,
429-
)
430-
all_d.append(metrics)
431-
if all_df.shape[0] == 0:
432-
all_df = df
433-
else:
434-
all_df = all_df.merge(df, on="Metrics", how="inner")
435-
436-
with open("metrics.json", "w") as outFile:
437-
json.dump(all_d, outFile, indent=2)
438-
439-
with open("metrics.html", "w") as f:
440-
f.write(all_df.to_html())
441-
else:
442-
metrics_dict, metrics_df = extract_metrics(
443-
os.path.join(os.path.dirname(os.path.realpath(__file__)), "../"),
444-
args.platform,
445-
args.design,
446-
args.flowVariant,
447-
args.output,
448-
args.hier,
449-
args.logs,
450-
args.reports,
451-
args.results,
452-
)
374+
metrics_dict, metrics_df = extract_metrics(
375+
os.path.join(os.path.dirname(os.path.realpath(__file__)), "../"),
376+
args.platform,
377+
args.design,
378+
args.flowVariant,
379+
args.output,
380+
args.hier,
381+
args.logs,
382+
args.reports,
383+
args.results,
384+
)

0 commit comments

Comments
 (0)