Courseiva
hardMultiple Choice

PMLE Practice Question: A company uses Vertex AI Pipelines with prebuilt…

A company uses Vertex AI Pipelines with prebuilt components for data processing, training, and deployment. They need to integrate a custom validation step written in Python. What is the correct way to include this as a component?

⚠ Common exam trap

A common mix-up: candidates confuse the `@component` decorator with a simple function wrapper and assume they can just write inline Python code in the pipeline YAML (Option B), not realizing that Vertex AI Pipelines requires each step to be a containerized component with explicit input/output definitions.

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

✓

Create a custom component using the Vertex AI Pipelines SDK @component decorator

The Vertex AI Pipelines SDK provides a `@component` decorator that allows you to define a custom Python function as a pipeline component. This decorator automatically handles packaging the Python code into a container image, generating the component specification, and integrating it seamlessly with the pipeline orchestration engine. It is the idiomatic and recommended way to add custom validation logic without manually managing Docker or infrastructure.

Answer analysis

Option-by-option breakdown

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

  • ✗

    Package the code in a Docker container and reference it as a custom job

    Why it's wrong here

    Packaging Python code into a Docker container and running it as a custom job is an unnecessarily complex approach for integrating a simple validation step within a Vertex AI Pipeline. Vertex AI offers a more direct mechanism to define custom components from Python functions using the SDK, designed for seamless integration alongside prebuilt components within the pipeline graph. This option is tempting because Dockerisation is a standard method for deploying complex applications or when a bespoke execution environment is crucial, and it would be correct for executing a standalone, resource-intensive task or a non-Python application as a Vertex AI custom job.

  • ✗

    Define the step in the YAML pipeline definition using arbitrary Python commands

    Why it's wrong here

    Arbitrary Python commands in the pipeline YAML are not a component specification; Vertex AI requires a defined component interface with inputs, outputs, and a container or function. It is tempting because YAML defines the pipeline, but the correct approach uses a custom component or Python function component so the step is executable and traceable.

  • ✓

    Create a custom component using the Vertex AI Pipelines SDK @component decorator

    Why this is correct

    The @component decorator converts a Python function into a reusable Vertex AI pipeline component, packaging its dependencies and generating a component specification. This satisfies the need to add custom Python validation logic alongside prebuilt components without building a container manually.

  • ✗

    Use a Cloud Function as a pipeline step

    Why it's wrong here

    A Cloud Function is an external serverless endpoint; Vertex AI Pipelines cannot treat it as a component with typed inputs, outputs, and artefacts, so lineage and parameter passing break. It is tempting because Cloud Functions run Python code, but the correct method defines a custom component or Python function component within the pipeline.

  • ✗

    Write a standalone Python script and call it using a Cloud Shell step

    Why it's wrong here

    A Cloud Shell step runs shell commands in a temporary environment, not a pipeline component with declared inputs, outputs, and artefacts, so Vertex AI cannot track or pass data through it. It is tempting because Cloud Shell executes Python, but the correct approach packages the validation as a custom component or lightweight Python function component.

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 →

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.