Repository navigation
chore(deps, computing-unit): run the images on Python 3.12 - #9655
Conversation
The computing-unit images ran Ubuntu 22.04's python3, 3.10, which is older than any Python pyamber's CI tests (3.11 to 3.13), so a 3.11+ API could pass CI and fail only in deployed workers. One already does: since apache#8768, a UDF that fails to load gets a hint via BaseException.add_note, which 3.10 lacks, so the worker reports "AttributeError: ... has no attribute 'add_note'" instead of the user's error. Base both runtime stages on the Ubuntu 24.04 (noble) build of the same Temurin release; its python3 is 3.12. 24.04 marks that Python externally managed (PEP 668), so the packages go in a venv at /opt/venv whose bin/ leads PATH, making it the python3 that workers and PVE creation fall back to. The venv is created in the same layer as the pip installs, which keeps the layer reproducible. The worker image gains python3-venv to create it. Closes apache#9654 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.
Backport auto-label reportThis
|
Automated Reviewer SuggestionsBased on the
|
bobbai00
left a comment
There was a problem hiding this comment.
🟡 0 must-fix · 1 advisory · 2 polish: the runtime change checks out; one description note for the v1.3 backport and two comment fixes.
Conventions (1)
computing-unit-master.dockerfile:89: description omits the LICENSE fix that makes the v1.3 backport a fix (advisory, see inline)
Polish: 2 quick touch-ups (see inline comments).
Verification trace
Every lookup of python3 by name resolves to /opt/venv/bin/python3 through the image PATH: PythonUtils.getPythonExecutable (the Python worker fallback), both venv creations in PveManager, and install.sh. No k8s or single-node config sets UDF_PYTHON_PATH or PATH. PVEs created from the venv base on /usr/bin/python3.12 and inherit no /opt/venv packages. Both new digests are multi-arch indexes (amd64, arm64) whose configs carry JAVA_VERSION=jdk-17.0.20.1+1, the same as the jammy digests. In the same RUN, install.sh pip bootstraps the pinned pip 26.2.1 over the venv's seeded pip 24.0, so the layer's pip is compiled under SOURCE_DATE_EPOCH.
The comments called the setting udf.python.path, but UdfConfig reads python.path from udf.conf, which deployments set through UDF_PYTHON_PATH. Co-Authored-By: Claude Opus 5.5 <[email protected]>
bobbai00
left a comment
There was a problem hiding this comment.
🟢 3 resolved · 0 open · 0 new (0 new = 0 newly introduced · 0 late catches): every round-1 finding is fixed, and the comment-only delta adds nothing new.
Verification trace
The venv comment at lines 103-105 of both Dockerfiles now names python.path in udf.conf (UDF_PYTHON_PATH), matching UdfConfig.scala:29, and udf.python.path no longer appears anywhere in the repo. The description's new LICENSE paragraph holds up on PyPI: huggingface-hub requires tomli on Python < 3.11 from 1.32.0 on (1.26.0, the version amber/LICENSE-binary-python lists, and 1.31.0 do not), next to the async-timeout and exceptiongroup markers in aiohttp and anyio, and the file lists none of the three. No other file changed between the two reviewed heads, so the round-1 checks on interpreter resolution, PVE creation, base digests and layer reproducibility still apply.
What changes were proposed in this PR?
Root cause. The computing-unit images run Ubuntu 22.04's
python3, which is 3.10, and Python workers use it wheneverpython.pathinudf.conf(UDF_PYTHON_PATH) is unset. pyamber CI only tests 3.11 to 3.13 (ruff targetspy311, AGENTS.md uses 3.12), so a 3.11+ API can pass CI and then fail only in deployed workers. One already does: since #8768, a UDF that fails to load gets a hint throughBaseException.add_note. 3.10 has noadd_note, so a deployed worker raisesAttributeError: 'NameError' object has no attribute 'add_note'in place of the user's error and the hint.This also fixes the images' LICENSE. On 3.10, pip installs three packages that only Pythons older than 3.11 need:
async-timeout(foraiohttp),exceptiongroup(foranyio) and, since huggingface-hub 1.32,tomli.amber/LICENSE-binary-python, the Python part of the images'/texera/LICENSE, lists none of them. CI didn't catch this because only its 3.12 leg checks licenses. On 3.12 none of the three is installed.This PR changes the runtime stages of
computing-unit-masterandcomputing-unit-worker:eclipse-temurin:17-{jdk,jre}-jammy(Ubuntu 22.04)eclipse-temurin:17-{jdk,jre}-noble(Ubuntu 24.04), same Temurin release (17.0.20.1+1), pinned by digestpython3/opt/venvthat leadsPATH/usr/local/lib/python3.10/opt/venvRECORD, soinstall.sh's pip bootstrap fails withCannot uninstall pip 24.0, RECORD file not found. Hint: The package was installed by debian.Because the venv'sbin/comes first onPATH, every place that resolvespython3by name now gets 3.12:PythonUtils' fallback for Python workers, PVE creation (python3 -m venv, which still bases each PVE on/usr/bin/python3.12), andinstall.sh. No code or config changes.venvseeds is byte-compiled differently on every build; theinstall.shpip upgrade in the same layer replaces it, so the layer stays reproducible.python3-venvto create the venv.python3-pip's recommended packages still install gcc, g++ and make for PVE installs that need to compile.FROMthese (curated computing-unit images) now get 3.12. In those images,pip installlands in the venv, and Python packages installed with apt are no longer visible topython3.Any related issues, documentation, discussions?
Closes #9654. Raised in review of #9550, which had to keep
datetime.timezone.utcrather than 3.11'sdatetime.UTCfor the same reason.How was this PR tested?
Both runtime stages, built from their Dockerfiles on linux/arm64 (Docker 29.9.3, BuildKit v0.34.2). The sbt
buildstage, which this PR doesn't change, was swapped for a stub build context. The stub holds the files the runtime stage copies: both requirements files,amber/src/main/pythonwith generated protos, resources, license files, and a stubbin/computing-unit-*.The worker was built from the committed Dockerfile. For the master, Docker Hub's anonymous pull limit had run out, so its base came from
mirror.gcr.ioby the same digest; that copy of the Dockerfile differed only in the registry host. In each image, run as its defaulttexerauser:computing-unit-mastercomputing-unit-workercommand -v python3,python3 --version/opt/venv/bin/python3, 3.12.3python3 -m pip checkdatetime.UTC,BaseException.add_notepython3 -m venv /tmp/pve(how PveManager creates PVEs)home = /usr/bin,version = 3.12.3java -versionbin/licensing/check_binary_deps.py --ignore-transitive-version pythonon the image'spip-licensesCSVOK: 110 Python packages match LICENSE-binary.pyamber's suite on the image's interpreter. This ran inside the master image as
texeraon/opt/venv/bin/python3, with the tests andamber/pyproject.tomlmounted read-only and Postgres 16 loaded withsql/iceberg_postgres_catalog.sql, as the CI pyamber job sets up:Before. These are the old runtime steps on the old
17-jre-jammybase (Python 3.10.12) withamber/requirements.txt:All 13 failures are UDF load-error hint tests, for example
AttributeError: 'NameError' object has no attribute 'add_note'raised overNameError: name 'UDFOperatorV2' is not defined. The same file passes in the master image.The LICENSE gap. I resolved both requirements files with
pip install --dry-run --report(pip 26.3, against PyPI as of today) on Python 3.10.19 and 3.12.7, macOS arm64. 3.10 resolves 113 packages and 3.12 resolves 110. The three 3.10 adds areasync-timeout5.0.1,exceptiongroup1.3.2 andtomli2.5.0. Each comes in through apython_version < "3.11"marker, inaiohttp,anyioandhuggingface-hub1.33.0 respectively. huggingface-hub addedtomliin 1.32.0; 1.26.0, the versionmain's file lists, through 1.31.0 don't depend on it. No package resolves only on 3.12.amber/LICENSE-binary-pythonnames none of the three, on eithermainorrelease/v1.3.Reproducibility of the new layer. I ran that layer's first two commands twice, in separate containers:
python3 -m venv /opt/venv, theninstall.sh pip --upgrade setuptools wheelwithPACKAGE_SNAPSHOTset. Hashing every file under/opt/venvgives identical results for the two runs (1793 entries). Afterpython3 -m venvalone, the two runs differ in 495 of 1139 entries, all of them.pycfiles, which is why the venv is created in the install layer. On the same base, the old flow (system interpreter,PIP_BREAK_SYSTEM_PACKAGES=1) stops at the pip bootstrap with theRECORDerror quoted above.bash bin/dockerfiles/snapshot/test_install.shpasses;install.shitself is unchanged.Not verified:
Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 5.5)