Skip to content

Fix error when registering a model with env_pack multiple times#19063

Merged
harupy merged 3 commits intomlflow:masterfrom
cyficowley:fix-pack-env-reruns
Dec 8, 2025
Merged

Fix error when registering a model with env_pack multiple times#19063
harupy merged 3 commits intomlflow:masterfrom
cyficowley:fix-pack-env-reruns

Conversation

@cyficowley
Copy link
Contributor

@cyficowley cyficowley commented Nov 26, 2025

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":

image

How is this PR tested?

  • New unit/integration tests

Does this PR require documentation update?

  • No. You can skip the rest of this section.

Release Notes

Is this a user-facing change?

  • No. You can skip the rest of this section.

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 Registry

How 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" section

Should this PR be included in the next patch release?

Yes should be selected for bug fixes, documentation updates, and other small changes. No should 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?
  • Minor release: a release that increments the second part of the version number (e.g., 1.2.0 -> 1.3.0).
    Bug fixes, doc updates and new features usually go into minor releases.
  • Patch release: a release that increments the third part of the version number (e.g., 1.2.0 -> 1.2.1).
    Bug fixes and doc updates usually go into patch releases.
  • Yes (this PR will be cherry-picked and included in the next patch release)
  • No (this PR will be included in the next minor release)

Signed-off-by: Cyrus Cowley <cyficowley@gmail.com>
@github-actions github-actions bot added v3.6.1 area/model-registry Model registry, model registry APIs, and the fluent client calls for model registry rn/none List under Small Changes in Changelogs. labels Nov 26, 2025
@cyficowley cyficowley changed the title Fix error when registering a model multiple times Fix error when registering a model with env_pack multiple times Nov 26, 2025
@harupy harupy added v3.7.0 and removed v3.6.1 labels Dec 3, 2025
@BenWilson2 BenWilson2 added v3.7.1 and removed v3.7.0 labels Dec 4, 2025
Signed-off-by: Cyrus Cowley <cyficowley@gmail.com>
@cyficowley cyficowley requested a review from harupy December 5, 2025 20:01
@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2025

Documentation preview for f7fe2bc is available at:

More info
  • Ignore this comment if this PR does not change the documentation.
  • The preview is updated when a new commit is pushed to this PR.
  • This comment was created by this workflow run.
  • The documentation was built by this workflow run.

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 _databricks directory 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.

@harupy harupy added this pull request to the merge queue Dec 8, 2025
Merged via the queue into mlflow:master with commit 9e3a523 Dec 8, 2025
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/model-registry Model registry, model registry APIs, and the fluent client calls for model registry rn/none List under Small Changes in Changelogs. v3.7.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants