Courseiva
easyMultiple ChoiceObjective-mapped

PMLE Practice Question: An ML engineer is using Vertex AI Pipelines with…

An ML engineer is using Vertex AI Pipelines with Kubeflow Pipelines SDK (KFP) to orchestrate a training and deployment workflow. They want to reuse a custom component across multiple pipelines. The component is defined in a Python file 'preprocess.py' that includes a function decorated with @kfp.components.create_component_from_func. How should they package this component for reuse?

⚠ Common exam trap

The trap here is that candidates may overthink the packaging step and assume a YAML file or container image is required for reuse, when the KFP SDK is designed to treat Python functions as first-class reusable components through simple module imports.

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

Import the preprocess module and call create_component_from_func on the function, then use the resulting component in pipeline definitions.

The recommended way to reuse a custom component defined via `@kfp.components.create_component_from_func` is to import the Python module containing the decorated function and call `create_component_from_func` on that function in each pipeline definition. This creates a reusable component object that can be used directly in the pipeline's `@dsl.pipeline` definition without additional packaging steps. The KFP SDK treats the function as the source of truth, and re-importing ensures the component logic is always current.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Import the preprocess module and call create_component_from_func on the function, then use the resulting component in pipeline definitions.

    Why this is correct

    This allows the component to be defined once and reused.

  • Save the component as a YAML file using kfp.components.ComponentStore and load it in other pipelines.

    Why it's wrong here

    ComponentStore is not a standard KFP feature.

  • Compile the pipeline that uses the component into a JSON file and upload it to Vertex AI.

    Why it's wrong here

    Compilation is for the pipeline, not the component.

  • Build a custom container image with the function and use it as a base image in other pipelines.

    Why it's wrong here

    Overkill; the KFP SDK handles component reuse without containers.

About these practice questions

Courseiva writes every PMLE question from scratch — 990 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 →

How Courseiva writes practice questions · Editorial policy

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.