Skip to content

Conversation

@denik
Copy link
Contributor

@denik denik commented Apr 23, 2025

Changes

Automatically clean up old wheels instead of aborting the tests.

Tests

Manually:

~/work/cli-main/acceptance/build/darwin_arm64 % cp -r databricks_bundles-0.249.0-py3-none-any.whl databricks_bundles-0.255.0-py3-none-any.whl

~/work/cli-main/acceptance/selftest/basic % testme -v
+ go test ../.. -run ^TestAccept$/^selftest$/^basic$ -v
=== RUN   TestAccept
...
    acceptance_test.go:879: Cleaning up /Users/denis.bilenko/work/cli-main/acceptance/build/darwin_arm64/databricks_bundles-0.249.0-py3-none-any.whl
    acceptance_test.go:741: [uv build --no-cache -q --wheel --out-dir /Users/denis.bilenko/work/cli-main/acceptance/build/darwin_arm64] took 408.369459ms
    acceptance_test.go:879: Cleaning up /Users/denis.bilenko/work/cli-main/acceptance/build/darwin_arm64/databricks_bundles-0.255.0-py3-none-any.whl

func buildDatabricksBundlesWheel(t *testing.T, buildDir string) (string, error) {
func buildDatabricksBundlesWheel(t *testing.T, buildDir string) string {
// Clean up directory, remove all but the latest wheel
_ = findWheel(t, buildDir)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do this twice? The build will create a new one anyway, so the second call will clear out the old stuff.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't want to make an assumption that build command always updates mtime.

I also don't want to delete the one wheel that is most likely to be reused. So I'm keeping last mtime wheel there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a comment with an explanation. I believe this approach makes least assumptions and so is most resilient.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

BTW, I checked 'uv build' does not update mtime if up to date whl is already there.

return "", fmt.Errorf("failed to read directory %s: %s", buildDir, err)
latestWheel := findWheel(t, buildDir)
if latestWheel == "" {
t.Errorf("databricks-bundles wheel not found in %s", buildDir)
Copy link
Contributor

Choose a reason for hiding this comment

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

This does not call t.FailNow(), so it continues execution. Is this intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, added a comment there. Only a couple of tests need that wheel, no need to fail all of them.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need such fallback? It will be harder to debug if anything goes wrong. CLI commands will also fail in a very weird way

Copy link
Contributor Author

Choose a reason for hiding this comment

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

907c258

This will make DATABRICKS_BUNDLES_WHEEL undefined and affected bash scripts will fail with clear message because we run them with -e.

Copy link
Collaborator

@kanterov kanterov left a comment

Choose a reason for hiding this comment

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

It can be a surprise that findWheel removes wheels in addition to finding them.

I think it might be easier to follow if we create a function that returns a list of wheels. We can delete all of them before we run build command. We don't need to keep binary as we do for CLI.

@denik denik temporarily deployed to test-trigger-is April 24, 2025 08:18 — with GitHub Actions Inactive
@denik
Copy link
Contributor Author

denik commented Apr 24, 2025

It can be a surprise that findWheel removes wheels in addition to finding them.

I renamed it and added a comment re what it does.

@denik denik requested review from kanterov and pietern April 24, 2025 08:19
@denik denik temporarily deployed to test-trigger-is April 24, 2025 08:29 — with GitHub Actions Inactive
@denik denik enabled auto-merge April 24, 2025 08:30
@denik denik temporarily deployed to test-trigger-is April 24, 2025 09:08 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is April 24, 2025 09:10 — with GitHub Actions Inactive
general rule we cache all build artifacts in acceptance test runner.
@denik denik temporarily deployed to test-trigger-is April 24, 2025 09:16 — with GitHub Actions Inactive
@denik denik disabled auto-merge April 24, 2025 09:31
@denik denik merged commit ac7faca into main Apr 24, 2025
9 of 10 checks passed
@denik denik deleted the denik/acc-wheel-cleanup branch April 24, 2025 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants