File tree Expand file tree Collapse file tree
knowledge_base/job_with_run_job_tasks Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ .databricks
Original file line number Diff line number Diff line change 1+ # Job with ` run_job ` tasks
2+
3+ This example demonstrates how to compose multiple jobs with ` run_job ` tasks.
4+
5+ ## Prerequisites
6+
7+ * Databricks CLI v0.230.0 or above
8+ * Serverless enabled on the Databricks workspace
9+
10+ ## Usage
11+
12+ Update the ` host ` field under ` workspace ` in ` databricks.yml ` to the Databricks workspace you wish to deploy to.
13+
14+ Run ` databricks bundle deploy ` to deploy the bundle.
15+
16+ Run ` databricks bundle run primary ` to run the primary job that triggers the leaf jobs.
Original file line number Diff line number Diff line change 1+ import sys
2+
3+ # Display the task's arguments to confirm parameter propagation.
4+ print (f"argv[0]: { sys .argv [0 ]} " )
5+ print (f"argv[1:]: { ', ' .join (sys .argv [1 :])} " )
Original file line number Diff line number Diff line change 1+ bundle :
2+ name : job_with_run_job_tasks
3+
4+ workspace :
5+ host : https://e2-dogfood.staging.cloud.databricks.com
6+
7+ permissions :
8+ - level : CAN_VIEW
9+ group_name : users
10+
11+ resources :
12+ jobs :
13+ primary :
14+ name : primary job
15+
16+ tasks :
17+ - task_key : run_leaf1
18+ run_job_task :
19+ job_id : ${resources.jobs.leaf1.id}
20+
21+ - task_key : run_leaf2
22+ depends_on :
23+ - task_key : run_leaf1
24+
25+ run_job_task :
26+ job_id : ${resources.jobs.leaf2.id}
27+
28+ parameters :
29+ - name : input
30+ default : test_propagation
31+
32+
33+ leaf1 :
34+ name : leaf job 1
35+
36+ tasks :
37+ - task_key : leaf
38+ environment_key : default
39+ spark_python_task :
40+ python_file : ./argv.py
41+ parameters :
42+ - " leaf1"
43+ - " {{ job.parameters.[input] }}"
44+ parameters :
45+ - # This parameter is passed by the primary job.
46+ name : input
47+ default : " "
48+
49+ environments :
50+ - environment_key : default
51+ spec :
52+ client : " 1"
53+
54+
55+ leaf2 :
56+ name : leaf job 2
57+
58+ tasks :
59+ - task_key : leaf
60+ environment_key : default
61+ spark_python_task :
62+ python_file : ./argv.py
63+ parameters :
64+ - " leaf2"
65+ - " {{ job.parameters.[input] }}"
66+
67+ parameters :
68+ - # This parameter is passed by the primary job.
69+ name : input
70+ default : " "
71+
72+ environments :
73+ - environment_key : default
74+ spec :
75+ client : " 1"
76+
77+
78+ targets :
79+ dev :
80+ default : true
81+ mode : development
You can’t perform that action at this time.
0 commit comments