Repository navigation
Add benchmark environments for Python 3.15 and 3.15t (GH-1324) #1409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,12 +53,19 @@ Parameters: | |
| Description: Image for arm64 hosts. | ||
| UvVersion: | ||
| Type: String | ||
| Default: '0.12.5' | ||
| # A release that knows the Python versions below; 0.12.5 knows no 3.15 release. | ||
| Default: '0.13.7' | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Independent follow-up review (relayed): Codex CLI Covered: the repair diff; interpreter installation; all five bootstrap environments; workspace groups and the lockfile; Result: CLEAN. |
||
| AllowedPattern: '[0-9]+\.[0-9]+\.[0-9]+' | ||
| PythonVersion: | ||
| Type: String | ||
| Default: '3.12.14' | ||
| AllowedPattern: '3\.12\.[0-9]+' | ||
| # The filesystem environments, .venv-fs315 and .venv-fs315t, of this version and its | ||
| # free-threaded build. | ||
| FilesystemPythonVersion: | ||
| Type: String | ||
| Default: '3.15.2' | ||
| AllowedPattern: '3\.15\.[0-9]+' | ||
| WorkGroup: | ||
| Type: String | ||
| Default: pyathena | ||
|
|
@@ -353,17 +360,20 @@ Resources: | |
| - | | ||
| #!/bin/bash | ||
| set -euo pipefail | ||
| dnf install -y git aws-cfn-bootstrap | ||
| # gcc builds the wheels that the free-threaded interpreter lacks, such as psutil's. | ||
| dnf install -y git aws-cfn-bootstrap gcc | ||
| trap '/opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource Fleet --region ${AWS::Region}' EXIT | ||
| curl --proto '=https' --tlsv1.2 -LsSf https://astral.sh/uv/${UvVersion}/install.sh | env UV_INSTALL_DIR=/usr/local/bin sh | ||
| git clone https://github.com/pyathena-dev/PyAthena.git /opt/pyathena | ||
| git -C /opt/pyathena fetch origin ${GitCommit} | ||
| git -C /opt/pyathena checkout --detach ${GitCommit} | ||
| export UV_PYTHON_INSTALL_DIR=/opt/uv-python | ||
| uv python install ${PythonVersion} | ||
| uv python install ${PythonVersion} ${FilesystemPythonVersion} ${FilesystemPythonVersion}t | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Self-review round two (claims, compatibility, operations): base Claims checked:
Existing callers: the default, polars2, and s3fs environments still import the adapters before the baseline, so their measurements are unchanged; Operator: the bootstrap installs gcc and two more interpreters and environments, which lengthens host setup; the psutil build needs gcc. The FINDINGS: none. |
||
| uv sync --directory /opt/pyathena/benchmarks --locked --no-default-groups --group polars1 --python ${PythonVersion} | ||
| UV_PROJECT_ENVIRONMENT=/opt/pyathena/.venv-polars2 uv sync --directory /opt/pyathena/benchmarks --locked --no-default-groups --group polars2 --python ${PythonVersion} | ||
| UV_PROJECT_ENVIRONMENT=/opt/pyathena/.venv-s3fs uv sync --directory /opt/pyathena/benchmarks --locked --no-default-groups --group s3fs --python ${PythonVersion} | ||
| UV_PROJECT_ENVIRONMENT=/opt/pyathena/.venv-fs315 uv sync --directory /opt/pyathena/benchmarks --locked --only-group filesystem --python ${FilesystemPythonVersion} | ||
| UV_PROJECT_ENVIRONMENT=/opt/pyathena/.venv-fs315t uv sync --directory /opt/pyathena/benchmarks --locked --only-group filesystem --python ${FilesystemPythonVersion}t | ||
| chmod -R a+rX /opt/uv-python | ||
| chown -R ec2-user:ec2-user /opt/pyathena | ||
| printf '%s\n' '${AWS::StackId}' > /opt/pyathena/benchmarks/stack-id.txt | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,7 +34,6 @@ | |
| import psutil | ||
|
|
||
| from pyathena.util import parse_output_location | ||
| from pyathena_bench.adapters import BACKEND_VERSIONS, Adapter, run_adapter | ||
| from pyathena_bench.aws import ( | ||
| cancel_queries, | ||
| client, | ||
|
|
@@ -52,6 +51,25 @@ | |
| from pyathena_bench.objects import run_objects | ||
| from pyathena_bench.report import CHECKPOINT, read_trials, trial_key | ||
|
|
||
| # The Athena suites' adapters import every DataFrame backend; the filesystem | ||
| # environment, for interpreters that lack their wheels, has none of them and runs | ||
| # only the filesystem and objects suites. | ||
| try: | ||
| from pyathena_bench import adapters | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Self-review round one (implementation behavior): base Covered: the import chain of every harness module (only Result: CLEAN for the implementation. Limits: the trial-level |
||
| except ModuleNotFoundError: | ||
| adapters = None # type: ignore[assignment] | ||
|
|
||
|
|
||
| def gil_enabled() -> bool: | ||
| """Return whether the GIL is enabled, also after an import re-enabled it. | ||
|
|
||
| Returns: | ||
| False only on a free-threaded interpreter that still runs without the GIL. | ||
| """ | ||
| is_gil_enabled = getattr(sys, "_is_gil_enabled", None) | ||
| return True if is_gil_enabled is None else bool(is_gil_enabled()) | ||
|
|
||
|
|
||
| _logger = logging.getLogger(__name__) | ||
|
|
||
|
|
||
|
|
@@ -140,21 +158,27 @@ def worker(pipe: Connection, payload: dict[str, Any]) -> None: | |
| Path(payload["temp_dir"]), | ||
| ) | ||
| else: | ||
| adapter = Adapter( | ||
| if adapters is None: | ||
| raise RuntimeError( | ||
| "The Athena suites need the DataFrame backends of the default environment" | ||
| ) | ||
| adapter = adapters.Adapter( | ||
| settings, | ||
| case, | ||
| session_, | ||
| payload["database"], | ||
| payload["output"], | ||
| payload["temp_table"], | ||
| ) | ||
| measurement = run_adapter( | ||
| measurement = adapters.run_adapter( | ||
| adapter, payload["sql"], payload["expected_rows"], payload.get("fixture") | ||
| ) | ||
| observer.send({"event": "ready"}) | ||
| pipe.recv() | ||
| result = asyncio.run(measurement) | ||
| result["athena"] = list(observer.completed.values()) | ||
| # Read after the measurement, which imports the filesystem's libraries. | ||
| result["gil_enabled"] = gil_enabled() | ||
| for query in result["queries"]: | ||
| if query.get("query_id") is None and len(observer.completed) == 1: | ||
| query["query_id"] = next(iter(observer.completed)) | ||
|
|
@@ -404,7 +428,8 @@ def environment(settings: Settings) -> dict[str, Any]: | |
| "python": sys.version, | ||
| "platform": platform.platform(), | ||
| "machine": platform.machine(), | ||
| "backends_imported_before_baseline": BACKEND_VERSIONS, | ||
| "backends_imported_before_baseline": adapters.BACKEND_VERSIONS if adapters else {}, | ||
| "gil_enabled": gil_enabled(), | ||
| "cpu_count": psutil.cpu_count(), | ||
| "memory_bytes": psutil.virtual_memory().total, | ||
| "dependencies": {d.metadata["Name"]: d.version for d in importlib.metadata.distributions()}, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # Copyright 2026 The PyAthena authors | ||
| # | ||
| # Licensed under the MIT License. | ||
| # See LICENSE or https://opensource.org/licenses/MIT. | ||
| # | ||
| # SPDX-License-Identifier: MIT | ||
|
|
||
| """Event-loop lag sampling, shared by every suite without importing a DataFrame backend.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import asyncio | ||
| import time | ||
|
|
||
|
|
||
| async def heartbeat(interval: float, stop: asyncio.Event, samples: list[float]) -> None: | ||
| """Record how late the event loop wakes a sleeping task, until stopped. | ||
|
|
||
| Args: | ||
| interval: The sleep of each sample, in seconds. | ||
| stop: Event that ends the sampling. | ||
| samples: List to append the lag of each wake-up to, in seconds. | ||
| """ | ||
| while not stop.is_set(): | ||
| start = time.perf_counter() | ||
| await asyncio.sleep(interval) | ||
| samples.append(max(0.0, time.perf_counter() - start - interval)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Independent review (relayed): Codex CLI
codex exec -s read-only(model gpt-6-astra, session01a1d5de-dc04-7b93-87bc-248698869787), static review only, base13031a5daf4d2afd66eba33c50089024ec48314e, head9a9935063f3a08ff318a9555025f2f67a0b08d26, detached snapshot unchanged. Prompt: the diff withoutuv.lock, the intended behavior, conventions and docs/testing.md; no PR text or prior findings.Covered: the filesystem and objects imports through the CLI, report, fleet worker, prepare/cleanup, and trial execution; workspace dependencies, the lockfile and conflicts; the AL2023/aarch64 bootstrap; environment routing and the existing environments; GIL records; README; the added tests against docs/testing.md. Result: FINDINGS (2).
1. P1 — Bootstrap retains a uv version too old for Python 3.15.2 (reviewed at
benchmark.yaml:370, theuv python installline).UvVersiondefaulted to 0.12.5 (released August 14), before Python 3.15.2 (October 25), and uv's interpreter catalog is fixed per release, so on a fresh host the unconditionaluv python installfails before any environment sync, the existing environments included.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verified and fixed in 91c8bfa:
uv python list --all-platforms --all-arches --only-downloadswith uv 0.12.5 lists onlycpython-3.15.0rc1for Linux aarch64, while 0.13.7 lists 3.15.2 andcpython-3.15.2+freethreaded-linux-aarch64-gnu. The default is now 0.13.7, the uv version that produced thisuv.lockand the local 3.15t smoke test. A comment on the parameter states the requirement. No offline test can check the catalog of a uv release, so this is not tested.