DatasetConsumptionConfig 类
表示如何将数据集传送到计算目标。
表示如何将数据集传送到计算目标。
构造函数
DatasetConsumptionConfig(name, dataset, mode='direct', path_on_compute=None)
参数
| 名称 | 说明 |
|---|---|
|
name
必需
|
运行中的数据集的名称,该名称可能不同于已注册的名称。 该名称将注册为环境变量,可在数据平面中使用。 |
|
dataset
必需
|
将在运行中使用的数据集。 |
|
mode
|
定义如何将数据集传送到计算目标。 有三种模式:
默认值: direct
|
|
path_on_compute
|
计算中要提供数据的目标路径。 源数据的文件夹结构将保留,但是,我们可能会向此文件夹结构添加前缀以避免冲突。 用于 默认值: None
|
|
name
必需
|
运行中的数据集的名称,该名称可能不同于已注册的名称。 该名称将注册为环境变量,可在数据平面中使用。 |
|
dataset
必需
|
Dataset 或
PipelineParameter 或
tuple(Workspace, str) 或
tuple(Workspace, str, str) 或
OutputDatasetConfig
要传递的数据集,作为数据集对象、引入数据集的管道参数、(工作区、数据集名称)的元组或元组(工作区、数据集名称、数据集版本)。 如果仅提供名称,则 DatasetConsumptionConfig 将使用最新版本的数据集。 |
|
mode
必需
|
定义如何将数据集传送到计算目标。 有三种模式:
|
|
path_on_compute
必需
|
计算中要提供数据的目标路径。 源数据的文件夹结构将保留,但是,我们可能会向此文件夹结构添加前缀以避免冲突。 建议调用 tabular_dataset.to_path 以查看输出文件夹结构。 |
方法
| as_download |
设置要下载的模式。 在提交的运行中,数据集中的文件将下载到计算目标上的本地路径。 可以从参数值和运行上下文的input_datasets字段检索下载位置。
|
| as_hdfs |
将模式设置为 hdfs。 在提交的 synapse 运行中,数据集中的文件将转换为计算目标上的本地路径。 可以从参数值和 os 环境变量中检索 hdfs 路径。
|
| as_mount |
设置要装载的模式。 在提交的运行中,数据集中的文件将装载到计算目标上的本地路径。 可以从参数值和运行上下文的input_datasets字段检索装入点。
|
as_download
设置要下载的模式。
在提交的运行中,数据集中的文件将下载到计算目标上的本地路径。 可以从参数值和运行上下文的input_datasets字段检索下载位置。
file_dataset = Dataset.File.from_files('https://dprepdata.blob.core.windows.net/demo/Titanic.csv')
file_pipeline_param = PipelineParameter(name="file_ds_param", default_value=file_dataset)
dataset_input = DatasetConsumptionConfig("input_1", file_pipeline_param).as_download()
experiment.submit(ScriptRunConfig(source_directory, arguments=[dataset_input]))
# Following are sample codes running in context of the submitted run:
# The download location can be retrieved from argument values
import sys
download_location = sys.argv[1]
# The download location can also be retrieved from input_datasets of the run context.
from azureml.core import Run
download_location = Run.get_context().input_datasets['input_1']
as_download(path_on_compute=None)
参数
| 名称 | 说明 |
|---|---|
|
path_on_compute
|
计算中要提供数据的目标路径。 默认值: None
|
注解
从单个文件的路径创建数据集时,下载位置将是单个下载文件的路径。 否则,下载位置将是所有已下载文件的封闭文件夹的路径。
如果path_on_compute以 /开头,则将它视为绝对路径。 如果它不以 /开头,则将它视为相对于工作目录的相对路径。 如果指定了绝对路径,请确保作业有权写入该目录。
as_hdfs
将模式设置为 hdfs。
在提交的 synapse 运行中,数据集中的文件将转换为计算目标上的本地路径。 可以从参数值和 os 环境变量中检索 hdfs 路径。
file_dataset = Dataset.File.from_files('https://dprepdata.blob.core.windows.net/demo/Titanic.csv')
file_pipeline_param = PipelineParameter(name="file_ds_param", default_value=file_dataset)
dataset_input = DatasetConsumptionConfig("input_1", file_pipeline_param).as_hdfs()
experiment.submit(ScriptRunConfig(source_directory, arguments=[dataset_input]))
# Following are sample codes running in context of the submitted run:
# The hdfs path can be retrieved from argument values
import sys
hdfs_path = sys.argv[1]
# The hdfs path can also be retrieved from input_datasets of the run context.
import os
hdfs_path = os.environ['input_1']
as_hdfs()
注解
从单个文件的路径创建数据集时,hdfs 路径将是单个文件的路径。 否则,hdfs 路径将是所有已装载文件的封闭文件夹的路径。
as_mount
设置要装载的模式。
在提交的运行中,数据集中的文件将装载到计算目标上的本地路径。 可以从参数值和运行上下文的input_datasets字段检索装入点。
file_dataset = Dataset.File.from_files('https://dprepdata.blob.core.windows.net/demo/Titanic.csv')
file_pipeline_param = PipelineParameter(name="file_ds_param", default_value=file_dataset)
dataset_input = DatasetConsumptionConfig("input_1", file_pipeline_param).as_mount()
experiment.submit(ScriptRunConfig(source_directory, arguments=[dataset_input]))
# Following are sample codes running in context of the submitted run:
# The mount point can be retrieved from argument values
import sys
mount_point = sys.argv[1]
# The mount point can also be retrieved from input_datasets of the run context.
from azureml.core import Run
mount_point = Run.get_context().input_datasets['input_1']
as_mount(path_on_compute=None)
参数
| 名称 | 说明 |
|---|---|
|
path_on_compute
|
计算中要提供数据的目标路径。 默认值: None
|
注解
从单个文件的路径创建数据集时,装入点将是单个装载文件的路径。 否则,装入点将是所有已装载文件的封闭文件夹的路径。
如果path_on_compute以 /开头,则将它视为绝对路径。 如果它不以 /开头,则将它视为相对于工作目录的相对路径。 如果指定了绝对路径,请确保作业有权写入该目录。
属性
name
输入的名称。
返回
| 类型 | 说明 |
|---|---|
|
输入的名称。 |