apache / apache/beam

Install Python wheel and dependencies to local venv in SDK harness

Open
#21,479 0 comments 0 reactions 0 assignees View on GitHub
harness improvement P2 python usability
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

With the `--setup-file` option, the Python SDK harness compiles and installs a wheel and its package dependencies on the taskmanager SDK sidecar containers. Unfortunately, this installation is global and persistent, so consecutive job submissions will reuse the previously installed wheel instead of reinstalling or updating it. This makes it impossible to submit updated code (beyond the main .py file, which will always be fresh) without deleting and recreating all taskmanager containers. It also messes with dependencies of other jobs and can cause inconsistencies or errors that are extremely hard to debug.

*Suggestion:* Create a temporary venv per job, install packages there, delete venv after job completion or failure.

*Fixes:* Stale or conflicting dependencies in persistent SDK containers. Pip will not reinstall existing packages by default, even if their version numbers differ and the number of installed dependency packages grows unnecessarily over time. There is also no point in keeping the `--setup-file` wheel installed for all eternity.

Imported from Jira [BEAM-13669](https://issues.apache.org/jira/browse/BEAM-13669). Original Jira may contain additional context.
Reported by: phoerious.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.