Skip to content

Commit 9fa1038

Browse files
committed
update benchmark
Signed-off-by: Gregor Zeitlinger <[email protected]>
1 parent f49854c commit 9fa1038

File tree

2 files changed

+44
-5
lines changed

2 files changed

+44
-5
lines changed

.mise/tasks/update_benchmarks.py

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
any <pre>...</pre> blocks containing "thrpt" under the `benchmarks/` module
99
(files such as Java sources with embedded example output in javadocs).
1010
11-
Usage: ./scripts/update_benchmarks.py [--mvnw ./mvnw] [--module benchmarks] [--java java] [--jmh-args "-f 1 -wi 0 -i 1"]
11+
Usage: ./.mise/tasks/update_benchmarks.py [--mvnw ./mvnw] [--module benchmarks] [--java java] [--jmh-args "-f 1 -wi 0 -i 1"]
1212
1313
By default this will:
1414
- run the maven wrapper to package the benchmarks: `./mvnw -pl benchmarks -am -DskipTests package`
@@ -32,11 +32,39 @@
3232

3333

3434
def run_cmd(cmd: List[str], cwd: Optional[str] = None) -> str:
35-
proc = subprocess.run(cmd, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
35+
"""Run a command, stream stdout/stderr to the console for progress, and return the full output.
36+
37+
This replaces the previous blocking subprocess.run approach so users can see build / JMH
38+
progress in real time while the command runs.
39+
"""
40+
try:
41+
proc = subprocess.Popen(cmd, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
42+
except FileNotFoundError:
43+
# Helpful message if the executable is not found
44+
print(f"Command not found: {cmd[0]}")
45+
raise
46+
47+
output_lines: List[str] = []
48+
try:
49+
assert proc.stdout is not None
50+
# Stream lines as they appear and capture them for returning
51+
for line in proc.stdout:
52+
# Print immediately so callers (and CI) can observe progress
53+
print(line, end='')
54+
output_lines.append(line)
55+
proc.wait()
56+
except KeyboardInterrupt:
57+
# If the user interrupts, ensure the child process is terminated
58+
proc.kill()
59+
proc.wait()
60+
print('\nCommand interrupted by user.')
61+
raise
62+
63+
output = ''.join(output_lines)
3664
if proc.returncode != 0:
37-
print(f"Command failed: {' '.join(cmd)}\nExit: {proc.returncode}\nOutput:\n{proc.stdout}")
65+
print(f"Command failed: {' '.join(cmd)}\nExit: {proc.returncode}\nOutput:\n{output}")
3866
raise SystemExit(proc.returncode)
39-
return proc.stdout
67+
return output
4068

4169

4270
def build_benchmarks(mvnw: str, module: str) -> None:

RELEASING.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
# Create a Release
1+
# Releasing Instructions for Prometheus Java Client
2+
3+
## Before the Release
4+
5+
If there have been significant changes since the last release, update the
6+
benchmarks before creating a new release:
7+
8+
```shell
9+
mise run update-benchmarks
10+
```
11+
12+
## Create a Release
213

314
1. Go to <https://github.com/prometheus/client_java/releases/new>
415
2. Click on "Choose a tag", enter the tag name (e.g. `v0.1.0`), and click "Create a new tag".

0 commit comments

Comments
 (0)