在设计器中使用管道参数生成通用管道Use pipeline parameters in the designer to build versatile pipelines

使用管道参数在设计器中生成灵活管道。Use pipeline parameters to build flexible pipelines in the designer. 通过管道参数,你可以在运行时动态设置值以封装管道逻辑和重用资产。Pipeline parameters let you dynamically set values at runtime to encapsulate pipeline logic and reuse assets.

在重新提交管道运行、重新训练模型执行批量预测时,管道参数特别有用。Pipeline parameters are especially useful when resubmitting a pipeline run, retraining models, or performing batch predictions.

本文介绍如何执行以下操作:In this article, you learn how to do the following:

  • 创建管道参数Create pipeline parameters
  • 删除和管理管道参数Delete and manage pipeline parameters
  • 调整管道参数时,触发管道运行Trigger pipeline runs while adjusting pipeline parameters

先决条件Prerequisites

重要

如果看不到本文档中提到的图形元素(例如工作室或设计器中的按钮),则你可能没有适当级别的工作区权限。If you do not see graphical elements mentioned in this document, such as buttons in studio or designer, you may not have the right level of permissions to the workspace. 请与 Azure 订阅管理员联系,验证是否已向你授予正确级别的访问权限。Please contact your Azure subscription administrator to verify that you have been granted the correct level of access. 有关详细信息,请参阅管理用户和角色For more information, see Manage users and roles.

创建管道参数Create pipeline parameter

在设计器中创建管道参数有三种方法:There are three ways to create a pipeline parameter in the designer:

  • 在设置面板中创建管道参数,并将其绑定到模块。Create a pipeline parameter in the settings panel, and bind it to a module.
  • 将模块参数提升为管道参数。Promote a module parameter to a pipeline parameter.
  • 将数据集提升为管道参数Promote a dataset to a pipeline parameter

备注

管道参数仅支持 intfloatstring 等基本数据类型。Pipeline parameters only support basic data types like int, float, and string.

选项 1:在设置面板中创建管道参数Option 1: Create a pipeline parameter in the settings panel

在本部分,你将在设置面板中创建管道参数。In this section, you create a pipeline parameter in the settings panel.

在本示例中,你将创建一个管道参数,该参数定义管道如何使用清理缺失数据模块填充缺失的数据。In this example, you create a pipeline parameter that defines how a pipeline fills in missing data using the Clean missing data module.

  1. 在管道草稿名称旁边,选择齿轮图标打开“设置”面板 。Next to the name of your pipeline draft, select the gear icon to open the Settings panel.

  2. 在“管道参数”部分,选择 + 图标 。In the Pipeline parameters section, select the + icon.

  3. 输入参数名称和默认值。Enter a name for the parameter and a default value.

    例如,输入 replace-missing-value 作为参数名称,输入 0 作为默认值。For example, enter replace-missing-value as parameter name and 0 as default value.

屏幕截图显示了如何创建管道参数

创建管道参数之后,必须将其附加到要动态设置的模块参数After you create a pipeline parameter, you must attach it to the module parameter that you want to dynamically set.

选项 2:提升模块参数Option 2: Promote a module parameter

为模块值创建管道参数最简单的方法是提升模块参数。The simplest way to create a pipeline parameter for a module value is to promote a module parameter. 使用以下步骤将模块参数提升为管道参数:Use the following steps to promote a module parameter to a pipeline parameter:

  1. 选择要将管道参数附加到的模块。Select the module you want to attach a pipeline parameter to.

  2. 在模块详细信息窗格中,将鼠标悬停在要指定的参数上。In the module detail pane, mouseover the parameter you want to specify.

  3. 选择显示的省略号 (…)。Select the ellipses (...) that appear.

  4. 选择“添加到管道参数”。Select Add to pipeline parameter.

    屏幕截图显示了如何将模块参数提升为管道参数 1

  5. 输入参数名称和默认值。Enter a parameter name and default value.

  6. 选择“保存”Select Save

现在,你可以在提交此管道时为此参数指定新值。You can now specify new values for this parameter anytime you submit this pipeline.

选项 3:将数据集提升为管道参数Option 3: Promote a dataset to a pipeline parameter

如果要提交包含变量数据集的管道,则必须将数据集提升为管道参数:If you want to submit your pipeline with variable datasets, you must promote your dataset to a pipeline parameter:

  1. 选择要转换成管道参数的数据集。Select the dataset you want to turn into a pipeline parameter.

  2. 在数据集的详细信息面板中,选择“设置为管道参数”。In the detail panel of dataset, check Set as pipeline parameter.

    屏幕截图显示了如何将数据集设置为管道参数

现在,你就可以在下次运行管道时使用管道参数来指定其他数据集。You can now specify a different dataset by using the pipeline parameter the next time you run the pipeline.

将模块参数附加到管道参数以及将两者拆离Attach and detach module parameter to pipeline parameter

在本部分,你将了解如何将模块参数附加到管道参数以及将两者拆离。In this section, you will learn how to attach and detach module parameter to pipeline parameter.

将模块参数附加到管道参数Attach module parameter to pipeline parameter

如果要在触发管道运行的同时更改值,可以将重复模块的相同模块参数附加到同一个管道参数。You can attach the same module parameters of duplicated modules to the same pipeline parameter if you want to alter the value at one time when triggering the pipeline run.

