
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 identifying 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 string. Option A is incorrect because `experiment.submit(config=pipeline_steps)` expects a Pipeline or RunConfiguration object, not a list of steps. Option B is incorrect as `Run(pipeline_steps)` is not a valid constructor; runs are created by submitting pipelines or experiments. The community discussion highlights that while some users initially favored A and C, the official documentation confirms that only C and D are correct, with D being valid due to the Pipeline.submit method's flexibility.
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')