Skip to content

Clarify mlflow gc command behavior for pinned runs and registered models#18704

Merged
harupy merged 6 commits intomasterfrom
copilot/clarify-mlflow-gc-functionality
Nov 10, 2025
Merged

Clarify mlflow gc command behavior for pinned runs and registered models#18704
harupy merged 6 commits intomasterfrom
copilot/clarify-mlflow-gc-functionality

Conversation

Copy link
Contributor

Copilot AI commented Nov 6, 2025

Related Issues/PRs

Resolve #14637

What changes are proposed in this pull request?

The mlflow gc command documentation did not clarify whether pinned runs or runs with registered models are protected from deletion. This caused confusion when using --older-than to preserve recent runs while potentially wanting to retain important older runs.

Changes:

  • Added a concise .. note:: section to gc command docstring documenting what is NOT considered:
    • Pinned runs (UI-only feature, no effect on gc)
    • Registered models (presence does not prevent deletion)
    • Tags and other metadata (not evaluated)
  • Clarified --older-than filters by deletion time (when moved to deleted lifecycle stage), not creation time
  • Made explicit that runs must be in deleted lifecycle stage before gc can remove them

How is this PR tested?

  • Existing unit/integration tests
  • New unit/integration tests
  • Manual tests

Verified existing gc tests pass: test_mlflow_gc_sqlite, test_mlflow_gc_sqlite_older_than, test_mlflow_gc_file_store

Does this PR require documentation update?

  • No. You can skip the rest of this section.
  • Yes. I've updated:
    • Examples
    • API references
    • Instructions

Release Notes

Is this a user-facing change?

  • No. You can skip the rest of this section.
  • Yes. Give a description of this change to be included in the release notes for MLflow users.

Documentation now clarifies that mlflow gc operates solely on lifecycle stage and specified criteria (--older-than, --run-ids, --experiment-ids). Pinned runs, registered models, and metadata do not prevent deletion.

What component(s), interfaces, languages, and integrations does this PR affect?

Components

  • area/tracking: Tracking Service, tracking client APIs, autologging
  • area/models: MLmodel format, model serialization/deserialization, flavors
  • area/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registry
  • area/scoring: MLflow Model server, model deployment tools, Spark UDFs
  • area/evaluation: MLflow model evaluation features, evaluation metrics, and evaluation workflows
  • area/gateway: MLflow AI Gateway client APIs, server, and third-party integrations
  • area/prompts: MLflow prompt engineering features, prompt templates, and prompt management
  • area/tracing: MLflow Tracing features, tracing APIs, and LLM tracing functionality
  • area/projects: MLproject format, project running backends
  • area/uiux: Front-end, user experience, plotting, JavaScript, JavaScript dev server
  • area/build: Build and test infrastructure for MLflow
  • area/docs: MLflow documentation pages

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
  • rn/breaking-change - The PR will be mentioned in the "Breaking Changes" section
  • rn/feature - A new user-facing feature worth mentioning in the release notes
  • rn/bug-fix - A user-facing bug fix worth mentioning in the release notes
  • rn/documentation - A user-facing documentation change worth mentioning in the release notes

Should this PR be included in the next patch release?

  • 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)
Original prompt

This section details on the original issue you should resolve

<issue_title>Clarify mlflow gc functionality</issue_title>
<issue_description>If the "gc" cli tool is used with the "older-than" option, does it also delete pinned runs? It would be a good idea to be able to safeguard some runs from the garbage collection. Right now I am preserving all runs younger than a month, but I may have some important runs/models that are older than that. It should be clarified how the gc actually works in situations like:

  • run is "pinned"
  • run has a registered model under it</issue_description>

Comments on the Issue (you are @copilot in this section)

@harupy `mlflow gc` only considers the parameters passed to it and does not take into account the run’s state or metadata:
  • Pinned runs: Pinning is purely a UI feature and has no effect on mlflow gc.
  • Registered models: Similarly, the presence of a registered model under a run does not prevent it from being deleted.

In other words, mlflow gc operates solely based on the specified criteria (e.g., --older-than) and does not make exceptions for pinned runs or runs with registered models.</comment_new>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@harupy harupy marked this pull request as ready for review November 6, 2025 01:39
@harupy harupy added the rn/none List under Small Changes in Changelogs. label Nov 6, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

@Copilot Thank you for the contribution! Could you fix the following issue(s)?

⚠ Invalid PR template

This PR does not appear to have been filed using the MLflow PR template. Please copy the PR template from here and fill it out.

Add clarification to the gc command docstring about what factors are NOT considered when determining which runs to delete:
- Pinned runs (UI-only feature)
- Registered models
- Tags or other metadata

Also update the --older-than help text to clarify it filters based on when runs were moved to the deleted lifecycle stage, not their creation time.

Co-authored-by: harupy <17039389+harupy@users.noreply.github.com>
Copilot AI changed the title [WIP] Clarify mlflow gc handling of pinned runs Clarify mlflow gc command behavior for pinned runs and registered models Nov 6, 2025
Copilot AI requested a review from harupy November 6, 2025 01:52
@harupy harupy added the team-review Trigger a team review request label Nov 6, 2025
@github-actions github-actions bot added area/docs Documentation issues area/tracking Tracking service, tracking client APIs, autologging rn/documentation Mention under Documentation Changes in Changelogs. labels Nov 6, 2025
🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
@harupy harupy requested a review from coldhearti November 6, 2025 12:27
@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

Documentation preview for 481566f 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.

Copy link

@coldhearti coldhearti left a comment

Choose a reason for hiding this comment

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

This is good!

Co-authored-by: harupy <17039389+harupy@users.noreply.github.com>
.. note::

This command only considers lifecycle stage and the specified deletion criteria.
It does **not** check for pinned runs, registered models, or tags. Pinning is a
Copy link
Member

Choose a reason for hiding this comment

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

not sure if we need to mention pinned runs but it doesn't hurt anyone.

Signed-off-by: Harutaka Kawamura <hkawamura0130@gmail.com>
Copy link
Collaborator

@B-Step62 B-Step62 left a comment

Choose a reason for hiding this comment

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

LGTM!

@harupy harupy added this pull request to the merge queue Nov 10, 2025
Merged via the queue into master with commit b98e624 Nov 10, 2025
45 checks passed
@harupy harupy deleted the copilot/clarify-mlflow-gc-functionality branch November 10, 2025 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs Documentation issues area/tracking Tracking service, tracking client APIs, autologging rn/documentation Mention under Documentation Changes in Changelogs. rn/none List under Small Changes in Changelogs. team-review Trigger a team review request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clarify mlflow gc functionality

4 participants