Skip to content

Cache database in tests/tracking/fluent/test_fluent.py to speed up tests on Windows#19161

Merged
harupy merged 2 commits intomlflow:masterfrom
harupy:cache-tracking-fluent-db
Dec 3, 2025
Merged

Cache database in tests/tracking/fluent/test_fluent.py to speed up tests on Windows#19161
harupy merged 2 commits intomlflow:masterfrom
harupy:cache-tracking-fluent-db

Conversation

@harupy
Copy link
Member

@harupy harupy commented Dec 2, 2025

Related Issues/PRs

#19158

What changes are proposed in this pull request?

On Windows, db migration is very slow (~8 seconds per test). This change caches the SQLite database at the module level and copies it for each test, reducing the migration overhead and speeding up test execution.

This is the same optimization applied in #19158 for tests/tracing/test_fluent.py.

Results

Before (without caching)

Job Duration Tests Min Max Avg
windows (1) 267.82s 32 0.035s 107.684s 8.369s
windows (2) 84.75s 32 0.040s 6.995s 2.649s
windows (3) 81.51s 31 0.037s 6.448s 2.629s
windows (4) 137.69s 32 0.037s 10.071s 4.303s

After (with caching)

Job Duration Tests Min Max Avg
windows (1) 103.06s 32 0.039s 70.199s 3.221s
windows (2) 37.02s 28 0.011s 16.911s 1.322s
windows (3) 26.83s 31 0.039s 7.581s 0.865s
windows (4) 25.32s 28 0.010s 9.764s 0.904s

Summary

Job Before After Improvement
windows (1) 267.82s 103.06s 61.5%
windows (2) 84.75s 37.02s 56.3%
windows (3) 81.51s 26.83s 67.1%
windows (4) 137.69s 25.32s 81.6%

How is this PR tested?

  • Existing 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/build: Build and test infrastructure for MLflow

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 (this PR will be cherry-picked and included in the next patch release)
  • No (this PR will be included in the next minor release)

…tests on Windows

On Windows, db migration is very slow (~8 seconds per test). This change
caches the SQLite database at the module level and copies it for each test,
reducing the migration overhead and speeding up test execution.

This is the same optimization applied in mlflow#19158 for `tests/tracing/test_fluent.py`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
@github-actions github-actions bot added area/build Build and test infrastructure for MLflow rn/none List under Small Changes in Changelogs. labels Dec 2, 2025
@mlflow mlflow deleted a comment from github-actions bot Dec 2, 2025
@harupy harupy requested a review from serena-ruan December 2, 2025 12:15
@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

Please use /autoformat command instead of labels.

Copy link
Collaborator

@serena-ruan serena-ruan 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 Dec 3, 2025
Merged via the queue into mlflow:master with commit a12aa05 Dec 3, 2025
47 of 49 checks passed
@harupy harupy deleted the cache-tracking-fluent-db branch December 3, 2025 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build Build and test infrastructure for MLflow rn/none List under Small Changes in Changelogs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants