DataPath 类

表示数据存储中数据的路径。

由 DataPath 对象表示的路径可指向目录或数据项目(Blob、文件)。 DataPath 与 DataPathComputeBinding 类结合使用,该类定义了管道步骤执行期间的数据使用方式。 在管道提交期间,可使用 PipelineParameter 修改 DataPath。

初始化 DataPath。

继承
builtins.object
DataPath

构造函数

DataPath(datastore=None, path_on_datastore=None, name=None)

参数

datastore
Union[AbstractAzureStorageDatastore, AzureDataLakeDatastore]
默认值: None

[必需] 要引用的数据存储。

path_on_datastore
str
默认值: None

数据引用在后备存储中的相对路径。

name
str, <xref:optional>
默认值: None

DataPath 的可选名称。

datastore
Union[AbstractAzureStorageDatastore, AzureDataLakeDatastore]
必需

[必需] 要引用的数据存储。

path_on_datastore
str
必需

数据引用在后备存储中的相对路径。

name
str, <xref:optional>
必需

DataPath 的可选名称。

注解

下面的示例演示如何创建 DataPath,以及如何使用 PipelineParameter 向它传递参数。


   def_blob_store = ws.get_default_datastore()
   print("Default datastore's name: {}".format(def_blob_store.name))

   data_path = DataPath(datastore=def_blob_store, path_on_datastore='sample_datapath1')
   datapath1_pipeline_param = PipelineParameter(name="input_datapath", default_value=data_path)
   datapath_input = (datapath1_pipeline_param, DataPathComputeBinding(mode='mount'))

   string_pipeline_param = PipelineParameter(name="input_string", default_value='sample_string1')

完整示例可从 https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/machine-learning-pipelines/intro-to-pipelines/aml-pipelines-showcasing-datapath-and-pipelineparameter.ipynb 获取

方法

create_data_reference

使用此 DataPath 和给定的 DataPathComputeBinding 创建 DataReference 对象。

create_from_data_reference

从 DataReference 创建 DataPath。

create_data_reference

使用此 DataPath 和给定的 DataPathComputeBinding 创建 DataReference 对象。

create_data_reference(data_reference_name=None, datapath_compute_binding=None)

参数

data_reference_name
str
默认值: None

要创建的数据引用的名称。

datapath_compute_binding
DataPathComputeBinding
默认值: None

[必需] 用于创建数据引用的数据路径计算绑定。

返回

DataReference 对象。

返回类型

create_from_data_reference

从 DataReference 创建 DataPath。

static create_from_data_reference(data_reference)

参数

data_reference
DataReference
必需

[必需] 用于创建数据路径的数据引用。

返回

DataPath 对象。

返回类型

属性

datastore_name

获取数据存储的名称。

返回

名称。

返回类型

path_on_datastore

获取数据存储的路径。

返回

路径。

返回类型