-
Notifications
You must be signed in to change notification settings - Fork 186
Expand file tree
/
Copy pathdisplay_graphs.py
More file actions
50 lines (39 loc) · 1.9 KB
/
display_graphs.py
File metadata and controls
50 lines (39 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import sys
from pathlib import Path
def display_graphs(exp_name, repo, run_id, artifact_name):
"""Display performance graphs in GitHub Actions summary with artifact links."""
print("\n## Performance Graphs\n")
# Find all generated graphs
current_dir = Path('.')
# Look for tput_vs_intvty graphs
intvty_graphs = sorted(current_dir.glob(f'tput_vs_intvty_*_{exp_name}.png'))
e2el_graphs = sorted(current_dir.glob(f'tput_vs_e2el_*_{exp_name}.png'))
# Construct artifact download URL
artifact_url = f"https://github.com/{repo}/actions/runs/{run_id}/artifacts"
# Display interactivity graphs
if intvty_graphs:
print("### Throughput vs Interactivity\n")
for graph in intvty_graphs:
# Extract model name from filename
model_name = graph.name.replace(f'tput_vs_intvty_', '').replace(f'_{exp_name}.png', '')
print(f"#### {model_name.upper()}\n")
print(f"📊 [{graph.name}]({artifact_url}) (download `{artifact_name}` artifact)\n")
# Display end-to-end latency graphs
if e2el_graphs:
print("### Throughput vs End-to-End Latency\n")
for graph in e2el_graphs:
# Extract model name from filename
model_name = graph.name.replace(f'tput_vs_e2el_', '').replace(f'_{exp_name}.png', '')
print(f"#### {model_name.upper()}\n")
print(f"📊 [{graph.name}]({artifact_url}) (download `{artifact_name}` artifact)\n")
if not intvty_graphs and not e2el_graphs:
print("*No performance graphs were generated.*\n")
if __name__ == '__main__':
if len(sys.argv) < 5:
print("Usage: python3 display_graphs.py <exp_name> <repo> <run_id> <artifact_name>")
sys.exit(1)
exp_name = sys.argv[1]
repo = sys.argv[2]
run_id = sys.argv[3]
artifact_name = sys.argv[4]
display_graphs(exp_name, repo, run_id, artifact_name)