Skip to content

Retry a slow first databricks --version before giving up - #1252

Open
yaoharry wants to merge 2 commits into
databricks:mainfrom
yaoharry:harry/databricks-cli-version-cold-start
Open

yaoharry wants to merge 2 commits into
databricks:mainfrom
yaoharry:harry/databricks-cli-version-cold-start

Conversation

@yaoharry

Copy link
Copy Markdown
Contributor

Summary

ug discovers every databricks binary on PATH by running <path> --version with a 10 s timeout. A timed-out probe is recorded as "version unknown". When it is the only CLI on PATH, ensure_databricks_cli_version then fails the launch with:

Could not parse Databricks CLI version from `databricks --version` output: 'Databricks CLI v1.20.0'

The output shown is from the fallback read in the same call, which succeeded: the version parses fine, and only the first probe was slow. A cold first run, e.g. right after a CLI upgrade while the OS verifies the new binary, can exceed 10 s. This came up in unattended launches from a wrapper, where nobody retries the command.

_read_databricks_cli_version now retries a timed-out probe once with a 60 s budget before it gives up. A fast CLI is unaffected: the first probe still answers within 10 s. An OSError still returns None at once.

Test plan

  • tests/test_databricks.py:
    • test_read_version_retries_a_slow_first_run (new): the first probe times out, the 60 s retry returns Databricks CLI v1.20.0, and the version is read.
    • test_read_version_swallows_timeout now also asserts the budgets are [10, 60].
  • uv run pytest tests/test_databricks.py: 416 passed.
  • uv run ruff check src tests, uv run ruff format --check src tests, uv run ty check src/: clean.

This pull request and its description were written by Isaac.

Discovery probes each databricks binary with a 10 s timeout and records a timed-out probe as unparseable. A cold first run (e.g. right after an upgrade) can take longer, so the launch failed with "Could not parse Databricks CLI version ... 'Databricks CLI v1.20.0'" even though the fallback read in the same call succeeded. Retry a timed-out probe once with a 60 s budget.

Signed-off-by: Harry Yao <harry.yao@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
…-version-cold-start

Signed-off-by: Harry Yao <harry.yao@databricks.com>
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.

1 participant