Page MenuHomePhabricator

Flink base image should not install into system python environment
Closed, ResolvedPublic

Description

Newer versions of python (3.11) & Debian (bookworm) discourage using pip to install packages into system site-packages.

Our WMF built Flink base image installs Flink by pip installing apache-flink into the system site-packages. When it was upgraded to Debian bookworm, this failed, so the --break-system-packages CLI opt was added.

PyFlink application images (like mediawiki-event-enrichment) base on the production Flink image, and use blubber to manage python dependencies and execution. Newer versions of Blubber respect Debian's preference to not install in system site-packages, and create a venv (in /opt/lib/venv). This causes blubber built pyflink apps to break, unless they explicitly set use-system-site-packages.

While this works, the Flink base image should do the right thing and also install into venv (the same one used by blubber built application images).

See also T406872

Done is

  • Flink base image no longer uses --break-system-packages
  • PyFlink Application images updated to remove use-system-site-packages from blubber config.

Details

Related Changes in Gerrit:
Related Changes in GitLab:
TitleReferenceAuthorSource BranchDest Branch
Update flink base imagerepos/data-engineering/mediawiki-event-enrichment!136atsukoT418525main
python: Allow configuration of the venv pathrepos/releng/blubber!171dduvallreview/use-existing-venv-d45dmain
Customize query in GitLab

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Ottomata added a project: Data-Platform-SRE.
Ottomata updated the task description. (Show Details)

Nice! https://gitlab.wikimedia.org/repos/releng/blubber/-/merge_requests/171

That will allow us to not have to couple with blubber's default venv path! We'll still use the same one, but if blubber changes it Flink image's will still work!

Thank you for tagging this task with good first task for Wikimedia newcomers!

Newcomers often may not be aware of things that may seem obvious to seasoned contributors, so please take a moment to reflect on how this task might look to somebody who has never contributed to Wikimedia projects.

A good first task is a self-contained, non-controversial task with a clear approach. It should be well-described with pointers to help a completely new contributor, for example it should clearly point to the codebase URL and provide clear steps to help a contributor get set up for success. We've included some guidelines at https://phabricator.wikimedia.org/tag/good_first_task/ !

Thank you for helping us drive new contributions to our projects <3

atsuko changed the task status from Open to In Progress.EditedApr 16 2026, 8:51 AM

Looking at docker-pkg, unclear if the Depends: openjdk-17-jre line in images/flink/flink/control is not working as expected, or docker-registry.wikimedia.org/openjdk-17-jre:latest is needed in a config.yaml:base_images.

$ docker-pkg  build images/flink/flink
    FROM {{ "openjdk-17-jre" | image_tag }}
    ^^^^^^^^^^^^^^^^^^^^^^^^^

ValueError: Image docker-registry.wikimedia.org/openjdk-17-jre not found, or it has no tag (known={'docker-registry.wikimedia.org/trixie:latest', 'docker-registry.wikimedia.org/flink:1.20.3-wmf0-20260412', 'docker-registry.wikimedia.org/bookworm:latest', 'docker-registry.wikimedia.org/bullseye:latest'})

Change #1272726 had a related patch set uploaded (by Atsuko; author: Atsuko):

[operations/docker-images/production-images@master] Install flink in blubber-compatible venv

https://gerrit.wikimedia.org/r/1272726

Test plan now contains correct invocations for both builds.

@Ottomata shall we move this step to the base package, since the source file is in the base package as well?

copies:
  - from: docker-registry.wikimedia.org/flink:1.20.3-wmf1-20260416
    source: /opt/flink/opt/flink-s3-fs-presto-1.20.3.jar
    destination: /usr/local/lib/python3.11/dist-packages/pyflink/plugins/s3-fs-presto/flink-s3-fs-presto-1.20.3.jar

Change #1272726 merged by Atsuko:

[operations/docker-images/production-images@master] flink: Install flink in blubber-compatible venv

https://gerrit.wikimedia.org/r/1272726

Successfully published image docker-registry.discovery.wmnet/flink:1.20.3-wmf1-20260416

Also it would be good to update search-platform/cirrus-streaming-updater/.pipeline/blubber.yaml, but it needs maven build to make it work. cc @dcausse

Here is proposed diff https://gitlab.wikimedia.org/-/snippets/290

mediawiki-event-enrichment MR is deployed for mw-page-html-content-change-enrich-next (staging) and working just fine.

atsuko updated the task description. (Show Details)

Also it would be good to update search-platform/cirrus-streaming-updater/.pipeline/blubber.yaml, but it needs maven build to make it work. cc @dcausse

Here is proposed diff https://gitlab.wikimedia.org/-/snippets/290

Thanks! Uploaded your change and few other things related to the maven build at https://gitlab.wikimedia.org/repos/search-platform/cirrus-streaming-updater/-/merge_requests/200