
Answer-first summary for fast verification
Answer: service.get_logs()
The question asks for the code segment to determine events during service deployment and initialization when deployment fails. Option B (service.get_logs()) is correct because it retrieves the deployment logs, which contain detailed information about deployment events, errors, and initialization processes. This is the standard Azure ML SDK method for troubleshooting deployment failures. The community discussion confirms this with 100% consensus on B, and the reference documentation supports using get_logs() for troubleshooting deployments. Option A (service.state) only provides the current state (e.g., 'Failed') but not detailed events. Option C (service.serialize()) is for serializing the service object, not for debugging. Option D (service.environment) returns environment configuration but not deployment events.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
You use the following Python code in a notebook to deploy a model as a web service:
from azureml.core.webservice import AciWebservice
from azureml.core.model import InferenceConfig
inference_config = InferenceConfig(runtime='python', source_directory='model_files', entry_script='score.py', conda_file='env.yml')
deployment_config = AciWebservice.deploy_configuration(cpu_cores=1, memory_gb=1)
service = Model.deploy(ws, 'my-service', [model], inference_config, deployment_config)
service.wait_for_deployment(True)
from azureml.core.webservice import AciWebservice
from azureml.core.model import InferenceConfig
inference_config = InferenceConfig(runtime='python', source_directory='model_files', entry_script='score.py', conda_file='env.yml')
deployment_config = AciWebservice.deploy_configuration(cpu_cores=1, memory_gb=1)
service = Model.deploy(ws, 'my-service', [model], inference_config, deployment_config)
service.wait_for_deployment(True)
The deployment fails. You need to use the Python SDK in the notebook to determine the events that occurred during service deployment and initialization. Which code segment should you use?
A
service.state
B
service.get_logs()
C
service.serialize()
D
service.environment
No comments yet.