โ09-18-2024 03:16 AM
Using this page of the DAB docs, I tried to substitute cluster configuration by a variable. That way, I want to predefine different job cluster configurations. Doing exactly what is used in the docs yields this error:
Error: failed to load [...]/specific_job.yml: error unmarshaling JSON: json: cannot unmarshal object into Go struct field Variable.variables.default of type string
โ09-18-2024 05:24 AM
โ09-18-2024 04:25 AM
Hi @jonyvp ,
could you share your .yml?
โ09-18-2024 04:30 AM
I do an include of the yml in my databricks.yml. The yml pasted below:
variables:
my_cluster:
description: "My cluster definition"
type: complex
default:
spark_version: "13.2.x-scala2.11"
node_type_id: "Standard_DS3_v2"
num_workers: 2
spark_conf:
spark.speculation: true
spark.databricks.delta.retentionDurationCheck.enabled: false
resources:
jobs:
my_job:
name: "my_job"
max_concurrent_runs: 1
job_clusters:
- job_cluster_key: my_cluster_key
new_cluster: ${var.my_cluster}
tasks:
- task_key: my_job
spark_python_task:
python_file: /Workspace/Shared/.bundle/[...]/specific_task.py
job_cluster_key: my_cluster_key
libraries:
- whl: ../dist/*.whl
โ09-18-2024 04:39 AM - edited โ09-18-2024 04:40 AM
Hi @jonyvp ,
This won't work. The ${var.my_cluster} can substitute just one individual value.
With variable you can substitute specific fields, but you cannot substitue the entire cluster configuration object at once. Thus the error.
Check the article on how to override cluster settings:
Override cluster settings in Databricks Asset Bundles | Databricks on AWS
โ09-18-2024 04:42 AM
Hi filipniziol, according to this docs, it should be possible?
https://docs.databricks.com/en/dev-tools/bundles/variables.html#define-a-complex-variable
โ09-18-2024 05:07 AM
@jonyvp , wow, that's something new to me! Thanks for sharing!
The error though is about inability to convert your object to string, so it expects a string.
Are you using the newest databricks cli? Maybe that's a relatively new feature and you need to use the up-to-date cli
โ09-18-2024 05:24 AM
โ09-18-2024 05:42 AM
Amazing! Great!
Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโt want to miss the chance to attend and share knowledge.
If there isnโt a group near you, start one and help create a community that brings people together.
Request a New Group