@@ -75,39 +75,39 @@ jobs:
7575 output=$(bash run.sh)
7676 echo "$output"
7777
78- # Extract metrics using Python and regex
79- python - << EOF
80- import re
81- import json
82-
83- text = \"\"\"${output}\"\"\"
84-
85- ttft_pattern = r"TTFT : ([\d.]+) ms ± ([\d.]+)%"
86- e2e_latency_pattern = r"E2E Latency : ([\d.]+) ms ± ([\d.]+)%"
87- tpot_pattern = r"TPOT : ([\d.]+) ms"
88-
89- ttft_match = re.search(ttft_pattern, text)
90- e2e_latency_match = re.search(e2e_latency_pattern, text)
91- tpot_match = re.search(tpot_pattern, text)
92-
93- metrics = {
94- " TTFT " : {"value": ttft_match.group(1) if ttft_match else None, "std_dev": ttft_match.group(2) if ttft_match else None},
95- " E2E Latency " : {"value": e2e_latency_match.group(1) if e2e_latency_match else None, "std_dev": e2e_latency_match.group(2) if e2e_latency_match else None},
96- " TPOT " : {"value": tpot_match.group(1) if tpot_match else None},
97- }
98-
99- with open("metrics.json", "w") as f :
100- json.dump(metrics, f, indent=4)
101-
102- print(f"::set-output name=metrics::{json.dumps(metrics)}")
103- EOF
104-
105- # Upload metrics as an artifact (optional)
106- # Create the results directory if it doesn't exist
107- mkdir -p ../../../../../results
78+ # Extract metrics using Python and regex
79+ python - << EOF
80+ import re
81+ import json
82+
83+ text = \"\"\"${output}\"\"\"
84+
85+ ttft_pattern = r"TTFT: ([\d.]+) ms ± ([\d.]+)%"
86+ e2e_latency_pattern = r"E2E Latency: ([\d.]+) ms ± ([\d.]+)%"
87+ tpot_pattern = r"TPOT: ([\d.]+) ms"
88+
89+ ttft_match = re.search(ttft_pattern, text)
90+ e2e_latency_match = re.search(e2e_latency_pattern, text)
91+ tpot_match = re.search(tpot_pattern, text)
92+
93+ metrics = {
94+ "TTFT": {"value": ttft_match.group(1) if ttft_match else None, "std_dev": ttft_match.group(2) if ttft_match else None},
95+ "E2E Latency": {"value": e2e_latency_match.group(1) if e2e_latency_match else None, "std_dev": e2e_latency_match.group(2) if e2e_latency_match else None},
96+ "TPOT": {"value": tpot_match.group(1) if tpot_match else None},
97+ }
98+
99+ with open("metrics.json", "w") as f:
100+ json.dump(metrics, f, indent=4)
101+
102+ print(f"::set-output name=metrics::{json.dumps(metrics)}")
103+ EOF
108104
109- # Copy the metrics.json file to the results directory
110- cp metrics.json ../../../../../results/
105+ # Upload metrics as an artifact (optional)
106+ # Create the results directory if it doesn't exist
107+ mkdir -p ../../../../../results
108+
109+ # Copy the metrics.json file to the results directory
110+ cp metrics.json ../../../../../results/
111111
112112 - name : Wait For Connection
113113 uses : google-ml-infra/actions/ci_connection@main
0 commit comments