@@ -27,7 +27,7 @@ def parse_experiment_output(lines):
27
27
data = json .loads (line .strip ())
28
28
# required_fields = ['status_code', 'start_time', 'end_time', 'latency', 'throughput',
29
29
# 'prompt_tokens', 'output_tokens', 'total_tokens', 'input', 'output']
30
- required_fields = ['start_time' , 'end_time' , 'latency' , 'throughput' ,
30
+ required_fields = ['status' , ' start_time' , 'end_time' , 'latency' , 'throughput' ,
31
31
'prompt_tokens' , 'output_tokens' , 'total_tokens' , 'input' , 'output' ]
32
32
if any (field not in data for field in required_fields ):
33
33
missingfields = [field not in data for field in required_fields ]
@@ -49,8 +49,8 @@ def parse_experiment_output(lines):
49
49
rps_series = df .groupby ('second_bucket' ).size ()
50
50
df ['rps' ] = df ['second_bucket' ].map (rps_series )
51
51
52
- success_rps = df [df ['status_code ' ] == 200 ].groupby ('second_bucket' ).size ()
53
- failed_rps = df [df ['status_code ' ] != 200 ].groupby ('second_bucket' ).size ()
52
+ success_rps = df [df ['status ' ] == 'success' ].groupby ('second_bucket' ).size ()
53
+ failed_rps = df [df ['status ' ] != 'success' ].groupby ('second_bucket' ).size ()
54
54
df ['success_rps' ] = df ['second_bucket' ].map (success_rps ).fillna (0 )
55
55
df ['failed_rps' ] = df ['second_bucket' ].map (failed_rps ).fillna (0 )
56
56
@@ -178,7 +178,7 @@ def analyze_performance(df):
178
178
raise Exception (f"Error analyzing performance metrics: { e } " )
179
179
180
180
181
- def plot_combined_visualization (experiment_home_dir ):
181
+ def plot_combined_visualization (experiment_home_dir , workload_type ):
182
182
# Create figure
183
183
fig = plt .figure (figsize = (12 , 12 ))
184
184
@@ -418,18 +418,19 @@ def plot_combined_visualization(experiment_home_dir):
418
418
plt .tight_layout ()
419
419
420
420
# Save the combined figure
421
- output_path = os .path .join (experiment_home_dir , 'combined_visualization.pdf' )
421
+ output_path = os .path .join (experiment_home_dir , f 'combined_visualization- { workload_type } .pdf' )
422
422
plt .savefig (output_path , bbox_inches = 'tight' )
423
423
print (f"** Saved combined visualization to: { output_path } " )
424
424
plt .close ()
425
425
426
426
def main ():
427
- if len (sys .argv ) != 2 :
428
- print ("Usage: python script.py <experiment_home_dir>" )
427
+ if len (sys .argv ) != 3 :
428
+ print ("Usage: python script.py <experiment_home_dir> <workload_type> " )
429
429
return 1
430
430
431
431
experiment_home_dir = sys .argv [1 ]
432
- plot_combined_visualization (experiment_home_dir )
432
+ workload_type = sys .argv [2 ]
433
+ plot_combined_visualization (experiment_home_dir , workload_type )
433
434
return 0
434
435
435
436
if __name__ == "__main__" :
0 commit comments