PMLE Automating and Orchestrating ML Pipelines Practice Question
An ML engineer wants to containerize a custom training script and use it as a component in a Vertex AI Pipeline. The component should accept a dataset URI and a learning rate parameter, and output a trained model artifact. Which approach should the engineer use to define the component?
⚠ Common exam trap
Candidates often confuse Python function components (@dsl.component) with container components. The trap here is that they may think a Python function component can containerize a custom script, but it cannot directly specify a container image and artifact outputs like ContainerComponent does.
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
✓
Use ContainerComponent from kfp.v2.components to define the container, its inputs, and outputs.
ContainerComponent from kfp.v2.components allows you to define a custom container component by specifying the container image, command, inputs, and outputs directly. This is the appropriate approach when you have a custom training script that you want to containerize and use as a component in a Vertex AI Pipeline, as it gives you full control over the container configuration and artifact handling.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use a pre-built Google Cloud Pipeline Component for Vertex AI Training with custom container configuration.
Why it's wrong here
Pre-built components wrap Google's own training images and fixed input/output signatures, so they cannot execute an arbitrary custom script with a bespoke dataset URI and learning-rate interface. They suit standard AutoML or custom training jobs. A custom container component defined with a YAML specification exposes exactly those parameters and the model artifact output.
- ✓
Use ContainerComponent from kfp.v2.components to define the container, its inputs, and outputs.
Why this is correct
ContainerComponent from kfp.v2.components lets the engineer declare a custom container image plus typed inputs (dataset URI, learning rate) and outputs (model artifact), satisfying the stem's requirement to containerise a custom training script as a pipeline component.
- ✗
Define a Python function component with @dsl.component and include the container code inline.
Why it's wrong here
A @dsl.component Python function runs lightweight Python inside the pipeline's build environment; it cannot package and execute an arbitrary custom container image. It suits small preprocessing or data-transform steps. Containerising a training script requires a custom container component whose YAML spec declares the dataset URI, learning rate and model artifact.
- ✗
Use the importer component to import the script and then run it as a task.
Why it's wrong here
The importer component registers an existing artifact, such as a model or dataset, into Vertex AI Metadata; it executes no training code and produces no trained model. It is tempting when artefacts already exist and merely need cataloguing. Running a containerised script requires a custom container component with declared inputs and outputs.
Go deeper
Related to this question
About these practice questions
Courseiva writes every PMLE question from scratch — 775 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This PMLE practice question is part of Courseiva's free Google Cloud 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 PMLE exam.