Skip to content

Commit 751b1d3

Browse files
authored
Do not show single node warning when is_single_node option is explicitly set (#4272)
## Changes Do not show single node warning when is_single_node option is explicitly set ## Why Fixes #4267 ## Tests Added an unit test <!-- If your PR needs to be included in the release notes for next release, add a separate entry in NEXT_CHANGELOG.md as part of your PR. -->
1 parent 1ce3553 commit 751b1d3

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

NEXT_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ To disable this, set the environment variable DATABRICKS_CACHE_ENABLED to false.
1010

1111
### Bundles
1212
* Enable caching user identity by default ([#4202](https://github.com/databricks/cli/pull/4202))
13+
* Do not show single node warning when is_single_node option is explicitly set ([#4272](https://github.com/databricks/cli/pull/4272))
1314
* Fix false positive folder permission warnings and make them more actionable ([#4216](https://github.com/databricks/cli/pull/4216))
1415
* Pass additional Azure DevOps system variables ([#4236](https://github.com/databricks/cli/pull/4236))
1516
* 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))

bundle/config/validate/single_node_cluster.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ func showSingleNodeClusterWarning(ctx context.Context, v dyn.Value) bool {
4444
return false
4545
}
4646

47+
// If is_single_node is set to true, the cluster is correctly configured automatically.
48+
// No need to show the warning.
49+
isSingleNode, ok := v.Get("is_single_node").AsBool()
50+
if ok && isSingleNode {
51+
return false
52+
}
53+
4754
// Convenient type that contains the common fields from compute.ClusterSpec and
4855
// pipelines.PipelineCluster that we are interested in.
4956
type ClusterConf struct {

bundle/config/validate/single_node_cluster_test.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,3 +563,41 @@ func TestValidateSingleNodeClusterPassJobForEachTaskCluster(t *testing.T) {
563563
})
564564
}
565565
}
566+
567+
func TestValidateSingleNodeClusterWithIsSingleNode(t *testing.T) {
568+
ctx := context.Background()
569+
570+
// Test that when is_single_node is set to true, no warning is shown
571+
// even if the manual single-node configuration is not present.
572+
b := &bundle.Bundle{
573+
Config: config.Root{
574+
Resources: config.Resources{
575+
Jobs: map[string]*resources.Job{
576+
"foo": {
577+
JobSettings: jobs.JobSettings{
578+
JobClusters: []jobs.JobCluster{
579+
{
580+
NewCluster: compute.ClusterSpec{
581+
ClusterName: "my_cluster",
582+
},
583+
},
584+
},
585+
},
586+
},
587+
},
588+
},
589+
},
590+
}
591+
592+
// Set num_workers to 0 and is_single_node to true
593+
bundletest.Mutate(t, b, func(v dyn.Value) (dyn.Value, error) {
594+
v, err := dyn.Set(v, "resources.jobs.foo.job_clusters[0].new_cluster.num_workers", dyn.V(0))
595+
if err != nil {
596+
return v, err
597+
}
598+
return dyn.Set(v, "resources.jobs.foo.job_clusters[0].new_cluster.is_single_node", dyn.V(true))
599+
})
600+
601+
diags := bundle.Apply(ctx, b, SingleNodeCluster())
602+
assert.Empty(t, diags)
603+
}

0 commit comments

Comments
 (0)