Upgrade protobuf generation code and add a new generate_protos.py script#12360
Conversation
Signed-off-by: Weichen Xu <[email protected]>
Signed-off-by: Weichen Xu <[email protected]>
| import google.protobuf | ||
| from packaging.version import Version | ||
| if Version(google.protobuf.__version__) >= Version("5.26.0"): |
There was a problem hiding this comment.
Each pb module checks protobuf runtime version first, then executes matched gencode.
There was a problem hiding this comment.
All these gencode (including multiple version gencode) are generated by generate_protos.py script.
Signed-off-by: Weichen Xu <[email protected]>
Signed-off-by: Weichen Xu <[email protected]>
Signed-off-by: Weichen Xu <[email protected]>
Signed-off-by: Weichen Xu <[email protected]>
|
how do we ensure both the |
|
Note java pom.xml already shades google protobuf: mlflow/mlflow/java/client/pom.xml Line 101 in db9143d We can verify it by command: outputs: |
I will add CI for it. |
| ], "The script only supports MacOS or Linux system." | ||
| assert platform.machine() in [ | ||
| "x86_64", | ||
| "aarch64", |
There was a problem hiding this comment.
Do we need to support arm64 CPU as well?
There was a problem hiding this comment.
I don't have machine to test that. We can add it when we receive the use-case.
| return "\n".join(lines) | ||
|
|
||
|
|
||
| def generate_final_python_gencode(gencode3194_path, gencode5260_path, out_path): |
Signed-off-by: Weichen Xu <[email protected]>
|
Documentation preview for 4ec2ec7 will be available when this CircleCI job More info
|
Signed-off-by: Weichen Xu <[email protected]>
Signed-off-by: Weichen Xu <[email protected]>
Signed-off-by: Weichen Xu <[email protected]>
Signed-off-by: Weichen Xu <[email protected]>
Signed-off-by: Weichen Xu <[email protected]>
Signed-off-by: Weichen Xu <[email protected]>
Signed-off-by: Weichen Xu <[email protected]>
Signed-off-by: Weichen Xu <[email protected]>
Signed-off-by: Weichen Xu <[email protected]>
Signed-off-by: Weichen Xu <[email protected]>
There was a problem hiding this comment.
/ai hello, fix this github action workflow. Please make the following updates:
protobuf_major_version_plus_oneis confusing. Rename it toprotobuf_major_versionand increment the version beforepip install.
There was a problem hiding this comment.
Sure, here's how you can update the code snippet:
jobs:
core_tests:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
group: [1, 2]
- protobuf_major_version_plus_one: [4, 5, 6]
+ protobuf_major_version: [3, 4, 5]
include:
- splits: 2
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: ./.github/actions/untracked
- uses: ./.github/actions/free-disk-space
- uses: ./.github/actions/setup-python
- uses: ./.github/actions/setup-pyenv
- uses: ./.github/actions/setup-java
- name: Install dependencies
run: |
pip install --no-dependencies tests/resources/mlflow-test-plugin
pip install .[extras]
pip install pyspark
# Install Hugging Face datasets to test Hugging Face usage with MLflow dataset tracking
pip install datasets
# Install TensorFlow to test TensorFlow dataset usage with MLflow dataset tracking
pip install tensorflow
# Install torch and transformers to test metrics
pip install torch transformers
pip install -r requirements/test-requirements.txt
# Test against specific protobuf version
- pip install "protobuf<${{ matrix.protobuf_major_version_plus_one }}"
+ protobuf_incremented_version=$((${{ matrix.protobuf_major_version }} + 1))
+ pip install "protobuf<${protobuf_incremented_version}"
- uses: ./.github/actions/pipdeptree
- name: Run tests
run: |
pytest --splits=${{ matrix.splits }} --group=${{ matrix.group }} \
--ignore-flavors --ignore=tests/projects --ignore=tests/examples --ignore=tests/recipes --ignore=tests/evaluate --ignore tests/deployments/server \
testsThis changes the confusing protobuf_major_version_plus_one to protobuf_major_version and increments the version number before passing it to pip install.
Click here to see the usage data
{
"prompt_tokens": 893,
"completion_tokens": 480,
"total_tokens": 1373,
"estimated_cost_in_usd": 0.05559
}There was a problem hiding this comment.
This change failed with error: https://github.com/mlflow/mlflow/actions/runs/9606163544
There was a problem hiding this comment.
That's because you used ${{ protobuf_incremented_version }}, not ${protobuf_incremented_version} or $protobuf_incremented_version.
There was a problem hiding this comment.
interesting , it failed again using ${protobuf_incremented_version}: https://github.com/mlflow/mlflow/actions/runs/9606814485/job/26496930964?pr=12360 @harupy
/home/runner/work/_temp/6ae75bcc-0fce-4971-9e2b-b916fb7e6c16.sh: line 13: protobuf<${ protobuf_incremented_version }: bad substitution
There was a problem hiding this comment.
% FOO=foo
% echo "${ FOO }"
zsh: bad substitution
% echo "${FOO}"
foo
There was a problem hiding this comment.
this works too protobuf<$protobuf_incremented_version
Signed-off-by: Weichen Xu <[email protected]>
Signed-off-by: Weichen Xu <[email protected]>
|
@BenWilson2 could you also take another look? |
Signed-off-by: Weichen Xu <[email protected]>
BenWilson2
left a comment
There was a problem hiding this comment.
LGTM once https://github.com/mlflow/mlflow/pull/12360/files#r1647840531 is addressed! Thanks for the clever implementation here @WeichenXu123 :D
| pytest --splits=${{ matrix.splits }} --group=${{ matrix.group }} \ | ||
| --ignore-flavors --ignore=tests/projects --ignore=tests/examples --ignore=tests/recipes --ignore=tests/evaluate --ignore tests/deployments/server \ | ||
| tests |
There was a problem hiding this comment.
This can be a follow-up. does this run tests unrelated to protobuf?
There was a problem hiding this comment.
yes. We can filter out tests unrelated to protobuf, but no simple rules currently
Signed-off-by: Weichen Xu <[email protected]>
|
oh, I found an issue: I will file a follow-up PR. |
|
Any idea when this PR will be released? The upgrade of |
|
@villainb-dg late next week :) |
|
@BenWilson2 So it seems that the latest release 4.12.3 did not include your change (https://github.com/mlflow/mlflow/blob/v2.14.3/pyproject.toml#L45). Any idea why? |
🛠 DevTools 🛠
Install mlflow from this PR
Checkout with GitHub CLI
Related Issues/PRs
closes #11811What changes are proposed in this pull request?
Since protobuf python runtime version 5.26.0, it is not compatible with python gencode generated by protoc 3.19.4,
and according to https://protobuf.dev/support/cross-version-runtime-guarantee/#backwards,
New Gencode + Old Runtime is not allowed.
So to make MLflow supports either protobuf runtime version >= 5.26 or < 5.26, I make each python protobuf gencode module like:
I also write a new
generate_protos.pyscript so that it can automatically generates above multiple version bundled gencode python module.How is this PR tested?
Does this PR require documentation update?
Release Notes
Is this a user-facing change?
What component(s), interfaces, languages, and integrations does this PR affect?
Components
area/artifacts: Artifact stores and artifact loggingarea/build: Build and test infrastructure for MLflowarea/deployments: MLflow Deployments client APIs, server, and third-party Deployments integrationsarea/docs: MLflow documentation pagesarea/examples: Example codearea/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registryarea/models: MLmodel format, model serialization/deserialization, flavorsarea/recipes: Recipes, Recipe APIs, Recipe configs, Recipe Templatesarea/projects: MLproject format, project running backendsarea/scoring: MLflow Model server, model deployment tools, Spark UDFsarea/server-infra: MLflow Tracking server backendarea/tracking: Tracking Service, tracking client APIs, autologgingInterface
area/uiux: Front-end, user experience, plotting, JavaScript, JavaScript dev serverarea/docker: Docker use across MLflow's components, such as MLflow Projects and MLflow Modelsarea/sqlalchemy: Use of SQLAlchemy in the Tracking Service or Model Registryarea/windows: Windows supportLanguage
language/r: R APIs and clientslanguage/java: Java APIs and clientslanguage/new: Proposals for new client languagesIntegrations
integrations/azure: Azure and Azure ML integrationsintegrations/sagemaker: SageMaker integrationsintegrations/databricks: Databricks integrationsHow should the PR be classified in the release notes? Choose one:
rn/none- No description will be included. The PR will be mentioned only by the PR number in the "Small Bugfixes and Documentation Updates" sectionrn/breaking-change- The PR will be mentioned in the "Breaking Changes" sectionrn/feature- A new user-facing feature worth mentioning in the release notesrn/bug-fix- A user-facing bug fix worth mentioning in the release notesrn/documentation- A user-facing documentation change worth mentioning in the release notesShould this PR be included in the next patch release?
Yesshould be selected for bug fixes, documentation updates, and other small changes.Noshould be selected for new features and larger changes. If you're unsure about the release classification of this PR, leave this unchecked to let the maintainers decide.What is a minor/patch release?
Bug fixes, doc updates and new features usually go into minor releases.
Bug fixes and doc updates usually go into patch releases.