File tree Expand file tree Collapse file tree
knowledge_base/development_cluster Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Development cluster
2+
3+ This example demonstrates how to define and use a development (all-purpose) cluster in a Databricks Asset Bundle.
4+
5+ This bundle defines an ` example_job ` which is run on a job cluster in production mode.
6+
7+ For the development mode (default ` dev ` target) the job is overriden to use a development cluster which is provisioned
8+ as part of the bundle deployment as well.
9+
10+ For more information, please refer to the [ documentation] ( https://docs.databricks.com/en/dev-tools/bundles/settings.html#clusters ) .
11+
12+ ## Prerequisites
13+
14+ * Databricks CLI v0.229.0 or above
15+
16+ ## Usage
17+
18+ Update the ` host ` field under ` workspace ` in ` databricks.yml ` to the Databricks workspace you wish to deploy to.
19+
20+ Run ` databricks bundle deploy ` to deploy the job. It's deployed to ` dev ` target with a defined ` development_cluster ` cluster.
21+
22+ Run ` databricks bundle deploy -t prod ` to deploy the job to prod target. It's deployed with a job cluster instead of development one.
23+
24+ Run ` databricks bundle run example_job ` to run the job.
Original file line number Diff line number Diff line change 1+ bundle :
2+ name : development_cluster
3+
4+ include :
5+ - resources/*.yml
6+
7+ workspace :
8+ host : https://e2-dogfood.staging.cloud.databricks.com
9+
10+ targets :
11+ dev :
12+ mode : development
13+ default : true
14+
15+ # By configuring this field for the "dev" target, all jobs in this bundle
16+ # are overridden to use the all-purpose cluster defined below.
17+ #
18+ # This can increase the speed of development when iterating on code and job definitions,
19+ # as you don't have to wait for job clusters to start for every job run.
20+ #
21+ # Note: make sure that the cluster configuration below matches the job cluster
22+ # definition that will be used when deploying the other targets.
23+ cluster_id : ${resources.clusters.development_cluster.id}
24+
25+ resources :
26+ clusters :
27+ development_cluster :
28+ cluster_name : Development cluster
29+ spark_version : 15.4.x-scala2.12
30+ node_type_id : i3.xlarge
31+ num_workers : 0
32+ autotermination_minutes : 30
33+ spark_conf :
34+ " spark.databricks.cluster.profile " : " singleNode"
35+ " spark.master " : " local[*, 4]"
36+ custom_tags :
37+ " ResourceClass " : " SingleNode"
38+
39+ prod : {
40+ # No overrides
41+ }
Original file line number Diff line number Diff line change 1+ resources :
2+ jobs :
3+ example_job :
4+ name : " Example job to demonstrate using an interactive cluster for development"
5+
6+ tasks :
7+ - task_key : notebook
8+ job_cluster_key : cluster
9+ notebook_task :
10+ notebook_path : ../src/hello.py
11+
12+ job_clusters :
13+ - job_cluster_key : cluster
14+ new_cluster :
15+ spark_version : 15.4.x-scala2.12
16+ node_type_id : i3.xlarge
17+ num_workers : 0
18+ spark_conf :
19+ " spark.databricks.cluster.profile " : " singleNode"
20+ " spark.master " : " local[*, 4]"
21+ custom_tags :
22+ " ResourceClass " : " SingleNode"
Original file line number Diff line number Diff line change 1+ # Databricks notebook source
2+
3+ print ("Hello, World!" )
You can’t perform that action at this time.
0 commit comments