
Answer-first summary for fast verification
Answer: details.properties['azureml.git.branch'], details = run.get_details()
To retrieve the active Git branch for a training run in Azure ML, you must first obtain the run details using `run.get_details()`, which returns a dictionary containing various properties about the run. From this dictionary, you can access the Git branch information via the `properties['azureml.git.branch']` key. Option D (`details = run.get_details()`) is necessary to get the run details, and option B (`details.properties['azureml.git.branch']`) retrieves the specific branch property. Option A (`details = run.get_environment()`) is incorrect because it fetches environment details, not run details or Git information. Option C (`details.properties['azureml.git.commit']`) retrieves the Git commit hash, not the branch name, making it unsuitable for this requirement. The community discussion, with high upvotes and references to official Microsoft documentation, consistently supports B and D as the correct choices.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
You are developing a machine learning project on a local machine using the Azure Machine Learning SDK for Python and Git for version control. After submitting a training run that returns a Run object, you need to retrieve the active Git branch for that run.
Which two code segments should you use? Each correct answer presents part of the solution. NOTE: Each correct selection is worth one point.
A
details = run.get_environment()
B
details.properties['azureml.git.branch']
C
details.properties['azureml.git.commit']
D
details = run.get_details()
No comments yet.