-
Notifications
You must be signed in to change notification settings - Fork 0
/
databricks-jobs.tf
117 lines (105 loc) · 3.01 KB
/
databricks-jobs.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
resource "databricks_job" "catalog_migration_to_temp" {
provider = databricks.workspace
name = "catalog-migration-to-temp"
existing_cluster_id = module.spoke.default_cluster_id
#create-sample-data
task {
task_key = "create-sample-data"
notebook_task {
notebook_path = databricks_notebook.create_sample_data.path
base_parameters = {
catalog_name = module.sandbox.catalog_name
}
}
}
#create-tmp-catalog
task {
task_key = "create-tmp-catalog"
existing_cluster_id = module.spoke.default_cluster_id
depends_on {
task_key = "create-sample-data"
}
notebook_task {
notebook_path = databricks_notebook.create_catalog.path
base_parameters = {
catalog_name = "dev_databricksstu_tmp"
}
}
}
#migrate-data-to-tmp
task {
task_key = "migrate-data-to-tmp"
existing_cluster_id = module.spoke.default_cluster_id
depends_on {
task_key = "create-tmp-catalog"
}
notebook_task {
notebook_path = databricks_notebook.migrate_data.path
base_parameters = {
source_catalog = module.sandbox.catalog_name
target_catalog = "dev_databricksstu_tmp"
}
}
}
#test-data-to-tmp
task {
task_key = "test-data-to-tmp"
existing_cluster_id = module.spoke.default_cluster_id
depends_on {
task_key = "migrate-data-to-tmp"
}
notebook_task {
notebook_path = databricks_notebook.run_tests.path
base_parameters = {
source_catalog = module.sandbox.catalog_name
target_catalog = "dev_databricksstu_tmp"
}
}
}
}
resource "databricks_job" "catalog_migration_temp_to_new_catalog" {
provider = databricks.workspace
name = "catalog-temp-to-new-catlog"
existing_cluster_id = module.spoke.default_cluster_id
#migrate-tmp-to-data
task {
task_key = "migrate-tmp-to-data"
existing_cluster_id = module.spoke.default_cluster_id
notebook_task {
notebook_path = databricks_notebook.migrate_data.path
base_parameters = {
source_catalog = "dev_databricksstu_tmp"
target_catalog = "${local.name}_sandbox"
}
}
}
#test-data-to-tmp
task {
task_key = "test-tmp-to-data"
existing_cluster_id = module.spoke.default_cluster_id
depends_on {
task_key = "migrate-tmp-to-data"
}
notebook_task {
notebook_path = databricks_notebook.run_tests.path
base_parameters = {
source_catalog = "dev_databricksstu_tmp"
target_catalog = "${local.name}_sandbox"
}
}
}
#drop-source-catalog (NOTE will need to remove this in TF after this is applied)
task {
task_key = "drop-source-catalog"
existing_cluster_id = module.spoke.default_cluster_id
depends_on {
task_key = "test-tmp-to-data"
}
notebook_task {
notebook_path = databricks_notebook.drop_catalog.path
base_parameters = {
catalog_name = "dev_databricksstu_tmp"
}
}
}
}