首页 > 解决方案 > 在 AML 中将 ADLS 连接到笔记本时出错

问题描述

我在连接基于 ADLS 的 AML 笔记本中创建和注册的数据集时遇到错误。当我在设计器中连接此数据集时,我能够将其可视化。下面是我正在使用的代码。如果有人遇到同样的错误,请告诉我解决方案。

示例1 将数据集导入notebbok

from azureml.core import Workspace, Dataset

subscription_id = 'abcd'
resource_group = 'RGB'
workspace_name = 'DSG'

workspace = Workspace(subscription_id, resource_group, workspace_name)
dataset = Dataset.get_by_name(workspace, name='abc')
dataset.to_pandas_dataframe()

错误 1

ExecutionError: Could not execute the specified transform.
(Error in getting metadata for path /local/top.txt.
Operation: GETFILESTATUS failed with Unknown Error: The operation has timed out..
Last encountered exception thrown after 5 tries.
[The operation has timed out.,The operation has timed out.,The operation has timed out.,The operation has timed out.,The operation has timed out.]
[ServerRequestId:])|session_id=2d67

示例 2 将数据从数据存储区导入笔记本

from azureml.core import Workspace, Datastore, Dataset

datastore_name = 'abc'
workspace = Workspace.from_config()

datastore = Datastore.get(workspace, datastore_name)
datastore_paths = [(datastore, '/local/top.txt')]
df_ds = Dataset.Tabular.from_delimited_files(
    path=datastore_paths, validate=True,
    include_path=False, infer_column_types=True,
    set_column_types=None, separator='\t',
    header=True, partition_format=None
    )

df = df_ds.to_pandas_dataframe()

错误 2

Cannot load any data from the specified path. Make sure the path is accessible.

标签: azure-data-lakeazure-machine-learning-service

解决方案


对于您的数据集 abc,您能否在 ml.azure.com 上可视化/预览数据?可能是因为您的数据权限在 ADLS 中设置不正确。您需要向服务主体授予您正在访问的文件/文件夹的权限。

https://docs.microsoft.com/en-us/azure/data-lake-store/data-lake-store-access-control

ADLS 中文件的数据访问设置 在此处输入图像描述


推荐阅读