Skip to content

Commit ac59028

Browse files
authored
Merge pull request #3105 from Pinata-Consulting/genmetrics-clean-out-unused-use-case
genMetrics: remove unreferenced brittle use-case
2 parents 7c141df + 35f2e77 commit ac59028

File tree

1 file changed

+15
-85
lines changed

1 file changed

+15
-85
lines changed

flow/util/genMetrics.py

Lines changed: 15 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
# -----------------------------------------------------------------------------
77

88
import os
9-
from sys import exit
109
from datetime import datetime, timedelta
1110
from collections import defaultdict
1211
from uuid import uuid4 as uuid
@@ -26,8 +25,7 @@ def parse_args():
2625
parser.add_argument(
2726
"--design",
2827
"-d",
29-
required=False,
30-
default="all_designs",
28+
required=True,
3129
help="Design Name for metrics",
3230
)
3331
parser.add_argument(
@@ -51,17 +49,9 @@ def parse_args():
5149
"--output", "-o", required=False, default="metadata.json", help="Output file"
5250
)
5351
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-
)
52+
parser.add_argument("--logs", help="Path to logs")
53+
parser.add_argument("--reports", help="Path to reports")
54+
parser.add_argument("--results", help="Path to results")
6555
args = parser.parse_args()
6656

6757
return args
@@ -378,75 +368,15 @@ def extract_metrics(
378368

379369
args = parse_args()
380370
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()
385371

386-
if all_designs or len(designs) > 1 or len(flow_variants) > 1:
387-
rootdir = "./logs"
388-
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-
)
372+
metrics_dict, metrics_df = extract_metrics(
373+
os.path.join(os.path.dirname(os.path.realpath(__file__)), "../"),
374+
args.platform,
375+
args.design,
376+
args.flowVariant,
377+
args.output,
378+
args.hier,
379+
args.logs,
380+
args.reports,
381+
args.results,
382+
)

0 commit comments

Comments
 (0)