Databricks-ML-Assoc Model Development Practice Question
When using MLflow to track experiments, what happens if you invoke mlflow.end_run() inside a nested loop when the parent run is already active?
⚠ Common exam trap
Candidates often call mlflow.end_run() inside loops without considering that it terminates the active run, which leads to subsequent logging failures or orphaned sub-runs.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
The active run is terminated, and subsequent logging calls outside the loop will fail if they assume the run is active.
Calling end_run() within a nested loop terminates the current active run. If it is part of a parent-child structure, ending the child prematurely could lead to incomplete data or orphaned metrics. Proper management requires careful scoping, often using context managers (with statements), to ensure that the run lifecycle is handled cleanly and that all sub-runs correctly report back to the primary experiment tracking context.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The entire experiment is deleted from the workspace.
Why it's wrong here
Ending a run does not delete the experiment or the logs already recorded. It simply marks the specific run as finished in the MLflow tracking store. The historical data remains intact, and the experiment container itself is unaffected, allowing for further runs or analysis of the existing completed data.
- ✓
The active run is terminated, and subsequent logging calls outside the loop will fail if they assume the run is active.
Why this is correct
MLflow keeps track of the 'active run' state. If you terminate it explicitly, any following code that attempts to log data without starting a new run will throw an error. This is crucial to understand when writing loops, as scope management is necessary to maintain consistent logging patterns during execution.
- ✗
The parent run automatically restarts to compensate for the closed child run.
Why it's wrong here
MLflow does not have an auto-restart mechanism for runs. Once a run is finished, it cannot be resumed. If a developer requires the parent to continue, they must ensure the nested structure is correctly managed, as closing the run explicitly ends the logging capability for that particular scope entirely.
- ✗
The nested loop continues, but logging is redirected to the default root run.
Why it's wrong here
MLflow does not automatically redirect logging to a root run. If the active run is closed, logging simply stops working for the remainder of the session unless a new run is explicitly started. This ensures that data remains strictly associated with specific experiment runs rather than being mixed into global contexts.
About these practice questions
One of 319 original Databricks-ML-Assoc practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Databricks exam blueprint
This Databricks-ML-Assoc practice question is part of Courseiva's free Databricks certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the Databricks-ML-Assoc exam.