Flink Multi-Version Support #391
GreatEugenius
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Background and Goals
Currently, Flink Agents depends on Flink version 1.20.3, while Flink has entered the 2.x era with many new features and improvements. To enable users to leverage more Flink features in their Flink Agents jobs, we plan to support multiple Flink versions, including both Flink 1.20.x and 2.x series, allowing users to choose the appropriate Flink Agents version based on their actual Flink cluster version.
Multi-Version Support Strategy
Java Architecture Design
Flink Agents adopts a layered architecture design, implementing multi-version support through the
distmodule:Module Responsibilities
API Module
Plan Module
Runtime Module
Dist Module
Responsibilities:
srcdirectory)ActionExecutionOperator)Implementation Approach:
flink-1.20) contains:src/directory: stores version-specific compatibility codepom.xml: configures dependencies and packaging rulesapi,plan,runtimeprovided)runtimeusing Maven Shade plugin, using its own version-specific implementationmaven-dependency-pluginPackaging Strategy:
flink-1.20):srcdirectoryapi,plan,runtimeflink-2.2): directly depends on core modules likeapi,plan,runtimeollama)flink-agents-dist-flink-{version}-{project.version}.jarIntegrations Module
Python Side
Python is an interpreted language that resolves compatibility issues through runtime Flink version detection. Python packages embed corresponding version Java jar packages and automatically select the appropriate version at runtime.
Version Management Mechanism
We introduce the Flink version management utility class
FlinkVersionManagerto provide version detection functionality, allowing developers to write different code based on Flink version.Usage Example:
Automatic Java Jar Loading
Python code automatically detects the Flink version at runtime and selects the corresponding jar package from the
flink_agents/lib/directory to load.Design Rationale
Currently, Flink Agents adopts a simplified version management approach on the Python side. This is because:
Future Evolution:
We will consider introducing more complex version control mechanisms when:
Build Artifacts
Java Artifacts
Generated jar package naming format:
flink-agents-dist-flink-{version}-{project.version}.jarCurrently Supported Versions:
Python Artifacts
Generated Python package naming format:
flink_agents-{version}-py3-none-any.whlExample:
Package Contents:
Python API code (
flink_agents/directory)Embedded Java jar packages (stored in
flink_agents/lib/directory, categorized by version)Python dependencies (declared via
pyproject.toml)(removed to prevent automatic PyFlink installation, requires manual installation by users)apache-flink>=1.20.3,<=2.2.0pydantic,ollama,openai,anthropic,chromadb, etc. (retained)Build Commands
Build Process:
Java Build: Execute
mvn clean install -DskipTests -BPython Build:
dist/flink-*/target/topython/flink_agents/lib/flink-*/uvto manage Python dependencies and buildUsage Guide
Choosing the Right Version
Users should choose the corresponding Flink Agents version based on their Flink cluster version.
Java Users
Development Phase: Use unified API module for development
Python Users
Python packages automatically include jar packages for all supported versions and select the appropriate implementation at runtime based on the Flink version in the environment.
Installation:
Beta Was this translation helpful? Give feedback.
All reactions