Add mlflow experiments get command#19097
Merged
serena-ruan merged 2 commits intomlflow:masterfrom Dec 1, 2025
Merged
Conversation
Add new CLI command to retrieve experiment details by ID. The command supports JSON output format with an extensible design for future table format support. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Alkis Polyzotis <alkis.polyzotis@databricks.com>
Contributor
|
Documentation preview for 4d14803 is available at: More info
|
Address ALKIS comments to implement table output format: - Add both "json" and "table" to click.Choice - Set "table" as the default output format - Implement vertical table formatting for single experiment display - Update tests: combine JSON structure test with explicit JSON test - Add comprehensive tests for table format (with/without tags) - Update existing tests to specify output format explicitly Changes: - Default output is now table format (user-friendly) - JSON format available with --output json flag - Table format shows all fields in vertical layout - Tests verify both output formats work correctly 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Alkis Polyzotis <alkis.polyzotis@databricks.com>
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
N/A
What changes are proposed in this pull request?
This PR adds a new CLI command
mlflow experiments getthat retrieves and displays experiment details by ID. The command supports both table and JSON output formats.Key features:
--experiment-id/-xflag to specify the experiment--outputflag supportingtable(default) andjsonformatsOutput examples:
Table format (default):
JSON format:
$ mlflow experiments get --experiment-id 0 --output json { "experiment_id": "0", "name": "Default", "artifact_location": "/path/to/mlruns/0", "lifecycle_stage": "active", "tags": {}, "creation_time": 1764288610669, "last_update_time": 1764288610669 }Implementation details:
runs describecommand)click.Choicefor output format validationdict(experiment)for serialization via_MlflowObject.__iter__How is this PR tested?
New tests added (7 total):
test_get_experiment_default- Default table outputtest_get_experiment_json- Complete JSON validation with expected output comparisontest_get_experiment_table- Table format with tagstest_get_experiment_table_no_tags- Table format without tagstest_get_experiment_missing_id- Missing required parametertest_get_experiment_invalid_id- Invalid experiment IDtest_get_experiment_deleted- Deleted experiments (lifecycle stage)Test coverage:
-x)Manual testing:
Quality checks:
Does this PR require documentation update?
The command is self-documenting through its docstring and
--helpoutput. No additional documentation is needed at this time.Release Notes
Is this a user-facing change?
Added new CLI command
mlflow experiments get --experiment-id <ID>to retrieve and display experiment details. The command supports two output formats:--output json): Complete experiment data in JSON structure for programmatic useThe command provides easy access to experiment metadata including name, artifact location, lifecycle stage, tags, and timestamps.
What component(s), interfaces, languages, and integrations does this PR affect?
Components
area/tracking: Tracking Service, tracking client APIs, autologgingHow should the PR be classified in the release notes? Choose one:
rn/feature- A new user-facing feature worth mentioning in the release notesShould this PR be included in the next patch release?
Commits:
2469e5115- Initial implementation with JSON output only4d14803ed- Add table output format and set as default🤖 Generated with Claude Code