You have an existing, powerful Databricks cluster in your local environment and, instead of provisioning an Azure ML compute, you decide to use it in your ML experiments as a training compute.
# Create the compute databricks_cluster = [select the passing code segment here](ws, compute_name, compute_config) databricks_cluster.wait_for_completion(show_output=True)Which code segment should you choose to complete the code?
Click on the arrows to vote for the correct answer
A. B. C. D.Answer: C.
Option A is incorrect because the create() method of the ComputeTarget class is used for adding Azure-managed computes to the workspace.
It cannot be used for external computes.
Option B is incorrect because provisioning_configuration is a parameter of the create() method.
Option C is CORRECT becausecompute targets defined outside the Azure space (typically a Databricks cluster) can be added to the workspace by the attach() method.
Option D is incorrect because use is not a valid method name for compute targets.
Reference:
In this scenario, the objective is to use an existing Databricks cluster as a training compute for machine learning experiments instead of provisioning an Azure ML compute. To achieve this, we need to create a ComputeTarget object that represents the Databricks cluster and then use this object in our ML experiments.
The correct method to create a ComputeTarget object that represents the existing Databricks cluster is ComputeTarget.attach(). This method is used to attach an existing compute target to a workspace. We can use this method to attach a Databricks cluster as a compute target.
Therefore, the correct code segment to complete the code is:
makefiledatabricks_cluster = ComputeTarget.attach(workspace=ws, name=compute_name)
where "ws" is the workspace object, "compute_name" is the name of the Databricks cluster, and "databricks_cluster" is the ComputeTarget object that represents the Databricks cluster.
After creating the ComputeTarget object, we can use it as a training compute for our ML experiments. The wait_for_completion() method is used to wait for the completion of the creation of the compute target.
Therefore, the complete code would be:
pythonfrom azureml.core.workspace import Workspace from azureml.core.compute import ComputeTarget # Get the workspace ws = Workspace.from_config() # Define the name and configuration of the existing Databricks cluster compute_name = "existing-databricks-cluster" compute_config = None # or any configuration specific to the Databricks cluster # Attach the Databricks cluster as a compute target databricks_cluster = ComputeTarget.attach(workspace=ws, name=compute_name) # Wait for the completion of the creation of the compute target databricks_cluster.wait_for_completion(show_output=True)
This code segment will allow us to use the existing Databricks cluster as a training compute for our ML experiments without the need to provision an Azure ML compute.