@@ -124,9 +124,9 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
124
124
benchmark_total_command_count = 0
125
125
126
126
# 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
130
130
131
131
# ACL category tracking for commandstats CSV
132
132
csv_read_commands = {}
@@ -136,13 +136,13 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
136
136
csv_total_command_count = 0
137
137
138
138
# 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
142
142
143
143
# Percentage validation tracking
144
144
csv_provided_percentages = {} # command -> provided percentage
145
- csv_original_counts = {} # command -> original count from CSV
145
+ csv_original_counts = {} # command -> original count from CSV
146
146
147
147
override_enabled = args .override_tests
148
148
fail_on_required_diff = args .fail_on_required_diff
@@ -326,10 +326,17 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
326
326
is_read = True
327
327
elif "@pubsub" in acl_categories :
328
328
# 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
+ ]:
330
335
is_read = True
331
336
else :
332
- is_write = True # PUBLISH and other pubsub commands
337
+ is_write = (
338
+ True # PUBLISH and other pubsub commands
339
+ )
333
340
else :
334
341
# Commands without explicit read/write ACL but not _ro are assumed write
335
342
# This covers cases like EVALSHA which can modify data
@@ -579,7 +586,9 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
579
586
acl_categories = command_json ["acl_categories" ]
580
587
581
588
# 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
+ )
583
592
csv_total_command_count += tracking_count
584
593
585
594
# Track total by group (all commands)
@@ -600,7 +609,12 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
600
609
is_read = True
601
610
elif "@pubsub" in acl_categories :
602
611
# 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
+ ]:
604
618
is_read = True
605
619
else :
606
620
is_write = True # PUBLISH and other pubsub commands
@@ -643,7 +657,9 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
643
657
# Use original count if available and different from parsed count
644
658
final_count = count
645
659
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
+ )
647
663
final_count = original_count
648
664
649
665
priority [cmd .lower ()] = final_count
@@ -871,8 +887,12 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
871
887
write_percentage = (benchmark_write_count / benchmark_rw_count ) * 100
872
888
873
889
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
+ )
876
896
logging .info (f" Total R/W: { benchmark_rw_count :6d} (100.0%)" )
877
897
else :
878
898
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):
888
908
889
909
logging .info (f"" )
890
910
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
+ )
893
917
logging .info (f" Total F/S: { benchmark_fs_count :6d} (100.0%)" )
894
918
else :
895
919
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):
923
947
read_formatted = format_number_with_suffix (read_count )
924
948
write_formatted = format_number_with_suffix (write_count )
925
949
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
+ )
927
953
928
954
total_read_all += read_count
929
955
total_write_all += write_count
@@ -935,9 +961,13 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
935
961
total_read_formatted = format_number_with_suffix (total_read_all )
936
962
total_write_formatted = format_number_with_suffix (total_write_all )
937
963
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
+ )
939
967
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
+ )
941
971
942
972
# CommandStats CSV analysis
943
973
if csv_total_command_count > 0 :
@@ -955,8 +985,12 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
955
985
write_percentage = (csv_write_count / csv_rw_count ) * 100
956
986
957
987
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
+ )
960
994
logging .info (f" Total R/W: { csv_rw_count :8d} (100.0%)" )
961
995
else :
962
996
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):
972
1006
973
1007
logging .info (f"" )
974
1008
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
+ )
977
1015
logging .info (f" Total F/S: { csv_fs_count :8d} (100.0%)" )
978
1016
else :
979
1017
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):
1007
1045
read_formatted = format_number_with_suffix (read_count )
1008
1046
write_formatted = format_number_with_suffix (write_count )
1009
1047
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
+ )
1011
1051
1012
1052
total_read_all += read_count
1013
1053
total_write_all += write_count
@@ -1019,7 +1059,9 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
1019
1059
total_read_formatted = format_number_with_suffix (total_read_all )
1020
1060
total_write_formatted = format_number_with_suffix (total_write_all )
1021
1061
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
+ )
1023
1065
1024
1066
# Validate parsing accuracy by comparing with provided percentages
1025
1067
if csv_provided_percentages and csv_original_counts :
@@ -1032,7 +1074,9 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
1032
1074
total_provided_percentage = sum (csv_provided_percentages .values ())
1033
1075
1034
1076
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
+ )
1036
1080
1037
1081
# Check if our billion parsing matches original counts
1038
1082
parsing_errors = 0
@@ -1042,7 +1086,9 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
1042
1086
original_value = csv_original_counts [cmd ]
1043
1087
if parsed_value != original_value :
1044
1088
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
+ )
1046
1092
1047
1093
if parsing_errors == 0 :
1048
1094
logging .info ("✓ All billion/million/thousand parsing is accurate" )
@@ -1053,10 +1099,14 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
1053
1099
if abs (total_provided_percentage - 100.0 ) < 0.001 :
1054
1100
logging .info ("✓ Provided percentages sum to 100%" )
1055
1101
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
+ )
1057
1105
else :
1058
1106
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
+ )
1060
1110
1061
1111
logging .info ("=" * 80 )
1062
1112
# Save pipeline count to CSV
@@ -1184,33 +1234,51 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
1184
1234
# Benchmark group breakdown
1185
1235
csv_filename = "benchmark_group_read_write_breakdown.csv"
1186
1236
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
+ ]
1188
1245
writer = csv .DictWriter (csvfile , fieldnames = fieldnames )
1189
1246
writer .writeheader ()
1190
1247
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
+ )
1192
1251
for group in sorted (all_groups ):
1193
1252
read_count = benchmark_group_read .get (group , 0 )
1194
1253
write_count = benchmark_group_write .get (group , 0 )
1195
1254
total_count = read_count + write_count
1196
1255
read_pct = (read_count / total_count * 100 ) if total_count > 0 else 0
1197
1256
write_pct = (write_count / total_count * 100 ) if total_count > 0 else 0
1198
1257
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
+ )
1207
1268
1208
1269
logging .info (f"Benchmark group read/write breakdown saved to { csv_filename } " )
1209
1270
1210
1271
# CommandStats group breakdown
1211
1272
csv_filename = "commandstats_group_read_write_breakdown.csv"
1212
1273
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
+ ]
1214
1282
writer = csv .DictWriter (csvfile , fieldnames = fieldnames )
1215
1283
writer .writeheader ()
1216
1284
@@ -1222,13 +1290,15 @@ def generate_stats_cli_command_logic(args, project_name, project_version):
1222
1290
read_pct = (read_count / total_count * 100 ) if total_count > 0 else 0
1223
1291
write_pct = (write_count / total_count * 100 ) if total_count > 0 else 0
1224
1292
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
+ )
1233
1303
1234
1304
logging .info (f"CommandStats group read/write breakdown saved to { csv_filename } " )
0 commit comments