PMLE Kubeflow Pipelines SDK Practice Question
An engineer needs to compile a Kubeflow Pipeline defined in Python to a JSON format that can be run on Vertex AI Pipelines. Which command should they use?
⚠ Common exam trap
The trap here is that candidates may mistakenly believe that the `gcloud ai pipelines` command or the `dsl.pipeline` decorator directly compiles the pipeline, but in Google's Vertex AI Pipelines, you must use the KFP SDK's `Compiler().compile()` method to generate the pipeline JSON specification.
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
✓
kfp.compiler.Compiler().compile(pipeline_func, 'pipeline.json')
The Kubeflow Pipelines SDK provides the `kfp.compiler.Compiler().compile()` method to convert a Python-based pipeline function into a JSON or YAML format that is compatible with Vertex AI Pipelines. This JSON representation defines the pipeline's components, dependencies, and execution graph, enabling it to be submitted to Vertex AI for orchestration. The `compile()` method is the standard way to produce a portable pipeline specification from Python code.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
kfp.compiler.Compiler().compile(pipeline_func, 'pipeline.json')
Why this is correct
The KFP compiler's compile method converts a Python pipeline function into an IR YAML or JSON specification that Vertex AI Pipelines can submit and execute. Passing the pipeline function and output filename produces the required JSON artefact directly.
- ✗
gcloud ai pipelines compile command.
Why it's wrong here
No gcloud ai pipelines compile subcommand exists; gcloud manages Vertex AI resources but does not translate Kubeflow Python into pipeline IR JSON. It is tempting because gcloud submits pipelines and feels like the natural CLI, yet compilation is performed by the KFP SDK's compiler, not by gcloud.
- ✗
kfp.Client().upload_pipeline()
Why it's wrong here
upload_pipeline() pushes an already-compiled pipeline template to a registry; it does not convert Python into the IR JSON. It is tempting because uploading and compiling both precede a Vertex AI run, but the SDK method expects a finished YAML or JSON template, so compilation must happen first.
- ✗
dsl.pipeline decorator automatically compiles at runtime.
Why it's wrong here
The dsl.pipeline decorator only defines the pipeline object in Python; it does not emit the IR JSON that Vertex AI Pipelines requires for submission. It is tempting because decorators feel like they finalise a pipeline, but compilation to JSON still needs an explicit compiler call such as kfp.compiler.Compiler().compile().
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.