@@ -124,9 +124,9 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
124124 benchmark_total_command_count = 0
125125
126126 # Group-based read/write tracking for benchmarks
127- benchmark_group_read = {} # group -> count
128- benchmark_group_write = {} # group -> count
129- benchmark_group_total = {} # group -> total count
127+ benchmark_group_read = {} # group -> count
128+ benchmark_group_write = {} # group -> count
129+ benchmark_group_total = {} # group -> total count
130130
131131 # ACL category tracking for commandstats CSV
132132 csv_read_commands = {}
@@ -136,13 +136,13 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
136136 csv_total_command_count = 0
137137
138138 # Group-based read/write tracking for CSV
139- csv_group_read = {} # group -> count
140- csv_group_write = {} # group -> count
141- csv_group_total = {} # group -> total count
139+ csv_group_read = {} # group -> count
140+ csv_group_write = {} # group -> count
141+ csv_group_total = {} # group -> total count
142142
143143 # Percentage validation tracking
144144 csv_provided_percentages = {} # command -> provided percentage
145- csv_original_counts = {} # command -> original count from CSV
145+ csv_original_counts = {} # command -> original count from CSV
146146
147147 override_enabled = args .override_tests
148148 fail_on_required_diff = args .fail_on_required_diff
@@ -326,10 +326,17 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
326326 is_read = True
327327 elif "@pubsub" in acl_categories :
328328 # Pubsub commands: SUBSCRIBE/UNSUBSCRIBE are read, PUBLISH is write
329- if command .lower () in ["subscribe" , "unsubscribe" , "psubscribe" , "punsubscribe" ]:
329+ if command .lower () in [
330+ "subscribe" ,
331+ "unsubscribe" ,
332+ "psubscribe" ,
333+ "punsubscribe" ,
334+ ]:
330335 is_read = True
331336 else :
332- is_write = True # PUBLISH and other pubsub commands
337+ is_write = (
338+ True # PUBLISH and other pubsub commands
339+ )
333340 else :
334341 # Commands without explicit read/write ACL but not _ro are assumed write
335342 # This covers cases like EVALSHA which can modify data
@@ -579,7 +586,9 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
579586 acl_categories = command_json ["acl_categories" ]
580587
581588 # Use original count if available, otherwise use parsed count
582- tracking_count = original_count if original_count is not None else count
589+ tracking_count = (
590+ original_count if original_count is not None else count
591+ )
583592 csv_total_command_count += tracking_count
584593
585594 # Track total by group (all commands)
@@ -600,7 +609,12 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
600609 is_read = True
601610 elif "@pubsub" in acl_categories :
602611 # Pubsub commands: SUBSCRIBE/UNSUBSCRIBE are read, PUBLISH is write
603- if cmd .lower () in ["subscribe" , "unsubscribe" , "psubscribe" , "punsubscribe" ]:
612+ if cmd .lower () in [
613+ "subscribe" ,
614+ "unsubscribe" ,
615+ "psubscribe" ,
616+ "punsubscribe" ,
617+ ]:
604618 is_read = True
605619 else :
606620 is_write = True # PUBLISH and other pubsub commands
@@ -643,7 +657,9 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
643657 # Use original count if available and different from parsed count
644658 final_count = count
645659 if original_count is not None and original_count != count :
646- logging .warning (f"Using original count for { cmd } : { original_count :,} instead of parsed { count :,} " )
660+ logging .warning (
661+ f"Using original count for { cmd } : { original_count :,} instead of parsed { count :,} "
662+ )
647663 final_count = original_count
648664
649665 priority [cmd .lower ()] = final_count
@@ -871,8 +887,12 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
871887 write_percentage = (benchmark_write_count / benchmark_rw_count ) * 100
872888
873889 logging .info (f"READ/WRITE COMMAND DISTRIBUTION:" )
874- logging .info (f" Read commands: { benchmark_read_count :6d} ({ read_percentage :5.1f} %)" )
875- logging .info (f" Write commands: { benchmark_write_count :6d} ({ write_percentage :5.1f} %)" )
890+ logging .info (
891+ f" Read commands: { benchmark_read_count :6d} ({ read_percentage :5.1f} %)"
892+ )
893+ logging .info (
894+ f" Write commands: { benchmark_write_count :6d} ({ write_percentage :5.1f} %)"
895+ )
876896 logging .info (f" Total R/W: { benchmark_rw_count :6d} (100.0%)" )
877897 else :
878898 logging .info ("No read/write commands detected in benchmark ACL categories" )
@@ -888,8 +908,12 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
888908
889909 logging .info (f"" )
890910 logging .info (f"FAST/SLOW COMMAND DISTRIBUTION:" )
891- logging .info (f" Fast commands: { benchmark_fast_count :6d} ({ fast_percentage :5.1f} %)" )
892- logging .info (f" Slow commands: { benchmark_slow_count :6d} ({ slow_percentage :5.1f} %)" )
911+ logging .info (
912+ f" Fast commands: { benchmark_fast_count :6d} ({ fast_percentage :5.1f} %)"
913+ )
914+ logging .info (
915+ f" Slow commands: { benchmark_slow_count :6d} ({ slow_percentage :5.1f} %)"
916+ )
893917 logging .info (f" Total F/S: { benchmark_fs_count :6d} (100.0%)" )
894918 else :
895919 logging .info ("No fast/slow commands detected in benchmark ACL categories" )
@@ -923,7 +947,9 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
923947 read_formatted = format_number_with_suffix (read_count )
924948 write_formatted = format_number_with_suffix (write_count )
925949
926- logging .info (f" { group .upper ():>12} ({ group_pct :4.1f} %): { read_formatted :>8} read ({ read_pct :5.1f} %), { write_formatted :>8} write ({ write_pct :5.1f} %)" )
950+ logging .info (
951+ f" { group .upper ():>12} ({ group_pct :4.1f} %): { read_formatted :>8} read ({ read_pct :5.1f} %), { write_formatted :>8} write ({ write_pct :5.1f} %)"
952+ )
927953
928954 total_read_all += read_count
929955 total_write_all += write_count
@@ -935,9 +961,13 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
935961 total_read_formatted = format_number_with_suffix (total_read_all )
936962 total_write_formatted = format_number_with_suffix (total_write_all )
937963
938- logging .info (f" { 'TOTAL' :>12} (100.0%): { total_read_formatted :>8} read ({ total_read_pct :5.1f} %), { total_write_formatted :>8} write ({ total_write_pct :5.1f} %)" )
964+ logging .info (
965+ f" { 'TOTAL' :>12} (100.0%): { total_read_formatted :>8} read ({ total_read_pct :5.1f} %), { total_write_formatted :>8} write ({ total_write_pct :5.1f} %)"
966+ )
939967 else :
940- logging .info ("BENCHMARK TEST SUITES ANALYSIS: No commands with ACL categories found" )
968+ logging .info (
969+ "BENCHMARK TEST SUITES ANALYSIS: No commands with ACL categories found"
970+ )
941971
942972 # CommandStats CSV analysis
943973 if csv_total_command_count > 0 :
@@ -955,8 +985,12 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
955985 write_percentage = (csv_write_count / csv_rw_count ) * 100
956986
957987 logging .info (f"READ/WRITE COMMAND DISTRIBUTION:" )
958- logging .info (f" Read commands: { csv_read_count :8d} ({ read_percentage :5.1f} %)" )
959- logging .info (f" Write commands: { csv_write_count :8d} ({ write_percentage :5.1f} %)" )
988+ logging .info (
989+ f" Read commands: { csv_read_count :8d} ({ read_percentage :5.1f} %)"
990+ )
991+ logging .info (
992+ f" Write commands: { csv_write_count :8d} ({ write_percentage :5.1f} %)"
993+ )
960994 logging .info (f" Total R/W: { csv_rw_count :8d} (100.0%)" )
961995 else :
962996 logging .info ("No read/write commands detected in CSV ACL categories" )
@@ -972,8 +1006,12 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
9721006
9731007 logging .info (f"" )
9741008 logging .info (f"FAST/SLOW COMMAND DISTRIBUTION:" )
975- logging .info (f" Fast commands: { csv_fast_count :8d} ({ fast_percentage :5.1f} %)" )
976- logging .info (f" Slow commands: { csv_slow_count :8d} ({ slow_percentage :5.1f} %)" )
1009+ logging .info (
1010+ f" Fast commands: { csv_fast_count :8d} ({ fast_percentage :5.1f} %)"
1011+ )
1012+ logging .info (
1013+ f" Slow commands: { csv_slow_count :8d} ({ slow_percentage :5.1f} %)"
1014+ )
9771015 logging .info (f" Total F/S: { csv_fs_count :8d} (100.0%)" )
9781016 else :
9791017 logging .info ("No fast/slow commands detected in CSV ACL categories" )
@@ -1007,7 +1045,9 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
10071045 read_formatted = format_number_with_suffix (read_count )
10081046 write_formatted = format_number_with_suffix (write_count )
10091047
1010- logging .info (f" { group .upper ():>12} ({ group_pct :4.1f} %): { read_formatted :>8} read ({ read_pct :5.1f} %), { write_formatted :>8} write ({ write_pct :5.1f} %)" )
1048+ logging .info (
1049+ f" { group .upper ():>12} ({ group_pct :4.1f} %): { read_formatted :>8} read ({ read_pct :5.1f} %), { write_formatted :>8} write ({ write_pct :5.1f} %)"
1050+ )
10111051
10121052 total_read_all += read_count
10131053 total_write_all += write_count
@@ -1019,7 +1059,9 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
10191059 total_read_formatted = format_number_with_suffix (total_read_all )
10201060 total_write_formatted = format_number_with_suffix (total_write_all )
10211061
1022- logging .info (f" { 'TOTAL' :>12} (100.0%): { total_read_formatted :>8} read ({ total_read_pct :5.1f} %), { total_write_formatted :>8} write ({ total_write_pct :5.1f} %)" )
1062+ logging .info (
1063+ f" { 'TOTAL' :>12} (100.0%): { total_read_formatted :>8} read ({ total_read_pct :5.1f} %), { total_write_formatted :>8} write ({ total_write_pct :5.1f} %)"
1064+ )
10231065
10241066 # Validate parsing accuracy by comparing with provided percentages
10251067 if csv_provided_percentages and csv_original_counts :
@@ -1032,7 +1074,9 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
10321074 total_provided_percentage = sum (csv_provided_percentages .values ())
10331075
10341076 logging .info (f"Total original count: { total_original :,} " )
1035- logging .info (f"Sum of provided percentages: { total_provided_percentage :.6f} %" )
1077+ logging .info (
1078+ f"Sum of provided percentages: { total_provided_percentage :.6f} %"
1079+ )
10361080
10371081 # Check if our billion parsing matches original counts
10381082 parsing_errors = 0
@@ -1042,7 +1086,9 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
10421086 original_value = csv_original_counts [cmd ]
10431087 if parsed_value != original_value :
10441088 parsing_errors += 1
1045- logging .warning (f"Parsing mismatch for { cmd } : parsed={ parsed_value :,} vs original={ original_value :,} " )
1089+ logging .warning (
1090+ f"Parsing mismatch for { cmd } : parsed={ parsed_value :,} vs original={ original_value :,} "
1091+ )
10461092
10471093 if parsing_errors == 0 :
10481094 logging .info ("✓ All billion/million/thousand parsing is accurate" )
@@ -1053,10 +1099,14 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
10531099 if abs (total_provided_percentage - 100.0 ) < 0.001 :
10541100 logging .info ("✓ Provided percentages sum to 100%" )
10551101 else :
1056- logging .warning (f"✗ Provided percentages sum to { total_provided_percentage :.6f} % (not 100%)" )
1102+ logging .warning (
1103+ f"✗ Provided percentages sum to { total_provided_percentage :.6f} % (not 100%)"
1104+ )
10571105 else :
10581106 logging .info ("" )
1059- logging .info ("COMMANDSTATS CSV ANALYSIS: No CSV file provided or no commands found" )
1107+ logging .info (
1108+ "COMMANDSTATS CSV ANALYSIS: No CSV file provided or no commands found"
1109+ )
10601110
10611111 logging .info ("=" * 80 )
10621112 # Save pipeline count to CSV
@@ -1184,33 +1234,51 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
11841234 # Benchmark group breakdown
11851235 csv_filename = "benchmark_group_read_write_breakdown.csv"
11861236 with open (csv_filename , "w" , newline = "" ) as csvfile :
1187- fieldnames = ["group" , "read_count" , "write_count" , "total_count" , "read_percentage" , "write_percentage" ]
1237+ fieldnames = [
1238+ "group" ,
1239+ "read_count" ,
1240+ "write_count" ,
1241+ "total_count" ,
1242+ "read_percentage" ,
1243+ "write_percentage" ,
1244+ ]
11881245 writer = csv .DictWriter (csvfile , fieldnames = fieldnames )
11891246 writer .writeheader ()
11901247
1191- all_groups = set (benchmark_group_read .keys ()) | set (benchmark_group_write .keys ())
1248+ all_groups = set (benchmark_group_read .keys ()) | set (
1249+ benchmark_group_write .keys ()
1250+ )
11921251 for group in sorted (all_groups ):
11931252 read_count = benchmark_group_read .get (group , 0 )
11941253 write_count = benchmark_group_write .get (group , 0 )
11951254 total_count = read_count + write_count
11961255 read_pct = (read_count / total_count * 100 ) if total_count > 0 else 0
11971256 write_pct = (write_count / total_count * 100 ) if total_count > 0 else 0
11981257
1199- writer .writerow ({
1200- "group" : group ,
1201- "read_count" : read_count ,
1202- "write_count" : write_count ,
1203- "total_count" : total_count ,
1204- "read_percentage" : round (read_pct , 2 ),
1205- "write_percentage" : round (write_pct , 2 )
1206- })
1258+ writer .writerow (
1259+ {
1260+ "group" : group ,
1261+ "read_count" : read_count ,
1262+ "write_count" : write_count ,
1263+ "total_count" : total_count ,
1264+ "read_percentage" : round (read_pct , 2 ),
1265+ "write_percentage" : round (write_pct , 2 ),
1266+ }
1267+ )
12071268
12081269 logging .info (f"Benchmark group read/write breakdown saved to { csv_filename } " )
12091270
12101271 # CommandStats group breakdown
12111272 csv_filename = "commandstats_group_read_write_breakdown.csv"
12121273 with open (csv_filename , "w" , newline = "" ) as csvfile :
1213- fieldnames = ["group" , "read_count" , "write_count" , "total_count" , "read_percentage" , "write_percentage" ]
1274+ fieldnames = [
1275+ "group" ,
1276+ "read_count" ,
1277+ "write_count" ,
1278+ "total_count" ,
1279+ "read_percentage" ,
1280+ "write_percentage" ,
1281+ ]
12141282 writer = csv .DictWriter (csvfile , fieldnames = fieldnames )
12151283 writer .writeheader ()
12161284
@@ -1222,13 +1290,15 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
12221290 read_pct = (read_count / total_count * 100 ) if total_count > 0 else 0
12231291 write_pct = (write_count / total_count * 100 ) if total_count > 0 else 0
12241292
1225- writer .writerow ({
1226- "group" : group ,
1227- "read_count" : read_count ,
1228- "write_count" : write_count ,
1229- "total_count" : total_count ,
1230- "read_percentage" : round (read_pct , 2 ),
1231- "write_percentage" : round (write_pct , 2 )
1232- })
1293+ writer .writerow (
1294+ {
1295+ "group" : group ,
1296+ "read_count" : read_count ,
1297+ "write_count" : write_count ,
1298+ "total_count" : total_count ,
1299+ "read_percentage" : round (read_pct , 2 ),
1300+ "write_percentage" : round (write_pct , 2 ),
1301+ }
1302+ )
12331303
12341304 logging .info (f"CommandStats group read/write breakdown saved to { csv_filename } " )
0 commit comments