Skip to content

Commit f1a5935

Browse files
committed
further modularize o2dpg_sim_metrics
1 parent 7c29d35 commit f1a5935

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

MC/utils/o2dpg_sim_metrics.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,18 +1018,26 @@ def merge_stats_into(list_of_json_stats, outputfile, metadata):
10181018
return running
10191019

10201020

1021-
def build_meta_header(stringarg):
1021+
def build_meta_header(arg):
10221022
meta = {}
1023-
if stringarg != "":
1024-
meta = json.loads(stringarg)
1023+
if type(arg) == str:
1024+
if arg != "":
1025+
meta = json.loads(arg)
1026+
elif type(arg) == dict:
1027+
meta = deepcopy(arg)
1028+
else:
1029+
print ("Unsupported Meta input type")
10251030
return meta
10261031

1027-
def json_stat(args):
1028-
resources = extract_resources(args.pipelines)
1032+
def json_stat_impl(pipelines, output, header_data):
1033+
resources = extract_resources(pipelines)
10291034
all_stats = [produce_json_stat(res) for res in resources]
10301035

1031-
merge_stats_into(all_stats, args.output, build_meta_header(args.header_data))
1036+
merge_stats_into(all_stats, output, build_meta_header(header_data))
1037+
10321038

1039+
def json_stat(args):
1040+
json_stat_impl(args.pipelines, args.output, args.header_data)
10331041

10341042
def merge_json_stats(args):
10351043
all_stats = []

0 commit comments

Comments
 (0)