Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ To disable this, set the environment variable DATABRICKS_CACHE_ENABLED to false.

### Bundles
* Enable caching user identity by default ([#4202](https://github.com/databricks/cli/pull/4202))
* Do not show single node warning when is_single_node option is explicitly set ([#4272](https://github.com/databricks/cli/pull/4272))
* Fix false positive folder permission warnings and make them more actionable ([#4216](https://github.com/databricks/cli/pull/4216))
* Pass additional Azure DevOps system variables ([#4236](https://github.com/databricks/cli/pull/4236))
* Replace Black formatter with Ruff in Python bundle templates for faster, all-in-one linting and formatting ([#4196](https://github.com/databricks/cli/pull/4196))
Expand Down
7 changes: 7 additions & 0 deletions bundle/config/validate/single_node_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ func showSingleNodeClusterWarning(ctx context.Context, v dyn.Value) bool {
return false
}

// If is_single_node is set to true, the cluster is correctly configured automatically.
// No need to show the warning.
isSingleNode, ok := v.Get("is_single_node").AsBool()
if ok && isSingleNode {
return false
}

// Convenient type that contains the common fields from compute.ClusterSpec and
// pipelines.PipelineCluster that we are interested in.
type ClusterConf struct {
Expand Down
38 changes: 38 additions & 0 deletions bundle/config/validate/single_node_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -563,3 +563,41 @@ func TestValidateSingleNodeClusterPassJobForEachTaskCluster(t *testing.T) {
})
}
}

func TestValidateSingleNodeClusterWithIsSingleNode(t *testing.T) {
ctx := context.Background()

// Test that when is_single_node is set to true, no warning is shown
// even if the manual single-node configuration is not present.
b := &bundle.Bundle{
Config: config.Root{
Resources: config.Resources{
Jobs: map[string]*resources.Job{
"foo": {
JobSettings: jobs.JobSettings{
JobClusters: []jobs.JobCluster{
{
NewCluster: compute.ClusterSpec{
ClusterName: "my_cluster",
},
},
},
},
},
},
},
},
}

// Set num_workers to 0 and is_single_node to true
bundletest.Mutate(t, b, func(v dyn.Value) (dyn.Value, error) {
v, err := dyn.Set(v, "resources.jobs.foo.job_clusters[0].new_cluster.num_workers", dyn.V(0))
if err != nil {
return v, err
}
return dyn.Set(v, "resources.jobs.foo.job_clusters[0].new_cluster.is_single_node", dyn.V(true))
})

diags := bundle.Apply(ctx, b, SingleNodeCluster())
assert.Empty(t, diags)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

acceptance test in acceptance/bundle/validate would be a bit simpler, no?