Skip to content

Commit 7ea329c

Browse files
committed
workflow updates
1 parent 819a108 commit 7ea329c

File tree

1 file changed

+72
-10
lines changed

1 file changed

+72
-10
lines changed

.github/workflows/run-bench.yml

Lines changed: 72 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,30 @@ jobs:
8282
echo "Files in current directory:"
8383
ls -la
8484
85-
- name: Upload Bench Results
85+
- name: Upload Benchmark Results
8686
uses: actions/upload-artifact@v4
8787
with:
88-
name: bench-results-${{ matrix.isa }}-${{ matrix.tag }}
88+
name: benchmark-results-${{ matrix.isa }}-jdk${{ matrix.jdk }}
8989
path: |
90-
bench-results.json
9190
bench-results.csv
9291
if-no-files-found: warn
9392

9493
- name: Download Previous Benchmark Results
94+
uses: dawidd6/action-download-artifact@v2
95+
continue-on-error: true
96+
with:
97+
workflow: run-bench.yml
98+
name: benchmark-results-${{ matrix.isa }}-jdk${{ matrix.jdk }}
99+
path: previous-results
100+
skip_unpack: false
101+
if_no_artifact_found: warn
102+
103+
- name: Download All Benchmark Results
95104
uses: actions/download-artifact@v4
105+
with:
106+
path: all-benchmark-results
107+
pattern: benchmark-results-*
108+
merge-multiple: true
96109

97110
- name: Set up Python
98111
uses: actions/setup-python@v4
@@ -102,7 +115,7 @@ jobs:
102115
- name: Install Python Dependencies
103116
run: |
104117
python -m pip install --upgrade pip
105-
pip install argparse matplotlib pandas
118+
pip install argparse matplotlib pandas tabulate
106119
107120
- name: Combine results and create visualizations
108121
run: |
@@ -113,29 +126,71 @@ jobs:
113126
import matplotlib.pyplot as plt
114127
115128
# Find all CSV files
116-
csv_files = glob.glob('benchmark-results-*/benchmark-*.csv')
129+
csv_files = glob.glob('all-benchmark-results/**/bench-results.csv', recursive=True)
130+
131+
if not csv_files:
132+
print("No benchmark results found! Checking other possible locations...")
133+
csv_files = glob.glob('**/bench-results.csv', recursive=True)
134+
135+
print(f"Found {len(csv_files)} CSV files:")
136+
for f in csv_files:
137+
print(f" - {f}")
117138
118139
# Read and combine all results
119140
dfs = []
120141
for file in csv_files:
121-
df = pd.read_csv(file)
122-
dfs.append(df)
142+
try:
143+
# Extract version from path
144+
parts = file.split('/')
145+
# Try to extract version from directory name
146+
version = "unknown"
147+
for part in parts:
148+
if part.startswith("v") or part.startswith("4."):
149+
version = part
150+
break
151+
152+
df = pd.read_csv(file)
153+
# Add version column if not present
154+
if 'version' not in df.columns:
155+
df['version'] = version
156+
157+
dfs.append(df)
158+
print(f"Processed {file} with version {version}")
159+
except Exception as e:
160+
print(f"Error processing {file}: {e}")
123161
124162
if not dfs:
125-
print("No benchmark results found!")
163+
print("No valid benchmark results found!")
126164
exit(1)
127165
128166
combined_df = pd.concat(dfs)
129167
combined_df.to_csv('all_benchmark_results.csv', index=False)
130168
print(f"Combined {len(dfs)} benchmark results")
131169
132170
# Sort by version for proper ordering in plots
133-
combined_df['version_sort'] = combined_df['version'].str.replace('v', '').apply(lambda x: [int(p) if p.isdigit() else p for p in x.split('.')])
171+
# Handle version strings like 4.0.0-beta.6
172+
def version_key(v):
173+
if isinstance(v, str):
174+
v = v.replace('v', '')
175+
parts = []
176+
for part in v.replace('-', '.').split('.'):
177+
try:
178+
parts.append(int(part))
179+
except ValueError:
180+
parts.append(part)
181+
return parts
182+
return v
183+
184+
combined_df['version_sort'] = combined_df['version'].apply(version_key)
134185
combined_df = combined_df.sort_values('version_sort')
135186
136187
# Create plots for each metric
137188
metrics = ['QPS', 'Mean Latency', 'Recall@10']
138189
for metric in metrics:
190+
if metric not in combined_df.columns:
191+
print(f"Warning: Metric {metric} not found in results")
192+
continue
193+
139194
plt.figure(figsize=(10, 6))
140195
141196
for dataset, group in combined_df.groupby('dataset'):
@@ -159,10 +214,17 @@ jobs:
159214
f.write(f"Comparing {len(combined_df['version'].unique())} versions of JVector\n\n")
160215
161216
f.write("## Summary Table\n\n")
162-
f.write(combined_df[['version', 'dataset', 'QPS', 'Mean Latency', 'Recall@10']].to_markdown(index=False))
217+
# Use to_markdown if available, otherwise use to_string
218+
try:
219+
table = combined_df[['version', 'dataset'] + [m for m in metrics if m in combined_df.columns]].to_markdown(index=False)
220+
except AttributeError:
221+
table = combined_df[['version', 'dataset'] + [m for m in metrics if m in combined_df.columns]].to_string(index=False)
222+
f.write(table)
163223
164224
f.write("\n\n## Visualizations\n\n")
165225
for metric in metrics:
226+
if metric not in combined_df.columns:
227+
continue
166228
safe_metric = metric.replace('@', '_at_').replace(' ', '_')
167229
f.write(f"### {metric}\n\n")
168230
f.write(f"![{metric} Chart]({safe_metric}.png)\n\n")

0 commit comments

Comments
 (0)