Skip to content

Commit bb76159

Browse files
committed
update plotting script for success rate
1 parent 7dafacf commit bb76159

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

benchmarks/autoscaling/plot-everything.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def parse_experiment_output(lines):
2727
data = json.loads(line.strip())
2828
# required_fields = ['status_code', 'start_time', 'end_time', 'latency', 'throughput',
2929
# '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',
3131
'prompt_tokens', 'output_tokens', 'total_tokens', 'input', 'output']
3232
if any(field not in data for field in required_fields):
3333
missingfields = [field not in data for field in required_fields]
@@ -49,8 +49,8 @@ def parse_experiment_output(lines):
4949
rps_series = df.groupby('second_bucket').size()
5050
df['rps'] = df['second_bucket'].map(rps_series)
5151

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()
5454
df['success_rps'] = df['second_bucket'].map(success_rps).fillna(0)
5555
df['failed_rps'] = df['second_bucket'].map(failed_rps).fillna(0)
5656

@@ -178,7 +178,7 @@ def analyze_performance(df):
178178
raise Exception(f"Error analyzing performance metrics: {e}")
179179

180180

181-
def plot_combined_visualization(experiment_home_dir):
181+
def plot_combined_visualization(experiment_home_dir, workload_type):
182182
# Create figure
183183
fig = plt.figure(figsize=(12, 12))
184184

@@ -418,18 +418,19 @@ def plot_combined_visualization(experiment_home_dir):
418418
plt.tight_layout()
419419

420420
# 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')
422422
plt.savefig(output_path, bbox_inches='tight')
423423
print(f"** Saved combined visualization to: {output_path}")
424424
plt.close()
425425

426426
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>")
429429
return 1
430430

431431
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)
433434
return 0
434435

435436
if __name__ == "__main__":

0 commit comments

Comments
 (0)