Question 64 of 506
Automating and orchestrating ML pipelineseasyMultiple ChoiceObjective-mapped

Quick Answer

The correct approach is to import the preprocess module and call create_component_from_func on the function within each pipeline definition, then use the resulting component object directly. This works because the KFP SDK treats the decorated Python function as the single source of truth for the component’s logic, so re-importing the module ensures every pipeline always uses the latest version of that function without needing to build, package, or upload a separate container image. On the Google Professional Machine Learning Engineer exam, this question tests your understanding of how Vertex AI Pipelines leverages the KFP SDK’s lightweight, function-based component system—a common trap is assuming you must pre-build a container or store the component in a registry, but the SDK’s create_component_from_func handles serialization and execution at runtime. Remember the memory tip: “Import, don’t export”—you import the function and create the component in each pipeline, rather than exporting a pre-packaged artifact.

PMLE Automating and orchestrating ML pipelines Practice Question

This PMLE practice question tests your understanding of automating and orchestrating ml pipelines. Read the scenario carefully and evaluate each option against the stated constraints before committing to an answer. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

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?

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.

Option A is correct because 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.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

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.

    Related concept

    Read the scenario before looking for a memorised answer.

  • 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.

Common exam traps

Common exam trap: answer the scenario, not the keyword

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.

Detailed technical explanation

How to think about this question

Under the hood, `create_component_from_func` introspects the function's source code, dependencies, and type annotations to generate a component specification that includes a lightweight container image (by default, `python:3.7`) and a command that executes the function. When you import the module and call `create_component_from_func` again, KFP re-generates the component spec from the function's current source, ensuring consistency. In real-world scenarios, teams often place shared components in a common Python package (e.g., `shared_components/preprocess.py`) and import them across multiple pipeline definitions, avoiding duplication and version drift.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A media company stores terabytes of video archives that are accessed once a year for audit purposes. Moving these objects to a cold storage tier (Azure Archive, S3 Glacier, or Google Nearline) costs a fraction of hot storage. Questions like this test whether you understand storage tiers, access frequency tradeoffs, and retrieval latency requirements.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related PMLE practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free PMLE practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this PMLE question test?

Automating and orchestrating ML pipelines — This question tests Automating and orchestrating ML pipelines — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: Import the preprocess module and call create_component_from_func on the function, then use the resulting component in pipeline definitions. — Option A is correct because 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.

What should I do if I get this PMLE question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 11, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

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.