### 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 whenever `python.path` in
`udf.conf` (`UDF_PYTHON_PATH`) is unset. pyamber CI only tests 3.11 to
3.13 (ruff targets `py311`, AGENTS.md uses 3.12), so a 3.11+ API can
pass CI and then fail only in deployed workers. One already does: since
apache#8768, a UDF that fails to load gets a hint through
`BaseException.add_note`. 3.10 has no `add_note`, so a deployed worker
raises `AttributeError: 'NameError' object has no attribute 'add_note'`
in place of the user's error and the hint.
```
Before: CI tests 3.11-3.13 -> image runs 3.10 -> UDF load error -> AttributeError: ... 'add_note'
After: CI tests 3.11-3.13 -> image runs 3.12 -> UDF load error -> user's error + hint
```
**This also fixes the images' LICENSE.** On 3.10, pip installs three
packages that only Pythons older than 3.11 need: `async-timeout` (for
`aiohttp`), `exceptiongroup` (for `anyio`) 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-master` and
`computing-unit-worker`:
| | Before | After |
| --- | --- | --- |
| Base | `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 digest |
| `python3` | 3.10.12, the system interpreter | 3.12.3, from a venv at
`/opt/venv` that leads `PATH` |
| Python packages | `/usr/local/lib/python3.10` | `/opt/venv` |
- **Why a venv.** 24.04 marks its system Python as externally managed
(PEP 668), and overriding that doesn't help: Ubuntu's own pip has no
`RECORD`, so `install.sh`'s pip bootstrap fails with `Cannot uninstall
pip 24.0, RECORD file not found. Hint: The package was installed by
debian.` Because the venv's `bin/` comes first on `PATH`, every place
that resolves `python3` by 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`), and `install.sh`. No code or config
changes.
- **Reproducibility.** The venv is created in the same layer as the pip
installs. The pip that `venv` seeds is byte-compiled differently on
every build; the `install.sh` pip upgrade in the same layer replaces it,
so the layer stays reproducible.
- **Packages.** The apt package lists are unchanged, except that the
worker also installs `python3-venv` to create the venv. `python3-pip`'s
recommended packages still install gcc, g++ and make for PVE installs
that need to compile.
- **Compatibility.** Images built `FROM` these (curated computing-unit
images) now get 3.12. In those images, `pip install` lands in the venv,
and Python packages installed with apt are no longer visible to
`python3`.
- The build stages and every other image are unchanged; none of them
runs pyamber.
### Any related issues, documentation, discussions?
Closes apache#9654. Raised in review of apache#9550, which had to keep
`datetime.timezone.utc` rather than 3.11's `datetime.UTC` for 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 `build` stage, 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/python` with generated protos, resources, license files,
and a stub `bin/computing-unit-*`.
```bash
docker buildx build --builder desktop-linux --load --build-context build=<stub> --target runtime \
--build-arg PACKAGE_SNAPSHOT=2026-11-23 --build-arg SOURCE_DATE_EPOCH="$(git log -1 --format=%ct origin/main)" \
-f bin/dockerfiles/computing-unit-worker.dockerfile -t texera-computing-unit-worker:py312-test .
```
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.io` by the same digest; that copy of the Dockerfile differed
only in the registry host. In each image, run as its default `texera`
user:
| Check | `computing-unit-master` | `computing-unit-worker` |
| --- | --- | --- |
| Build | ok, 174 s, 2.66 GB | ok, 171 s, 2.51 GB |
| `command -v python3`, `python3 --version` | `/opt/venv/bin/python3`,
3.12.3 | same |
| `python3 -m pip check` | No broken requirements found. | same |
| Import every top-level module of both requirements files (31) | ok,
torch 2.13.0+cpu | same |
| `datetime.UTC`, `BaseException.add_note` | present | present |
| `python3 -m venv /tmp/pve` (how PveManager creates PVEs) | `home =
/usr/bin`, `version = 3.12.3` | same |
| `java -version` | 17.0.20.1, unchanged | same |
| `bin/licensing/check_binary_deps.py --ignore-transitive-version
python` on the image's `pip-licenses` CSV | not run | `OK: 110 Python
packages match LICENSE-binary.` |
**pyamber's suite on the image's interpreter.** This ran inside the
master image as `texera` on `/opt/venv/bin/python3`, with the tests and
`amber/pyproject.toml` mounted read-only and Postgres 16 loaded with
`sql/iceberg_postgres_catalog.sql`, as the CI pyamber job sets up:
```bash
cd /texera/amber && python3 -m pytest -m "not integration"
# 1523 passed, 59 deselected, 1 xfailed
```
**Before.** These are the old runtime steps on the old `17-jre-jammy`
base (Python 3.10.12) with `amber/requirements.txt`:
```bash
python3 -m pytest -m "not integration" src/test/python/core/architecture/managers/test_executor_manager.py
# 13 failed, 60 passed
```
All 13 failures are UDF load-error hint tests, for example
`AttributeError: 'NameError' object has no attribute 'add_note'` raised
over `NameError: 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 are `async-timeout` 5.0.1,
`exceptiongroup` 1.3.2 and `tomli` 2.5.0. Each comes in through a
`python_version < "3.11"` marker, in `aiohttp`, `anyio` and
`huggingface-hub` 1.33.0 respectively. huggingface-hub added `tomli` in
1.32.0; 1.26.0, the version `main`'s file lists, through 1.31.0 don't
depend on it. No package resolves only on 3.12.
`amber/LICENSE-binary-python` names none of the three, on either `main`
or `release/v1.3`.
**Reproducibility of the new layer.** I ran that layer's first two
commands twice, in separate containers: `python3 -m venv /opt/venv`,
then `install.sh pip --upgrade setuptools wheel` with `PACKAGE_SNAPSHOT`
set. Hashing every file under `/opt/venv` gives identical results for
the two runs (1793 entries). After `python3 -m venv` alone, the two runs
differ in 495 of 1139 entries, all of them `.pyc` files, 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 the `RECORD` error quoted above.
`bash bin/dockerfiles/snapshot/test_install.sh` passes; `install.sh`
itself is unchanged.
**Not verified:**
- linux/amd64 builds. CI's pyamber 3.12 leg does install both
requirements files on x86-64 Linux.
- The sbt build stage, which this PR doesn't touch.
- A deployment running a Python UDF end to end.
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 5.5)
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
What changes were proposed in this PR?
Remove redundant statements, unused imports, unnecessary control-flow branches, and legacy idioms across
amber/src/main/python/andamber/src/main/scala/org/apache/texera/web/resource/aiassistant/type_annotation_visitor.pywith no runtime behavior change:passstatements in docstring-only abstract methods and marker classes (InternalMarker,BufferedItemWriter,ReadonlyVirtualDocument, andUDFOperatorV2/UDFSourceOperator/UDFTableOperator/UDFBatchOperator), remove trailingreturn NoneinBackpressureHandler, drop unusedimport core, unnecessary dict unpacking, and intermediate return variables iniceberg_utilsandtimestamp, and remove the unusedenumerateindex inTypeAnnotationVisitor.else/elifblocks followingreturnindetect_attribute_type_from_arrow_field,Table.__eq__,DocumentFactory, andIcebergCatalogInstance.get_instance, and merge identicalstaticmethoddecorator checks inTypeAnnotationVisitor.list()/dict()/bytes()with literal forms ([]/{}/b""), replacesuper(ProxyServer, self)withsuper(), replacemap(lambda ...)with a generator expression and simplify the payload conditional inProxyServer, adopt@functools.cacheinattribute_type, use!rf-strings inSchema,ProxyServer, andExpressionEvaluator, and drop the redundantstr()inHeartbeat.Any related issues, documentation, discussions?
Closes #9543.
How was this PR tested?
Ran in
amber/on2a319878af(Python 3.12.10,ruff 0.14.7,pytest 7.4.0):ruff checkandruff format --check(218files): passed.test_type_annotation_visitor.py:5 passed.18targetedamberPython unit-test suites:320 passed, 9 skipped(test_attribute_type.pyWindowstime.tzsetskips).test_iceberg_utils_catalog.py(excluding the3s3fs-dependent cases absent locally):19 passed.test_expression_evaluator.py(excluding the2--import-mode=importlibrepr cases):3 passed.38bd50c909, macOS):ruff checkandruff format --checkpassed;test_attribute_type.py,test_heartbeat.py,test_schema.py, andtest_arrow_schema_utils.py:76 passed; all135hand-written Python sources undersrc/main/pythonandaiassistant/compile under Python 3.10.19.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Antigravity (Gemini 4 Neon)