@@ -82,14 +82,14 @@ def build_metrics_from_data_array(metrics: List[dict], labels: dict) -> List[dic
8282 return result
8383
8484
85- def build_metrics_from_target (target : dict , runner : str ) -> List [dict ]:
85+ def build_metrics_from_target (target : dict , run_id : str ) -> List [dict ]:
8686 result = []
8787 project = target ["target" ]
8888
8989 result .extend (build_metrics_from_data_array (
9090 target ["summarised" ],
9191 {
92- "runner " : runner ,
92+ "run_id " : run_id ,
9393 "project" : project ,
9494 "class" : "All"
9595 }
@@ -100,7 +100,7 @@ def build_metrics_from_target(target: dict, runner: str) -> List[dict]:
100100 result .extend (build_metrics_from_data_array (
101101 class_item ["data" ],
102102 {
103- "runner " : runner ,
103+ "run_id " : run_id ,
104104 "project" : project ,
105105 "class" : class_name
106106 }
@@ -109,10 +109,10 @@ def build_metrics_from_target(target: dict, runner: str) -> List[dict]:
109109 return result
110110
111111
112- def build_metrics_from_targets (targets : List [dict ], runner : str ) -> List [dict ]:
112+ def build_metrics_from_targets (targets : List [dict ], run_id : str ) -> List [dict ]:
113113 metrics = []
114114 for target in targets :
115- metrics .extend (build_metrics_from_target (target , runner ))
115+ metrics .extend (build_metrics_from_target (target , run_id ))
116116 return metrics
117117
118118
@@ -131,11 +131,16 @@ def get_args():
131131 return args
132132
133133
134+ def extract_run_id (text : str ):
135+ idx = text .find ('-' )
136+ return "run" + text [idx :]
137+
138+
134139def main ():
135140 args = get_args ()
136141 stats = load (args .stats_file )
137- runner = stats ["metadata" ]["environment " ]["host" ]
138- metrics = build_metrics_from_targets (stats ["targets" ], runner )
142+ run_id = extract_run_id ( stats ["metadata" ]["source " ]["id" ])
143+ metrics = build_metrics_from_targets (stats ["targets" ], run_id )
139144 metrics .sort (key = lambda x : x ["metric" ])
140145 with open (args .output_file , "w" ) as f :
141146 json .dump (metrics , f , indent = 4 )
0 commit comments