Skip to content

Commit 1a373f1

Browse files
authored
Merge pull request Azure#621 from Azure/ak/revert-db-overwrite
Revert automatic overwrite of databricks content
2 parents 659fb7a + 60de701 commit 1a373f1

File tree

8 files changed

+134
-14
lines changed

8 files changed

+134
-14
lines changed
Binary file not shown.
+54-14
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,73 @@
1-
Azure Databricks is a managed Spark offering on Azure and customers already use it for advanced analytics. It provides a collaborative Notebook based environment with CPU or GPU based compute cluster.
1+
Azure Databricks is a managed Spark offering on Azure and customers already use it for advanced analytics. It provides a collaborative Notebook based environment with CPU or GPU based compute cluster.
22

3-
In this section, you will find sample notebooks on how to use Azure Machine Learning SDK with Azure Databricks. You can train a model using Spark MLlib and then deploy the model to ACI/AKS from within Azure Databricks. You can also use Automated ML capability (**public preview**) of Azure ML SDK with Azure Databricks.
3+
In this section, you will find sample notebooks on how to use Azure Machine Learning SDK with Azure Databricks. You can train a model using Spark MLlib and then deploy the model to ACI/AKS from within Azure Databricks. You can also use Automated ML capability (**public preview**) of Azure ML SDK with Azure Databricks.
44

5-
- Customers who use Azure Databricks for advanced analytics can now use the same cluster to run experiments with or without automated machine learning.
6-
- You can keep the data within the same cluster.
7-
- You can leverage the local worker nodes with autoscale and auto termination capabilities.
8-
- You can use multiple cores of your Azure Databricks cluster to perform simultenous training.
9-
- You can further tune the model generated by automated machine learning if you chose to.
10-
- Every run (including the best run) is available as a pipeline, which you can tune further if needed.
5+
- Customers who use Azure Databricks for advanced analytics can now use the same cluster to run experiments with or without automated machine learning.
6+
- You can keep the data within the same cluster.
7+
- You can leverage the local worker nodes with autoscale and auto termination capabilities.
8+
- You can use multiple cores of your Azure Databricks cluster to perform simultenous training.
9+
- You can further tune the model generated by automated machine learning if you chose to.
10+
- Every run (including the best run) is available as a pipeline, which you can tune further if needed.
1111
- The model trained using Azure Databricks can be registered in Azure ML SDK workspace and then deployed to Azure managed compute (ACI or AKS) using the Azure Machine learning SDK.
1212