下面的示例包含重复的清理缺失数据模块。The following example has duplicated Clean Missing Data module. 对于每个清理缺失数据模块,将替换值附加到管道参数 replace-missing-value :For each Clean Missing Data module, attach Replacement value to pipeline parameter replace-missing-value:

  1. 选择“清理缺失数据”模块。Select the Clean Missing Data module.

  2. 在画布右侧的模块详细信息窗格中,将“清理模式”设置为“自定义替换值”。In the module detail pane, to the right of the canvas, set the Cleaning mode to "Custom substitution value".

  3. 将鼠标悬停在“替换值”字段上。Mouseover the Replacement value field.

  4. 选择显示的省略号 (…)。Select the ellipses (...) that appear.

  5. 选择管道参数 replace-missing-valueSelect the pipeline parameter replace-missing-value.

    屏幕截图显示如何附加管道参数

已成功将“替换值”字段附加到管道参数。You have successfully attached the Replacement value field to your pipeline parameter.

将模块参数与管道参数拆离Detach module parameter to pipeline parameter

将“替换值”附加到管道参数后,该字段是不可操作的。After you attach Replacement value to pipeline parameter, it is non-actionable.

可通过单击模块参数旁的省略号 (...) 并选择“从管道参数拆离”,将模块参数与管道参数拆离 。You can detach module parameter to pipeline parameter by clicking the ellipses (...) next to the module parameter, and select Detach from pipeline parameter.

屏幕截图显示了附加到管道参数后该值无法操作

更新和删除管道参数Update and delete pipeline parameters

本部分介绍如何更新和删除管道参数。In this section, you learn how to update and delete pipeline parameters.

更新管道参数Update pipeline parameters

按照以下步骤更新模块管道参数:Use the following steps to update a module pipeline parameter:

  1. 在画布顶部选择齿轮图标。At the top of the canvas, select the gear icon.
  2. 在“管道参数”部分,你可以查看和更新所有管道参数的名称和默认值。In the Pipeline parameters section, you can view and update the name and default value for all of your pipeline parameter.

删除数据集管道参数Delete a dataset pipeline parameter

使用以下步骤删除数据集管道参数:Use the following steps to delete a dataset pipeline parameter:

  1. 选择数据集模块。Select the dataset module.
  2. 取消选中“设置为管道参数”选项。Uncheck the option Set as pipeline parameter.

删除模块管道参数Delete module pipeline parameters

按照以下步骤删除模块管道参数:Use the following steps to delete a module pipeline parameter:

  1. 在画布顶部选择齿轮图标。At the top of the canvas, select the gear icon.

  2. 选择管道参数旁边的省略号 (…)。Select the ellipses (...) next to the pipeline parameter.

    此视图显示管道参数附加到的模块。This view shows you which modules the pipeline parameter is attached to.

    屏幕截图显示了应用于模块的当前管道参数

  3. 选择“删除参数”以删除管道参数。Select Delete parameter to delete the pipeline parameter.

    备注

    删除管道参数将导致所有附加的模块参数被拆离,拆离模块参数的值将保留当前的管道参数值。Deleting a pipeline parameter will cause all attached module parameters to be detached and the value of detached module parameters will keep current pipeline parameter value.

使用管道参数触发管道运行Trigger a pipeline run with pipeline parameters

本部分介绍如何在设置管道参数时提交管道运行。In this section, you learn how to submit a pipeline run while setting pipeline parameters.

重新提交管道运行Resubmit a pipeline run

提交具有管道参数的管道后,可以重新提交具有其他参数的管道运行:After submitting a pipeline with pipeline parameters, you can resubmit a pipeline run with different parameters:

  1. 转到管道详细信息页面。Go to pipeline detail page. 在“管道运行概述”窗口中,你可以检查当前的管道参数和值。In the Pipeline run overview window, you can check current pipeline parameters and values.

  2. 选择“重新提交”。Select Resubmit.

  3. 在“设置管道运行”中,指定新的管道参数。In the Setup pipeline run, specify your new pipeline parameters.

屏幕截图显示了重新提交具有管道参数的管道

使用已发布的管道Use published pipelines

还可以发布管道以使用其管道参数。You can also publish a pipeline to use its pipeline parameters. “已发布的管道”是已部署到计算资源的管道,客户端应用程序可以通过 REST 终结点调用该管道。A published pipeline is a pipeline that has been deployed to a compute resource, which client applications can invoke via a REST endpoint.

已发布的终结点对于重新训练和批量预测应用场景特别有用。Published endpoints are especially useful for retraining and batch prediction scenarios. 有关详细信息,请参阅如何在设计器中重新训练模型在设计器中运行批量预测For more information, see How to retrain models in the designer or Run batch predictions in the designer.

后续步骤Next steps

在本文中,你了解了如何在设计器中创建管道参数。In this article, you learned how to create pipeline parameters in the designer. 接下来,你将了解如何使用管道参数重新训练模型或执行批量预测Next, see how you can use pipeline parameters to retrain models or perform batch predictions.

你还可以了解如何通过 SDK 以编程方式使用管道You can also learn how to use pipelines programmatically with the SDK.