From 5d29d84441b362927f858623135eb5e7594a91f9 Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Fri, 14 Feb 2025 13:31:23 +0100 Subject: [PATCH] More diagnostics --- .../serverless-auto-disabled/output.txt | 1 + libs/template/helpers.go | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/acceptance/bundle/templates/default-python/serverless-auto-disabled/output.txt b/acceptance/bundle/templates/default-python/serverless-auto-disabled/output.txt index 6abf52cf0..060963ac8 100644 --- a/acceptance/bundle/templates/default-python/serverless-auto-disabled/output.txt +++ b/acceptance/bundle/templates/default-python/serverless-auto-disabled/output.txt @@ -2,6 +2,7 @@ >>> [CLI] bundle init default-python --config-file ./input.json --output-dir output Welcome to the default Python template for Databricks Asset Bundles! +Warn: Auto-detected that serverless is not enabled for your workspace 900800700600 Workspace to use (auto-detected, edit in 'my_default_python/databricks.yml'): [DATABRICKS_URL] ✨ Your new project has been created in the 'my_default_python' directory! diff --git a/libs/template/helpers.go b/libs/template/helpers.go index b6fcda44e..13bd6cecc 100644 --- a/libs/template/helpers.go +++ b/libs/template/helpers.go @@ -222,5 +222,16 @@ func isServerlessSupported(ctx context.Context, w *databricks.WorkspaceClient) b log.Warnf(ctx, "Failed to detect if serverless is supported: %s failed: %s", apiEndpoint, err) return defaultServerlessSupported } - return response.Setting.Value.PreviewEnablementVal.Enabled + + log.Debugf(ctx, "Called %s: %#v", apiEndpoint, response) + + isSupported := response.Setting.Value.PreviewEnablementVal.Enabled + + if isSupported { + log.Infof(ctx, "Auto-detected that serverless is enabled for your workspace %d", workspaceId) + } else { + log.Warnf(ctx, "Auto-detected that serverless is not enabled for your workspace %d", workspaceId) + } + + return isSupported }