1313
Please follow our [Azure doc](https://docs.microsoft.com/en-us/azure/machine-learning/service/how-to-configure-environment#azure-databricks) to install the sdk in your Azure Databricks cluster before trying any of the sample notebooks.
1414

15-
**Single file** -
15+
**Single file** -
1616
The following archive contains all the sample notebooks. You can the run notebooks after importing [DBC](Databricks_AMLSDK_1-4_6.dbc) in your Databricks workspace instead of downloading individually.
1717

18-
Notebooks 1-4 have to be run sequentially & are related to Income prediction experiment based on this [dataset](https://archive.ics.uci.edu/ml/datasets/adult) and demonstrate how to data prep, train and operationalize a Spark ML model with Azure ML Python SDK from within Azure Databricks.
18+
Notebooks 1-4 have to be run sequentially & are related to Income prediction experiment based on this [dataset](https://archive.ics.uci.edu/ml/datasets/adult) and demonstrate how to data prep, train and operationalize a Spark ML model with Azure ML Python SDK from within Azure Databricks.
1919

2020
Notebook 6 is an Automated ML sample notebook for Classification.
2121

2222
Learn more about [how to use Azure Databricks as a development environment](https://docs.microsoft.com/azure/machine-learning/service/how-to-configure-environment#azure-databricks) for Azure Machine Learning service.
2323

24-
**Databricks as a Compute Target from AML Pipelines**
25-
You can use Azure Databricks as a compute target from [Azure Machine Learning Pipelines](https://docs.microsoft.com/en-us/azure/machine-learning/service/concept-ml-pipelines). Take a look at this notebook for details: [aml-pipelines-use-databricks-as-compute-target.ipynb](https://github.com/Azure/MachineLearningNotebooks/tree/master/how-to-use-azureml/azure-databricks/databricks-as-remote-compute-target/aml-pipelines-use-databricks-as-compute-target.ipynb).
24+
**Databricks as a Compute Target from Azure ML Pipelines**
25+
You can use Azure Databricks as a compute target from [Azure Machine Learning Pipelines](https://docs.microsoft.com/en-us/azure/machine-learning/service/concept-ml-pipelines). Take a look at this notebook for details: [aml-pipelines-use-databricks-as-compute-target.ipynb](https://github.com/Azure/MachineLearningNotebooks/tree/master/how-to-use-azureml/azure-databricks/databricks-as-remote-compute-target/aml-pipelines-use-databricks-as-compute-target.ipynb).
26+
27+
# Linked Azure Databricks and Azure Machine Learning Workspaces (Preview)
28+
Customers can now link Azure Databricks and AzureML Workspaces to better enable cross-Azure ML scenarios by [managing their tracking data in a single place when using the MLflow client](https://mlflow.org/docs/latest/tracking.html#mlflow-tracking) - the Azure ML workspace.
29+
30+
## Linking the Workspaces (Admin operation)
31+
32+
1. The Azure Databricks Azure portal blade now includes a new button to link an Azure ML workspace.
33+
![New ADB Portal Link button](./img/adb-link-button.png)
34+
2. Both a new or existing Azure ML Workspace can be linked in the resulting prompt. Follow any instructions to set up the Azure ML Workspace.
35+
![Link Prompt](./img/link-prompt.png)
36+
3. After a successful link operation, you should see the Azure Databricks overview reflect the linked status
37+
![Linked Successfully](./img/adb-successful-link.png)
38+
39+
## Configure MLflow to send data to Azure ML (All roles)
40+
41+
1. Add azureml-mlflow as a library to any notebook or cluster that should send data to Azure ML. You can do this via:
42+
1. [DBUtils](https://docs.azuredatabricks.net/user-guide/dev-tools/dbutils.html#dbutils-library)
43+
```
44+
dbutils.library.installPyPI("azureml-mlflow")
45+
dbutils.library.restartPython() # Removes Python state
46+
```
47+
2. [Cluster Libraries](https://docs.azuredatabricks.net/user-guide/libraries.html#install-a-library-on-a-cluster)
48+
![Cluster Library](./img/cluster-library.png)
49+
2. [Set the MLflow tracking URI](https://mlflow.org/docs/latest/tracking.html#where-runs-are-recorded) to the following scheme:
50+
```
51+
adbazureml://${azuremlRegion}.experiments.azureml.net/history/v1.0/subscriptions/${azuremlSubscriptionId}/resourceGroups/${azuremlResourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/${azuremlWorkspaceName}
52+
```
53+
1. You can automatically configure this on your clusters for all subsequent notebook sessions using this helper script instead of manually setting the tracking URI in the notebook:
54+
* [AzureML Tracking Cluster Init Script](./linking/README.md)
55+
3. If configured correctly, you'll now be able to see your MLflow tracking data in both Azure ML (via the REST API and all clients) and Azure Databricks (in the MLflow UI and using the MLflow client)
56+
57+
58+
## Known Preview Limitations
59+
While we roll this experience out to customers for feedback, there are some known limitations we'd love comments on in addition to any other issues seen in your workflow.
60+
### 1-to-1 Workspace linking
61+
Currently, an Azure ML Workspace can only be linked to one Azure Databricks Workspace at a time.
62+
### Data synchronization
63+
At the moment, data is only generated in the Azure Machine Learning workspace for tracking. Editing tags via the Azure Databricks MLflow UI won't be reflected in the Azure ML UI.
64+
### Java and R support
65+
The experience currently is only available from the Python MLflow client.
2666
2767
For more on SDK concepts, please refer to [notebooks](https://github.com/Azure/MachineLearningNotebooks).
2868
2969
**Please let us know your feedback.**
3070
31-
3271
33-
![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/how-to-use-azureml/azure-databricks/README.png)
72+
73+
![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/how-to-use-azureml/azure-databricks/README.png)
Loading
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Adding an init script to an Azure Databricks cluster
2+
3+
The [azureml-cluster-init.sh](./azureml-cluster-init.sh) script configures the environment to
4+
1. Use the configured AzureML Workspace with Workspace.from_config()
5+
2. Set the default MLflow Tracking Server to be the AzureML managed one
6+
7+
Modify azureml-cluster-init.sh by providing the values for region, subscriptionId, resourceGroupName, and workspaceName of your target Azure ML workspace in the highlighted section at the top of the script.
8+
9+
To create the Azure Databricks cluster-scoped init script
10+
11+
1. Create the base directory you want to store the init script in if it does not exist.
12+
```
13+
dbutils.fs.mkdirs("dbfs:/databricks/<directory>/")
14+
```
15+
16+
2. Create the script by copying the contents of azureml-cluster-init.sh
17+
```
18+
dbutils.fs.put("/databricks/<directory>/azureml-cluster-init.sh","""
19+
<configured_contents_of_azureml-cluster-init.sh>
20+
""", True)
21+
22+
3. Check that the script exists.
23+
```
24+
display(dbutils.fs.ls("dbfs:/databricks/<directory>/azureml-cluster-init.sh"))
25+
```
26+
27+
1. Configure the cluster to run the script.
28+
* Using the cluster configuration page
29+
1. On the cluster configuration page, click the Advanced Options toggle.
30+
1. At the bottom of the page, click the Init Scripts tab.
31+
1. In the Destination drop-down, select a destination type. Example: 'DBFS'
32+
1. Specify a path to the init script.
33+
```
34+
dbfs:/databricks/<directory>/azureml-cluster-init.sh
35+
```
36+
1. Click Add
37+
38+
* Using the API.
39+
```
40+
curl -n -X POST -H 'Content-Type: application/json' -d '{
41+
"cluster_id": "<cluster_id>",
42+
"num_workers": <num_workers>,
43+
"spark_version": "<spark_version>",
44+
"node_type_id": "<node_type_id>",
45+
"cluster_log_conf": {
46+
"dbfs" : {
47+
"destination": "dbfs:/cluster-logs"
48+
}
49+
},
50+
"init_scripts": [ {
51+
"dbfs": {
52+
"destination": "dbfs:/databricks/<directory>/azureml-cluster-init.sh"
53+
}
54+
} ]
55+
}' https://<databricks-instance>/api/2.0/clusters/edit
56+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
# This script configures the environment to
3+
# 1. Use the configured AzureML Workspace with azureml.core.Workspace.from_config()
4+
# 2. Set the default MLflow Tracking Server to be the AzureML managed one
5+
6+
############## START CONFIGURATION #################
7+
# Provide the required *AzureML* workspace information
8+
region="" # example: westus2
9+
subscriptionId="" # example: bcb65f42-f234-4bff-91cf-9ef816cd9936
10+
resourceGroupName="" # example: dev-rg
11+
workspaceName="" # example: myazuremlws
12+
13+
# Optional config directory
14+
configLocation="/databricks/config.json"
15+
############### END CONFIGURATION #################
16+
17+
18+
# Drop the workspace configuration on the cluster
19+
sudo touch $configLocation
20+
sudo echo {\\"subscription_id\\": \\"${subscriptionId}\\", \\"resource_group\\": \\"${resourceGroupName}\\", \\"workspace_name\\": \\"${workspaceName}\\"} > $configLocation
21+
22+
# Set the MLflow Tracking URI
23+
trackingUri="adbazureml://${region}.experiments.azureml.net/history/v1.0/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/${workspaceName}"
24+
sudo echo export MLFLOW_TRACKING_URI=${trackingUri} >> /databricks/spark/conf/spark-env.sh

0 commit comments

Comments
 (0)