PMLE Automating and Orchestrating ML Pipelines Practice Question
A machine learning engineer wants to define a lightweight pipeline component that runs custom Python code without building a container image. Which KFP SDK feature should they use?
⚠ Common exam trap
A common mix-up: candidates confuse 'lightweight' with 'no container at all,' but KFP always runs components in containers; the `@dsl.component` feature automates container creation, not eliminates it.
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
✓
Python function component with @dsl.component
The `@dsl.component` decorator in KFP SDK allows you to define a lightweight Python function component that runs custom code without requiring a container image. It automatically generates a container specification from the function's dependencies, making it ideal for simple, non-containerized pipeline steps.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Importer component
Why it's wrong here
The Importer component registers an existing artefact, such as a model or dataset, into a pipeline as an input; it executes no custom Python logic. It is the right choice when surfacing pre-existing artefacts, but the Lightweight Python Component is what runs inline Python without building a container image.
- ✓
Python function component with @dsl.component
Why this is correct
The @dsl.component decorator converts a plain Python function into a lightweight pipeline component, letting KFP build the container automatically. This satisfies the stem's requirement to run custom Python code without manually building a container image.
- ✗
Container component
Why it's wrong here
A Container component requires a pre-built container image to execute, which directly contradicts the engineer’s requirement to avoid building an image. It is tempting because Container components are the standard KFP SDK method for packaging custom Python code with dependencies, and would be the correct choice if the engineer were willing to build and push a Docker image to a registry.
- ✗
Vertex AI Training job
Why it's wrong here
A Vertex AI Training job launches a managed container-based training workload on Vertex, so it still requires a container image and is not a KFP SDK component. It suits submitting custom training code as a standalone job, whereas the Lightweight Python Component runs inline Python without any image build.
Go deeper
Related to this question
About these practice questions
This PMLE question is part of Courseiva's 775-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 →
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.