3
3
# Licensed under the MIT License.
4
4
# --------------------------------------------------------------------------
5
5
import argparse
6
+ import csv
6
7
import datetime
7
8
import os
8
9
import sys
@@ -419,10 +420,11 @@ def main():
419
420
upload_time = datetime .datetime .now (tz = datetime .timezone .utc ).replace (microsecond = 0 )
420
421
421
422
try :
423
+ # Load EP Perf test results from /result
422
424
result_file = args .report_folder
423
-
424
- folders = os .listdir (result_file )
425
- os .chdir (result_file )
425
+ result_perf_test_path = os . path . join ( result_file , "result" )
426
+ folders = os .listdir (result_perf_test_path )
427
+ os .chdir (result_perf_test_path )
426
428
427
429
tables = [
428
430
fail_name ,
@@ -445,26 +447,26 @@ def main():
445
447
for model_group in folders :
446
448
os .chdir (model_group )
447
449
csv_filenames = os .listdir ()
448
- for csv in csv_filenames :
449
- table = pd .read_csv (csv )
450
- if session_name in csv :
450
+ for csv_file in csv_filenames :
451
+ table = pd .read_csv (csv_file )
452
+ if session_name in csv_file :
451
453
table_results [session_name ] = pd .concat (
452
454
[table_results [session_name ], get_session (table , model_group )], ignore_index = True
453
455
)
454
- elif specs_name in csv :
456
+ elif specs_name in csv_file :
455
457
table_results [specs_name ] = pd .concat (
456
458
[
457
459
table_results [specs_name ],
458
460
get_specs (table , args .branch , args .commit_hash , args .commit_datetime ),
459
461
],
460
462
ignore_index = True ,
461
463
)
462
- elif fail_name in csv :
464
+ elif fail_name in csv_file :
463
465
table_results [fail_name ] = pd .concat (
464
466
[table_results [fail_name ], get_failures (table , model_group )],
465
467
ignore_index = True ,
466
468
)
467
- elif latency_name in csv :
469
+ elif latency_name in csv_file :
468
470
table_results [memory_name ] = pd .concat (
469
471
[table_results [memory_name ], get_memory (table , model_group )],
470
472
ignore_index = True ,
@@ -474,11 +476,11 @@ def main():
474
476
[table_results [latency_name ], get_latency (table , model_group )],
475
477
ignore_index = True ,
476
478
)
477
- elif status_name in csv :
479
+ elif status_name in csv_file :
478
480
table_results [status_name ] = pd .concat (
479
481
[table_results [status_name ], get_status (table , model_group )], ignore_index = True
480
482
)
481
- elif op_metrics_name in csv :
483
+ elif op_metrics_name in csv_file :
482
484
table = table .assign (Group = model_group )
483
485
table_results [op_metrics_name ] = pd .concat (
484
486
[table_results [op_metrics_name ], table ], ignore_index = True
@@ -512,6 +514,43 @@ def main():
512
514
args .commit_datetime ,
513
515
)
514
516
517
+ # Load concurrency test results
518
+ result_mem_test_path = os .path .join (result_file , "result_mem_test" )
519
+ os .chdir (result_mem_test_path )
520
+ log_path = "concurrency_test.log"
521
+ if os .path .exists (log_path ):
522
+ print ("Generating concurrency test report" )
523
+ with open (log_path ) as log_file :
524
+ log_content = log_file .read ()
525
+
526
+ failed_cases_section = log_content .split ("Failed Test Cases:" )[1 ]
527
+
528
+ # passed = 1 if no failed test cases
529
+ if failed_cases_section .strip () == "" :
530
+ passed = 1
531
+ else :
532
+ passed = 0
533
+
534
+ csv_path = "concurrency_test.csv"
535
+ with open (csv_path , "w" , newline = "" ) as csv_file :
536
+ csv_writer = csv .writer (csv_file )
537
+ csv_writer .writerow (["Passed" , "Log" ])
538
+ csv_writer .writerow ([passed , log_content ])
539
+
540
+ db_table_name = "ep_concurrencytest_record"
541
+ table = pd .read_csv (csv_path )
542
+ write_table (
543
+ ingest_client ,
544
+ args .database ,
545
+ table ,
546
+ db_table_name ,
547
+ upload_time ,
548
+ identifier ,
549
+ args .branch ,
550
+ args .commit_hash ,
551
+ args .commit_datetime ,
552
+ )
553
+
515
554
except BaseException as e :
516
555
print (str (e ))
517
556
sys .exit (1 )
0 commit comments