Subdomain 1.6: Runtimes
1.Which approach is most effective for ensuring that required Python packages are available without causing notebook restarts during package installation?
- A.Build a custom runtime with all necessary packages pre-installed in the Docker image.
- B.Develop a background script that pip-installs dependencies while the notebook loads.
- C.Adjust the project settings to extend the session timeout and avoid frequent restarts.
- D.Attach a persistent volume containing a virtual environment with pre-installed packages.
Show answer & explanation
Correct answer: A — Build a custom runtime with all necessary packages pre-installed in the Docker image.
- A. Correct. Building a custom runtime with all necessary packages pre-installed in the Docker image ensures that the environment is consistent, reproducible, and ready for use without additional setup time during session startup. This is the recommended practice in Cloudera Machine Learning to avoid interruptions from package installation.
- B. Incorrect. Developing a background script to pip-install dependencies during notebook load can lead to delays, inconsistencies, and potential failures if the installation process encounters issues. This is not a recommended practice for production environments and does not prevent restarts from interrupting installation.
- C. Incorrect. Adjusting the project settings to extend the session timeout does not address the root issue of missing packages. It only delays the inevitable restart and does not ensure the required packages are available.
- D. Incorrect. Attaching a persistent volume with a virtual environment may work but is less efficient and scalable compared to a custom runtime. It also introduces complexity in managing dependencies across different sessions or users. Runtime images are the intended place to define dependencies.