-
Notifications
You must be signed in to change notification settings - Fork 184
Fixed spark version check for clusters defined in the same bundle #2374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| bundle: | ||
| name: trampoline_warning_message | ||
|
|
||
| targets: | ||
| dev: | ||
| mode: development | ||
| default: true | ||
|
|
||
| prod: | ||
| resources: | ||
| clusters: | ||
| development_cluster: | ||
| spark_version: 14.2.x-cpu-ml-scala2.12 | ||
|
|
||
|
|
||
| resources: | ||
| clusters: | ||
| development_cluster: | ||
| cluster_name: jobs-as-code-all-purpose-cluster | ||
| spark_version: 12.2.x-cpu-ml-scala2.12 | ||
| node_type_id: r5d.8xlarge | ||
| autotermination_minutes: 30 | ||
| autoscale: | ||
| min_workers: 1 | ||
| max_workers: 1 | ||
| driver_node_type_id: r5d.8xlarge | ||
| jobs: | ||
| whl: | ||
| name: "wheel-job" | ||
| tasks: | ||
| - task_key: test_task | ||
| python_wheel_task: | ||
| package_name: my_package | ||
| entry_point: my_module.my_function | ||
| existing_cluster_id: ${resources.clusters.development_cluster.id} | ||
|
andrewnester marked this conversation as resolved.
Outdated
|
||
| libraries: | ||
| - whl: ./dist/*.whl | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| Error: Python wheel tasks require compute with DBR 13.3+ to include local libraries. Please change your cluster configuration or use the experimental 'python_wheel_wrapper' setting. See https://docs.databricks.com/dev-tools/bundles/python-wheel.html for more information. | ||
|
|
||
| Name: trampoline_warning_message | ||
| Target: dev | ||
| Workspace: | ||
| User: [USERNAME] | ||
| Path: /Workspace/Users/[USERNAME]/.bundle/trampoline_warning_message/dev | ||
|
|
||
| Found 1 error | ||
|
|
||
| Exit code: 1 | ||
| Name: trampoline_warning_message | ||
| Target: prod | ||
| Workspace: | ||
| User: [USERNAME] | ||
| Path: /Workspace/Users/[USERNAME]/.bundle/trampoline_warning_message/prod | ||
|
|
||
| Validation OK! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| errcode $CLI bundle validate -t dev | ||
| errcode $CLI bundle validate -t prod |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ import ( | |
| "github.com/databricks/cli/bundle/config" | ||
| "github.com/databricks/cli/bundle/libraries" | ||
| "github.com/databricks/cli/libs/diag" | ||
| "github.com/databricks/cli/libs/dyn/dynvar" | ||
| "github.com/databricks/cli/libs/log" | ||
| "github.com/databricks/databricks-sdk-go" | ||
| "golang.org/x/mod/semver" | ||
|
|
@@ -60,11 +61,32 @@ func hasIncompatibleWheelTasks(ctx context.Context, b *bundle.Bundle) bool { | |
| } | ||
|
|
||
| if task.ExistingClusterId != "" { | ||
| version, err := getSparkVersionForCluster(ctx, b.WorkspaceClient(), task.ExistingClusterId) | ||
| // If there's error getting spark version for cluster, do not mark it as incompatible | ||
| if err != nil { | ||
| log.Warnf(ctx, "unable to get spark version for cluster %s, err: %s", task.ExistingClusterId, err.Error()) | ||
| return false | ||
| var version string | ||
| var err error | ||
| // If the cluster id is a variable and it's not resolved, it means it references a cluster defined in the same bundle. | ||
| // So we can get the version from the cluster definition. | ||
| // It's defined in a form of resources.clusters.<cluster_key>.spark_version while the value here is | ||
|
andrewnester marked this conversation as resolved.
Outdated
|
||
| // ${resources.clusters.<cluster_key>.id} | ||
| if strings.HasPrefix(task.ExistingClusterId, "${") { | ||
|
andrewnester marked this conversation as resolved.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You don't need to have this check, you can directly use the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I know, just want to make the intention here a bit more clear when reading it |
||
| p, ok := dynvar.PureReferenceToPath(task.ExistingClusterId) | ||
| if !ok || len(p) < 3 { | ||
| log.Warnf(ctx, "unable to parse cluster key from %s", task.ExistingClusterId) | ||
| return false | ||
| } | ||
| clusterKey := p[2].Key() | ||
|
andrewnester marked this conversation as resolved.
|
||
| cluster, ok := b.Config.Resources.Clusters[clusterKey] | ||
| if !ok { | ||
| log.Warnf(ctx, "unable to find cluster with key %s", clusterKey) | ||
| return false | ||
| } | ||
| version = cluster.SparkVersion | ||
| } else { | ||
| version, err = getSparkVersionForCluster(ctx, b.WorkspaceClient(), task.ExistingClusterId) | ||
| // If there's error getting spark version for cluster, do not mark it as incompatible | ||
| if err != nil { | ||
| log.Warnf(ctx, "unable to get spark version for cluster %s, err: %s", task.ExistingClusterId, err.Error()) | ||
| return false | ||
| } | ||
| } | ||
|
|
||
| if lowerThanExpectedVersion(version) { | ||
|
andrewnester marked this conversation as resolved.
|
||
|
|
@@ -82,7 +104,7 @@ func lowerThanExpectedVersion(sparkVersion string) bool { | |
| return false | ||
| } | ||
|
|
||
| if parts[1][0] == 'x' { // treat versions like 13.x as the very latest minor (13.99) | ||
| if len(parts[1]) > 0 && parts[1][0] == 'x' { // treat versions like 13.x as the very latest minor (13.99) | ||
| parts[1] = "99" | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.