@@ -341,14 +341,18 @@ def transform(
341341 benchmark_results : List ,
342342 benchmark_config : Dict [str , str ],
343343 job_name : str ,
344+ job_report : Any = {},
344345) -> List :
345346 """
346347 Transform the benchmark results into the format writable into the benchmark database
347348 """
348349 # Overwrite the device name here with the job name as it has more information about
349350 # the device, i.e. Samsung Galaxy S22 5G instead of just Samsung
350351 for r in benchmark_results :
351- r ["deviceInfo" ]["device" ] = job_name
352+ is_private_device = job_report .get ("is_private_instance" , False )
353+ r ["deviceInfo" ]["device" ] = (
354+ f"{ job_name } (private)" if is_private_device else job_name
355+ )
352356
353357 # From https://github.com/pytorch/pytorch/wiki/How-to-integrate-with-PyTorch-OSS-benchmark-database
354358 return [
@@ -361,6 +365,8 @@ def transform(
361365 # Just keep a copy of the benchmark config here
362366 "benchmark_config" : json .dumps (benchmark_config ),
363367 "job_conclusion" : "SUCCESS" ,
368+ "job_arn" : job_report .get ("arn" , "" ),
369+ "instance_arn" : job_report .get ("instance_arn" , "" ),
364370 },
365371 },
366372 "model" : {
@@ -446,6 +452,7 @@ def transform_failure_record(
446452 "app_type" : app_type ,
447453 "job_conclusion" : result ,
448454 "failure_type" : level ,
455+ "job_arn" : report .get ("arn" , "" ),
449456 "job_report" : json .dumps (report ),
450457 },
451458 },
@@ -512,6 +519,7 @@ def get_benchmark_config(
512519def extract_benchmark_result_from_artifact (
513520 artifact : Dict [str , Any ],
514521 benchmark_config : Dict [str , str ],
522+ job_report : Any ,
515523) -> List [Any ]:
516524 job_name = artifact .get ("job_name" , "" )
517525 artifact_type = artifact .get ("type" , "" )
@@ -532,7 +540,9 @@ def extract_benchmark_result_from_artifact(
532540 )
533541 if not benchmark_results :
534542 return []
535- return transform (app_type , benchmark_results , benchmark_config , job_name )
543+ return transform (
544+ app_type , benchmark_results , benchmark_config , job_name , job_report
545+ )
536546
537547
538548def get_app_type (type : str ):
@@ -674,7 +684,7 @@ def process_benchmark_results(content: Any, app: str, benchmark_configs: str):
674684 for job_artifact in job_artifacts :
675685 # generate result for each schema
676686 results = extract_benchmark_result_from_artifact (
677- job_artifact , benchmark_config
687+ job_artifact , benchmark_config , job_report
678688 )
679689 all_benchmark_results .extend (results )
680690 return all_benchmark_results
0 commit comments