Courseiva
Model Deployment →hardMultiple Choice

Databricks-ML-Pro Model Deployment Practice Question

An ML engineer is deploying a model that includes a custom Python class for preprocessing. During deployment to a Model Serving endpoint, the model fails to load with a 'ModuleNotFoundError'. What is the most likely cause of this error despite having the class in the training notebook?

⚠ Common exam trap

Candidates assume that because a custom class is defined and works inside an interactive notebook, MLflow will automatically pickle or capture it without explicit file inclusion.

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 custom class was not saved as a separate .py file and included in the 'code_paths' parameter during logging.

When MLflow logs a model, it captures the environment but not necessarily the local code or classes defined in the notebook unless they are part of a package or provided as a code dependency. For custom classes to be available in the serving container, they must be included in the 'code_paths' argument of the log_model function.

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 custom class was not saved as a separate .py file and included in the 'code_paths' parameter during logging.

    Why this is correct

    Notebook-defined classes exist only in the memory of the training session. To make them available to the Model Serving endpoint, the class definition must be in a Python file that is explicitly uploaded to the MLflow artifact store along with the model during the logging process.

  • ✗

    The Model Serving endpoint does not support custom Python classes for security reasons.

    Why it's wrong here

    Model Serving fully supports custom Python logic through the `pyfunc` flavor. The platform is designed to be flexible and allows users to define complex preprocessing and postprocessing steps, provided the code is correctly packaged and referenced within the model's metadata.

  • ✗

    The data scientist forgot to install the 'databricks-model-serving' library in the training cluster.

    Why it's wrong here

    There is no requirement to install a specific serving library on the training cluster to log a model. The error is related to the model's internal code dependencies being missing in the serving environment, not the absence of a library on the cluster used for training.

  • ✗

    The custom class must be registered in the Unity Catalog as a separate 'Function' entity.

    Why it's wrong here

    While Unity Catalog supports User Defined Functions (UDFs), model-specific preprocessing logic is typically encapsulated within the MLflow model itself. Registering it as a separate SQL function is not the standard or required workflow for deploying custom Python classes within a model endpoint.

About these practice questions

This Databricks-ML-Pro question is part of Courseiva's 300-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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-Pro 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-Pro exam.