generated from databricks-industry-solutions/industry-solutions-blueprints
-
Notifications
You must be signed in to change notification settings - Fork 6
/
RUNME.py
94 lines (83 loc) · 4.14 KB
/
RUNME.py
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
# Databricks notebook source
# MAGIC %md This notebook sets up the companion cluster(s) to run the solution accelerator. It also creates the Workflow to illustrate the order of execution. Happy exploring!
# MAGIC 🎉
# MAGIC
# MAGIC
# MAGIC **Steps**
# MAGIC 1. Simply attach this notebook to a cluster with DBR 11.0 and above, and hit Run-All for this notebook. A multi-step job and the clusters used in the job will be created for you and hyperlinks are printed on the last block of the notebook.
# MAGIC
# MAGIC 2. Run the accelerator notebooks: Feel free to explore the multi-step job page and **run the Workflow**, or **run the notebooks interactively** with the cluster to see how this solution accelerator executes.
# MAGIC
# MAGIC 2a. **Run the Workflow**: Navigate to the Workflow link and hit the `Run Now` 💥.
# MAGIC
# MAGIC 2b. **Run the notebooks interactively**: Attach the notebook with the cluster(s) created and execute as described in the `job_json['tasks']` below.
# MAGIC
# MAGIC **Prerequisites**
# MAGIC 1. **To read shared data that has been shared with you in this accelerator using the Databricks-to-Databricks protocol, you must be a user on a Databricks workspace that is enabled for Unity Catalog**
# MAGIC
# MAGIC 2. You need to have cluster creation permissions in this workspace.
# MAGIC
# MAGIC 3. In case the environment has cluster-policies that interfere with automated deployment, you may need to manually create the cluster in accordance with the workspace cluster policy. The `job_json` definition below still provides valuable information about the configuration these series of notebooks should run with.
# MAGIC
# MAGIC **Notes**
# MAGIC 1. The pipelines, workflows and clusters created in this script are not user-specific. Keep in mind that rerunning this script again after modification resets them for other users too.
# MAGIC
# MAGIC 2. If the job execution fails, please confirm that you have set up other environment dependencies as specified in the accelerator notebooks. Accelerators may require the user to set up additional cloud infra or secrets to manage credentials.
# COMMAND ----------
# DBTITLE 0,Install util packages
# MAGIC %pip install git+https://github.com/databricks-academy/dbacademy@v1.0.13 git+https://github.com/databricks-industry-solutions/notebook-solution-companion@safe-print-html --quiet --disable-pip-version-check
# COMMAND ----------
from solacc.companion import NotebookSolutionCompanion
# COMMAND ----------
job_json = {
"timeout_seconds": 7200,
"max_concurrent_runs": 1,
"tags": {
"usage": "solacc_testing",
"group": "HLS"
},
"tasks": [
{
"job_cluster_key": "SDH_cluster",
"libraries": [],
"notebook_task": {
"notebook_path": f"00_README"
},
"task_key": "SDH_00",
"description": ""
},
{
"job_cluster_key": "SDH_cluster",
"notebook_task": {
"notebook_path": f"01_SDH-vaccination-rates"
},
"task_key": "SDH_01",
"depends_on": [
{
"task_key": "SDH_00"
}
]
}
],
"job_clusters": [
{
"job_cluster_key": "SDH_cluster",
"new_cluster": {
"spark_version": "11.2.x-cpu-ml-scala2.12",
"spark_conf": {
"spark.databricks.delta.formatCheck.enabled": "false"
},
"num_workers": 2,
"node_type_id": {"AWS": "i3.xlarge", "MSA": "Standard_DS3_v2", "GCP": "n1-highmem-4"},
"custom_tags": {
"usage": "solacc_testing"
},
}
}
]
}
# COMMAND ----------
dbutils.widgets.dropdown("run_job", "False", ["True", "False"])
run_job = dbutils.widgets.get("run_job") == "True"
NotebookSolutionCompanion().deploy_compute(job_json, run_job=run_job)
# COMMAND ----------