nerdexam
Microsoft

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.

Design and prepare a machine learning solution

Question

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 constructor of the ComputeInstance class. You need to add the instantiated compute instance to workspace1. What should you use?

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)
  • A
    3% (1)
  • B
    15% (5)
  • C
    74% (25)
  • D
    9% (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.

Aconstructor of the azure.ai.ml.ComputeSchedule class

The `azure.ai.ml.ComputeSchedule` class is used to define schedules for starting or stopping compute resources, not for creating the compute instance itself.

Bconstructor of the azure.ai.ml.ComputePowerAction enum

The `azure.ai.ml.ComputePowerAction` enum specifies power management actions (e.g., start, stop) for an existing compute instance, not for its creation.

Cbegin_create_or_update method of an instance of the azure.ai.ml.MLCIient classCorrect

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.

Dset_resources method of an instance of the azure.ai.ml.Command class

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

#Azure Machine Learning#Compute Instance#Python SDK v2#Resource Provisioning

Community Discussion

No community discussion yet for this question.

Full DP-100 Practice