
Answer-first summary for fast verification
Answer: pipeline = Pipeline(workspace=ws, steps=pipeline_steps) experiment = Experiment(workspace=ws, name='pipeline-experiment') run = experiment.submit(pipeline), pipeline = Pipeline(workspace=ws, steps=pipeline_steps) run = pipeline.submit(experiment_name='pipeline-experiment')
The question requires selecting two valid methods to run an Azure ML pipeline. Based on the Azure ML SDK documentation and community consensus (57% selected CD, with high upvotes on explanations supporting this), options C and D are correct. Option C creates a Pipeline object and submits it via an Experiment object using experiment.submit(pipeline), which is a standard approach. Option D creates a Pipeline object and submits it directly using pipeline.submit(experiment_name='pipeline-experiment'), which is also valid as the Pipeline.submit() method accepts an experiment_name parameter to create/use an experiment. Option A is incorrect because experiment.submit() expects a Pipeline or RunConfiguration object, not a raw list of steps. Option B is invalid as Run() cannot be instantiated directly with pipeline steps. The community discussion clarifies that while some initially favored A & C, A is definitively wrong, and D is correct despite misconceptions about its syntax.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
You use the following code to define the steps for a pipeline:
from azureml.core import Workspace, Experiment, Run
from azureml.pipeline.core import Pipeline
from azureml.pipeline.steps import PythonScriptStep
ws = Workspace.from_config()
# ...
step1 = PythonScriptStep(name="step1", ...)
step2 = PythonScriptStep(name="step2", ...)
pipeline_steps = [step1, step2]
from azureml.core import Workspace, Experiment, Run
from azureml.pipeline.core import Pipeline
from azureml.pipeline.steps import PythonScriptStep
ws = Workspace.from_config()
# ...
step1 = PythonScriptStep(name="step1", ...)
step2 = PythonScriptStep(name="step2", ...)
pipeline_steps = [step1, step2]
You need to add code to run the steps.
Which two code segments can you use to achieve this goal? Each correct answer presents a complete solution.
NOTE: Each correct selection is worth one point.
A
experiment = Experiment(workspace=ws, name='pipeline-experiment') run = experiment.submit(config=pipeline_steps)
B
run = Run(pipeline_steps)
C
pipeline = Pipeline(workspace=ws, steps=pipeline_steps) experiment = Experiment(workspace=ws, name='pipeline-experiment') run = experiment.submit(pipeline)
D
pipeline = Pipeline(workspace=ws, steps=pipeline_steps) run = pipeline.submit(experiment_name='pipeline-experiment')