Databricks Machine Learning Professional Question 115
Single answerYou are working on a Databricks ML project where you have configured a webhook to notify an external monitoring system whenever a registered model transitions to the 'Production' stage. Which of the following code blocks will trigger the configured webhook?
- A
mlflow.register_model(model_uri='runs:/
/model', name='my_model') - B
client.update_model_version_stage(name='my_model', version=1, stage='Production', archive_existing_versions=True)
- C
mlflow.log_metric('accuracy', 0.95)
- D
client.create_registered_model(name='new_model')
Show answer and explanation
Correct answer: B
Explanation
Webhooks in Databricks ML are triggered based on specific events, such as model version stage transitions. Transitioning a model version's stage to 'Production' using the MLflow client triggers the webhook, provided it has been correctly configured for this stage change. The correct code block, 'client.update_model_version_stage', performs this stage transition and triggers the webhook.
- A. Incorrect.
This code registers a model with MLflow but does not transition its stage. Webhooks are not triggered for model registration actions.
- B. Correct.
This code explicitly transitions the stage of a registered model version to 'Production'. If a webhook is configured for this stage transition, it will be triggered.
- C. Incorrect.
This code logs a metric to MLflow but does not involve any stage transitions or registered model actions that would trigger a webhook.
- D. Incorrect.
This code creates a new registered model but does not involve a stage transition, so it will not trigger a webhook.