DP-100 · Question #368
You manage an Azure Machine Learning workspace named workspace1. You must develop Python SDK v2 code to add a compute instance to workspace1. The code must import all required modules and call the con
The correct answer is C. begin_create_or_update method of an instance of the azure.ai.ml.MLCIient class. To add an instantiated compute instance to an Azure Machine Learning workspace using Python SDK v2, you must use the begin_create_or_update method of an MLClient instance.
Question
Options
- Aconstructor of the azure.ai.ml.ComputeSchedule class
- Bconstructor of the azure.ai.ml.ComputePowerAction enum
- Cbegin_create_or_update method of an instance of the azure.ai.ml.MLCIient class
- Dset_resources method of an instance of the azure.ai.ml.Command class
How the community answered
(34 responses)- A3% (1)
- B15% (5)
- C74% (25)
- D9% (3)
Why each option
To add an instantiated compute instance to an Azure Machine Learning workspace using Python SDK v2, you must use the `begin_create_or_update` method of an `MLClient` instance.
The `azure.ai.ml.ComputeSchedule` class is used to define schedules for starting or stopping compute resources, not for creating the compute instance itself.
The `azure.ai.ml.ComputePowerAction` enum specifies power management actions (e.g., start, stop) for an existing compute instance, not for its creation.
In Azure Machine Learning Python SDK v2, the `MLClient` class is the central point of interaction for managing workspace resources. To provision or update a compute instance, you instantiate the `ComputeInstance` class with desired properties, then pass that object to the `ml_client.compute.begin_create_or_update()` method to apply the changes to the workspace.
The `set_resources` method of an `azure.ai.ml.Command` class is typically used to specify compute requirements (like CPU, GPU, memory) for a specific job or command, not to create or manage a compute instance at the workspace level.
Concept tested: Azure ML SDK v2 compute instance creation
Source: https://learn.microsoft.com/en-us/python/api/azure-ai-ml/azure.ai.ml.mlclient?view=azureml-api-latest#azure-ai-ml-mlclient-begin-create-or-update
Topics
Community Discussion
No community discussion yet for this question.