databricks-cli/bundle/config
shreyas-goenka b323703c1b
Add validation for single node clusters (#1909)
## Changes
This PR adds a warning validating that the configuration for a single
node cluster is valid for interactive, job, job-task, and pipeline
clusters.

Note: We skip the validation if a cluster policy is configured because
the policy is likely to configure `spark_conf` / `custom_tags` itself.

Note: Terrform originally only had validation for interactive, job, and
job-task clusters. This PR adding the validation for pipeline clusters
as well is new.

This PR follows the same logic as we used to have in Terraform. The
validation was removed from Terraform because we had no way to demote
the error to a warning:
https://github.com/databricks/terraform-provider-databricks/pull/4222

### Background
Single-node clusters require `spark_conf` and `custom_tags` to be
correctly set in the cluster definition for them to function optimally.
The cluster will be created even if incorrectly configured, but its
performance will not be great.

For example, if both `spark_conf` and `custom_tags` are not set and
`num_workers` is 0, then only the driver process will be launched on the
cluster compute instance thus leading to sub-optimal utilization of
available compute resources and no parallelization across worker
processes when processing a spark query.

### Issue

This PR addresses some issues reported in
https://github.com/databricks/cli/issues/1546

## Tests
Unit tests and manually.

Example output of the warning:
```
➜  bundle-playground git:(master) ✗ cli bundle validate
Warning: Single node cluster is not correctly configured
  at resources.pipelines.bar.clusters[0]
  in databricks.yml:29:11

num_workers should be 0 only for single-node clusters. To create a
valid single node cluster please ensure that the following properties
are correctly set in the cluster specification:

  spark_conf:
    spark.databricks.cluster.profile: singleNode
    spark.master: local[*]

  custom_tags:
    ResourceClass: SingleNode
  

Name: foobar
Target: default
Workspace:
  User: shreyas.goenka@databricks.com
  Path: /Workspace/Users/shreyas.goenka@databricks.com/.bundle/foobar/default

Found 1 warning
```
2024-11-22 15:48:09 +00:00
..
generate Add bundle generate variant for dashboards (#1847) 2024-10-29 11:51:59 +00:00
loader Add validation for files with a `.(resource-name).yml` extension (#1780) 2024-10-07 09:16:20 +00:00
mutator Extended message for warning when source-linked mode is used outside of the workspace (#1929) 2024-11-22 14:44:33 +00:00
resources Make `TableName` field part of quality monitor schema (#1903) 2024-11-14 17:39:38 +00:00
validate Add validation for single node clusters (#1909) 2024-11-22 15:48:09 +00:00
variable Support lookup by name of notification destinations (#1922) 2024-11-21 15:52:14 +01:00
artifact.go Stop tracking file path locations in bundle resources (#1673) 2024-08-13 12:50:15 +00:00
artifacts_test.go Added exec.NewCommandExecutor to execute commands with correct interpreter (#1075) 2023-12-21 15:45:23 +00:00
bundle.go Added support for creating all-purpose clusters (#1698) 2024-09-23 10:42:34 +00:00
deployment.go Make lock optional in the JSON schema (#1738) 2024-09-02 08:39:08 +00:00
experimental.go Make `pydabs/venv_path` optional (#1687) 2024-08-20 13:26:57 +00:00
filename.go Move bundle configuration filename code (#917) 2023-10-25 09:54:39 +00:00
filename_test.go Move bundle configuration filename code (#917) 2023-10-25 09:54:39 +00:00
git.go Use dynamic configuration model in bundles (#1098) 2024-02-16 19:41:58 +00:00
lock.go Disable locking for development mode (#1302) 2024-04-18 01:59:39 +00:00
lock_test.go Acquire lock prior to deploy (#270) 2023-03-22 16:37:26 +01:00
presets.go Source-linked deployments for bundles in the workspace (#1884) 2024-11-20 13:22:27 +01:00
resources.go Add support for AI/BI dashboards (#1743) 2024-10-29 09:11:08 +00:00
resources_test.go Add `bundle summary` to display URLs for deployed resources (#1731) 2024-10-18 06:45:47 +00:00
root.go Simplified isFullVariableOverrideDef implementation (#1791) 2024-09-26 12:55:07 +00:00
root_test.go Fixed full variable override detection (#1787) 2024-09-25 12:35:16 +00:00
sync.go Add paths field to bundle sync configuration (#1694) 2024-08-21 15:33:25 +00:00
target.go Added support for creating all-purpose clusters (#1698) 2024-09-23 10:42:34 +00:00
workspace.go Always prepend bundle remote paths with /Workspace (#1724) 2024-10-02 15:34:00 +00:00
workspace_test.go Resolve configuration before performing verification (#890) 2023-10-20 13:10:31 +00:00