Fix error when registering a model with env_pack multiple times#19063
Merged
harupy merged 3 commits intomlflow:masterfrom Dec 8, 2025
Merged
Fix error when registering a model with env_pack multiple times#19063harupy merged 3 commits intomlflow:masterfrom
harupy merged 3 commits intomlflow:masterfrom
Conversation
Signed-off-by: Cyrus Cowley <cyficowley@gmail.com>
harupy
reviewed
Dec 3, 2025
harupy
reviewed
Dec 3, 2025
Signed-off-by: Cyrus Cowley <cyficowley@gmail.com>
harupy
approved these changes
Dec 8, 2025
Contributor
|
Documentation preview for f7fe2bc is available at: More info
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an issue where re-registering a model with the env_pack argument fails with a "Destination path already exists" error. The fix removes any existing _databricks directory before moving the newly created one.
- Adds logic to remove existing
_databricksdirectory if present before moving the new one - Adds a comprehensive test case to verify the fix handles existing directories correctly
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| mlflow/utils/env_pack.py | Adds removal of existing _databricks directory before shutil.move to prevent "Destination path already exists" error |
| tests/utils/test_env_pack.py | Adds test case that simulates existing _databricks directory and verifies successful re-registration with proper directory replacement |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issues/PRs
#15783 which introduced env_pack
What changes are proposed in this pull request?
Currently if you have an mlflow model that you register using the env_pack argument, you cannot re-register the same model to a different name as you will get an error saying "Destination path already exists":
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/model-registry: Model Registry service, APIs, and the fluent client calls for Model RegistryHow 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" sectionShould 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.