Skip to content

Commit c596fec

Browse files
Replace base64 encoding with artifact links
Co-authored-by: functionstackx <47992694+functionstackx@users.noreply.github.com>
1 parent cf8f376 commit c596fec

2 files changed

Lines changed: 22 additions & 20 deletions

File tree

.github/workflows/collect-results.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,19 @@ jobs:
4242
pip install -q matplotlib
4343
python3 utils/plot_perf.py results/ ${{ inputs.exp-name || 'all' }}
4444
45-
- name: Display graphs in summary
46-
run: python3 utils/display_graphs.py ${{ inputs.exp-name || 'all' }} >> $GITHUB_STEP_SUMMARY
47-
4845
- name: Upload performance graphs
4946
uses: actions/upload-artifact@v5
5047
with:
5148
name: graphs_${{ inputs.exp-name || 'all' }}
5249
path: |
5350
tput_vs_intvty_*_${{ inputs.exp-name || 'all' }}.png
5451
tput_vs_e2el_*_${{ inputs.exp-name || 'all' }}.png
52+
53+
- name: Display graphs in summary
54+
run: |
55+
python3 utils/display_graphs.py \
56+
${{ inputs.exp-name || 'all' }} \
57+
${{ github.repository }} \
58+
${{ github.run_id }} \
59+
graphs_${{ inputs.exp-name || 'all' }} \
60+
>> $GITHUB_STEP_SUMMARY

utils/display_graphs.py

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
import sys
2-
import base64
32
from pathlib import Path
43

54

6-
def encode_image_to_base64(image_path):
7-
"""Encode an image file to base64 string."""
8-
with open(image_path, 'rb') as image_file:
9-
encoded = base64.b64encode(image_file.read()).decode('utf-8')
10-
return encoded
11-
12-
13-
def display_graphs(exp_name):
14-
"""Display performance graphs in GitHub Actions summary."""
5+
def display_graphs(exp_name, repo, run_id, artifact_name):
6+
"""Display performance graphs in GitHub Actions summary with artifact links."""
157
print("\n## Performance Graphs\n")
168

179
# Find all generated graphs
@@ -21,34 +13,38 @@ def display_graphs(exp_name):
2113
intvty_graphs = sorted(current_dir.glob(f'tput_vs_intvty_*_{exp_name}.png'))
2214
e2el_graphs = sorted(current_dir.glob(f'tput_vs_e2el_*_{exp_name}.png'))
2315

16+
# Construct artifact download URL
17+
artifact_url = f"https://github.com/{repo}/actions/runs/{run_id}/artifacts"
18+
2419
# Display interactivity graphs
2520
if intvty_graphs:
2621
print("### Throughput vs Interactivity\n")
2722
for graph in intvty_graphs:
2823
# Extract model name from filename
2924
model_name = graph.name.replace(f'tput_vs_intvty_', '').replace(f'_{exp_name}.png', '')
30-
base64_image = encode_image_to_base64(graph)
3125
print(f"#### {model_name.upper()}\n")
32-
print(f"![Throughput vs Interactivity - {model_name}](data:image/png;base64,{base64_image})\n")
26+
print(f"📊 [{graph.name}]({artifact_url}) (download `{artifact_name}` artifact)\n")
3327

3428
# Display end-to-end latency graphs
3529
if e2el_graphs:
3630
print("### Throughput vs End-to-End Latency\n")
3731
for graph in e2el_graphs:
3832
# Extract model name from filename
3933
model_name = graph.name.replace(f'tput_vs_e2el_', '').replace(f'_{exp_name}.png', '')
40-
base64_image = encode_image_to_base64(graph)
4134
print(f"#### {model_name.upper()}\n")
42-
print(f"![Throughput vs E2E Latency - {model_name}](data:image/png;base64,{base64_image})\n")
35+
print(f"📊 [{graph.name}]({artifact_url}) (download `{artifact_name}` artifact)\n")
4336

4437
if not intvty_graphs and not e2el_graphs:
4538
print("*No performance graphs were generated.*\n")
4639

4740

4841
if __name__ == '__main__':
49-
if len(sys.argv) < 2:
50-
print("Usage: python3 display_graphs.py <exp_name>")
42+
if len(sys.argv) < 5:
43+
print("Usage: python3 display_graphs.py <exp_name> <repo> <run_id> <artifact_name>")
5144
sys.exit(1)
5245

5346
exp_name = sys.argv[1]
54-
display_graphs(exp_name)
47+
repo = sys.argv[2]
48+
run_id = sys.argv[3]
49+
artifact_name = sys.argv[4]
50+
display_graphs(exp_name, repo, run_id, artifact_name)

0 commit comments

Comments
 (0)