Bound host-metadata discovery on Config init to the configured timeouts#1483
Closed
tejaskochar-db wants to merge 1 commit into
Closed
Bound host-metadata discovery on Config init to the configured timeouts#1483tejaskochar-db wants to merge 1 commit into
tejaskochar-db wants to merge 1 commit into
Conversation
Config.__init__ resolves config fields from the host's /.well-known/databricks-config endpoint. The discovery client was built with no arguments, so it ignored retry_timeout_seconds / http_timeout_seconds and always used the default 300s retry budget. An unreachable host therefore blocked Config() initialization for ~5 minutes before falling back to the explicit configuration, even when the user had set shorter timeouts. Build the discovery client from the configured timeouts, matching how ApiClient constructs its _BaseClient. The fetch stays best-effort with a fallback to explicit config on failure. Co-authored-by: Isaac
|
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
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.
Summary
Build the host-metadata discovery client on
Configinitialization from the configuredretry_timeout_seconds/http_timeout_seconds, so an unreachable host no longer blocksConfig()/WorkspaceClient()for ~5 minutes.Why
On initialization,
Configresolves missing fields (account_id,workspace_id,discovery_url,cloud,token_audience) from the host's/.well-known/databricks-configdiscovery endpoint, via_resolve_host_metadata→get_host_metadata. This probe is best-effort: any failure is caught, logged, and the explicitly-provided configuration is used instead.The problem is the client used for the probe.
get_host_metadata's default client is a no-argument_BaseClient(), so the probe ignoresretry_timeout_secondsandhttp_timeout_secondsand always uses the default 300-second retry budget. When the host is unreachable — behind a proxy/firewall that drops connections, or a workspace that is down — initialization blocks for the full ~5 minutes before the probe gives up and falls back, even whenhost,token, andauth_typewere all supplied explicitly and there was nothing to discover. Setting the timeouts onConfigdoes not help today, because the probe never receives them.This is the same class of problem as #1046 (and its fix #1085), which addresses the
oidc_endpointsprobe; this PR covers the separate_resolve_host_metadata→get_host_metadataprobe.What changed
Interface changes
None.
Behavioral changes
_resolve_host_metadatanow builds its_BaseClientfrom the configuredretry_timeout_seconds/http_timeout_seconds, matching howApiClientconstructs its client. Callers that set shorter timeouts now get a fast, bounded failure against an unreachable host instead of a fixed ~5-minute block. The probe remains best-effort with the same fallback to explicit configuration, behavior is unchanged for reachable hosts, and the default timeout is unchanged (still 300s when not configured).Internal changes
None beyond the above.
How is this tested?
test_resolve_host_metadata_uses_configured_timeouts) asserts the discovery client carries the configured timeouts; the existing_resolve_host_metadatasuite still passes.https://192.0.2.1, RFC 5737 TEST-NET),Config(host=..., token=..., auth_type="pat", retry_timeout_seconds=2, http_timeout_seconds=1)returns in ~2.6s and logs the fallback warning, instead of blocking on the default 300s retry budget.